Player speed resets to map speed when menu is opened then closed

Hello,

I tried to look on the forums to see if this has been answered but maybe i am not looking at the right terms. I have a fatigue system in my game that when you hit a certain variable threshold, the players speed should be permanently decreased across all maps until items or certain decisions increase the variable and then change the speed back. Currently I am setting speed 2 ways: a common event that is being called whenever energy is decreased that sets the player movement route speed:

1743920289878.png


And in a plugin I wrote that decreases the energy level whenever a step is taken:

1743920373002.png


I am finding that if players open a menu and then close it, the speed resets back to the default map speed. It feels clunky to have a parallel common event running every 10 frames to set the players speed, and not only that, but because its setting it so often the players movement becomes choppy. Is there a better way to handle this?

Thanks!
Opening and closing the menu refreshes the map. There is a Triacontane plugin to run a common event on menu close but maybe there's a more elegant solution
The menu is a different scene, so opening/closing it will recreate the map scene, including all its display sprites, window references, etc. The actual map/character data should remain intact, though.

Maybe the plugin you wrote (or a different one you're using) hooks into an inappropriate method, causing it to run its code at the wrong time(s)? Have you tried implementing the energy changes with a Parallel event instead? I just checked my Cae_DashOpts plugin, since it appears in your screenshot, but I don't see anything obviously wrong with its code.

It feels clunky to have a parallel common event running every 10 frames to set the players speed, and not only that, but because its setting it so often the players movement becomes choppy.
It's choppy because you're using a move route, which interrupts normal movement while active. Instead, I'd suggest a Script command to set the move speed, e.g.
JavaScript:
$gamePlayer.setMoveSpeed(3);
This will take effect immediately, even mid-move.
you could try this plugin otherwise [PreserveMap] which runs the background
constantly if the menu is open, it might work as well 🙂
Thanks for the responses everyone, really insightful stuff. I should have looked into the plugins I was using when I noticed this behavior, but this being my first RPGMaker game, I thought that's just how RPGMaker worked haha... I went through my plugins and the TSR Move Event plugin I had was the culprit. I've disabled it and everything is working as expected! Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/player-speed-resets-to-map-speed-when-menu-is-opened-then-closed.176780/