(Solved) Help required with speed building system.

I'm currently making a game where the player can build speed as he dashes. The longer he dashes, the more speed he builds.

Said system is being coded through an event, and I'm actually really close to finishing it, but one thing is holding me back.

1747021566781.png

This is the first page of the event, which sets off another page if the Shift key + a directional key are being pressed.

1747021846213.png

This is the second page, and where the problem lives. There is a third one but that works so it doesn't matter.

My problem is that this code is supposed to check if the Shift key is still being pressed and if not, it will turn the self-switch off and restart the event. The thing is that the wait command before the self-switch that sets off the next page is causing the Else statement function to be delayed. Basically, it will wait 140 frames (in my case) before whatever is inside the Else statement happens.

I need to find a way to bypass this but so far, I have failed. Could anyone please enlighten me on this? Sorry if this is a super basic and an easily solvable issue. I'm really, really new to RPG Maker, perhaps to coding as a whole.
Hmmm does it work if you check in parallel common event conditional script something like this (if you want to wait even before the first speed increase, you can change the speed function to not count the +1 dash increase):

IF $gamePlayer.isDashing()
-> control variable dashcounter +1
ELSE
-> control variable dashcounter = 0
-> IF $gamePlayer.moveSpeed() > 4
---> $gamePlayer.setMoveSpeed(4)

IF variable dashcounter > 140
-> control variable dashcounter = 0
-> IF $gamePlayer.moveSpeed() < 6
---> $gamePlayer.setMoveSpeed($gamePlayer.moveSpeed()+1)

IF !$gamePlayer.isMoving()
-> control variable standstill +1
-> IF variable standstill > 5
---> control variable standstill = 0
---> control variable dashcounter = 0
---> $gamePlayer.setMoveSpeed(4)
ELSE
-> control variable standstill = 0
using the above code, inside a plugin (should be coded correctly)
will run as parallel, this avoid parallel updating, or try to
add a +5 or +10 wait frame buffer on top, to avoid lag just in case.

as the variable below also update +1 every 5 frames, instead of directly.
but speeding up is a cool idea though =)
I don't have a working script but have been thinking about how to create a similar system to simulate space ship acceleration/deceleration. Maybe it would work to create 10 specific velocity points that would cycle upward if player is pressing sprint and cycle down if a player is not pressing sprint. The parallel process "check time gap" represents acceleration/deceleration intensity. Half a second check for a cycle up or down seems like a good default.

The max velocity(1-10) or acceleration (parallel waiting frames) could be upgradeable if they are variables.
Hmmm does it work if you check in parallel common event conditional script something like this (if you want to wait even before the first speed increase, you can change the speed function to not count the +1 dash increase):

IF $gamePlayer.isDashing()
-> control variable dashcounter +1
ELSE
-> control variable dashcounter = 0
-> IF $gamePlayer.moveSpeed() > 4
---> $gamePlayer.setMoveSpeed(4)

IF variable dashcounter > 140
-> control variable dashcounter = 0
-> IF $gamePlayer.moveSpeed() < 6
---> $gamePlayer.setMoveSpeed($gamePlayer.moveSpeed()+1)

IF !$gamePlayer.isMoving()
-> control variable standstill +1
-> IF variable standstill > 5
---> control variable standstill = 0
---> control variable dashcounter = 0
---> $gamePlayer.setMoveSpeed(4)
ELSE
-> control variable standstill = 0
It worked like a charm! Thanks a lot, pal. And to everyone that tried to help as well.
I actually did try to use the "Is player dashing" condition and it didn't work for some reason, but I did not think about using a variable as a counter rather than a Wait function.
This thread is closed due to being marked solved. Report the next one so it’s easy to find~ If you need this thread reopened, report it to let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/solved-help-required-with-speed-building-system.177605/