[SOLVED] Why are these similarly-timed effects lasting different amounts of time?

I've created two separate movement-affecting states, each of which I control with its own switch and parallel common event (not the actual "States" page of the database). One is "slowed", which only affects the speed of movement but not the frequency. The other is "hobbled", which only affects the frequency of movement but not the speed (however with the Altimit Movement plugin, directly changing the player movement frequency didn't really do anything, so I manually recreated the effect of having a delayed frequency of movement within the "hobbled" common event - so that's what's going on there).

The effects work great. But the timing of how long it takes these effects to "wear off" is being inconsistent and I don't understand why?? At the same time that I turn on the respective switch for either "state", I also set a respective variable to = current playtime + duration of effect (i.e. creating a "target playtime" when combined). Then within each state's common event, I use a conditional branch to check for when the actual playtime becomes equal to or greater than its respective "target playtime" variable, to then turn off the switch (and thus stop the common event and effect).

Spoiler: Slowed Events
slowed1.png

slowed2.png

Spoiler: Hobbled Events
hobbled1.png

hobbled2.png

For testing purposes, I'm setting each state's "target time" variable to "$gameSystem.playtime() + 3". The "hobbled" event's timing is perfectly fine, as it correctly "wears off" in about 3 seconds. But when I test the "slowed" event, I can count to about 7 or 8 before it finally wears off, despite its duration being set to 3, exactly the same as the "hobbled" event?? I even created another test event in which I set both "target time" variables simultaneously and then had it display the value of those variables back to me, just to make sure they are actually the same value. They are.

Spoiler: Simultaneous Set Variable Test
settest1.png

settest2.png

So why would it be taking longer for the "slowed" common event to detect that the actual playtime has reached the target time? "On paper", both events should be timed exactly the same. But in practice, they aren't. Don't tell me that movement speed affects the rate that playtime is updated or something??

Thank you for any ideas as to why this might be happening 😐
we knowwww its hardddd sometimes
we knowwww its hardddd sometimes

...?
^ Wow, you don't see trolls here too often. Ignore.

On-topic: I don't think character movement speed affects how fast the game will run through an event code (but I could be wrong). My guess is that your "Slowed" event takes longer for the game to run through because there's a loop in there, whereas your other event doesn't. It's strange, but I think I've had this happen to me with a looped event awhile ago. Members that are more familiar with the mechanics of how the engine reads event code will be able to confirm this.

If this turns out to be the case and you want to ditch the loop, could you just set the wait time for the 'Slowed' condition in frames, and get the game to just wait for that number of frames before turning off the switch? You could use something like:
this.wait($gameVariables.value(x));
^ Wow, you don't see trolls here too often. Ignore.

On-topic: I don't think character movement speed affects how fast the game will run through an event code (but I could be wrong). My guess is that your "Slowed" event takes longer for the game to run through because there's a loop in there, whereas your other event doesn't. It's strange, but I think I've had this happen to me with a looped event awhile ago. Members that are more familiar with the mechanics of how the engine reads event code will be able to confirm this.

If this turns out to be the case and you want to ditch the loop, could you just set the wait time for the 'Slowed' condition in frames, and get the game to just wait for that number of frames before turning off the switch? You could use something like:
this.wait($gameVariables.value(x));

That would seem so strange if it was the loop! But let me try real quick, and I'll edit this with an update once I do~

UPDATE: Oh my word, that was it! I ditched the loop and replaced it with the wait function and it's timed perfectly. I had no idea loops could slow things down! Thank you so much!!
^ Wow, you don't see trolls here too often. Ignore.

On-topic: I don't think character movement speed affects how fast the game will run through an event code (but I could be wrong). My guess is that your "Slowed" event takes longer for the game to run through because there's a loop in there, whereas your other event doesn't. It's strange, but I think I've had this happen to me with a looped event awhile ago. Members that are more familiar with the mechanics of how the engine reads event code will be able to confirm this.

If this turns out to be the case and you want to ditch the loop, could you just set the wait time for the 'Slowed' condition in frames, and get the game to just wait for that number of frames before turning off the switch? You could use something like:
this.wait($gameVariables.value(x));
So. Don't talk to me like that. Fool. You're coding was read by me and it didn't turn into anything cool.
actually that common event has a double loop - because parallel processes automatically loop on their own, and then you have a loop inside that parallel process.
That is always a bad idea.

I would strongly suggest that you place the change of the player speed in the map event itself, and have the common event ONLY check the time for ending the effect, without the loop command and only using the parallel loop itself.
actually that common event has a double loop - because parallel processes automatically loop on their own, and then you have a loop inside that parallel process.
That is always a bad idea.

I would strongly suggest that you place the change of the player speed in the map event itself, and have the common event ONLY check the time for ending the effect, without the loop command and only using the parallel loop itself.

I didn't even think about that (about the double-looping)! But that method would also work!

Thanks guys for pointing me in the right direction 👋

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-why-are-these-similarly-timed-effects-lasting-different-amounts-of-time.145486/