Hi there,
I have implemented within my project a Footsteps System, I used a Float variable to scan the time between footsteps by adding this last variable to a Set Timer By Event, however, my project has a sprinting and crouching system and for this reason, to avoid having uncoordinated footsteps when running or crouching, I thought of changing the value of the Float variable (Footsteps Int) to solve the problem, this worked, but not as expected:
If the player is walking normally and while holding down the sprint input, the character will start to run, but the sound effect of the footsteps does not change and will continue to be the same as when the character was walking, same with regard to crouching.
This issue can be solved by releasing any input and pressing crouch or sprint input first and only then start walking; this seems very cumbersome and not fluid at all.
Is there any way to fix this issue?
I hope this makes some sense.
The thing is, the timer only reads the float once when set, and it doesn’t matter if you change the float. You need to restart the timer after changing the float value to force it to read the value again.
Just call Set Timer again every time you change the float variable. You don’t need to stop or invalidate it if it’s active, just call the same SetTimerByEvent node.
I tried inserting a Set Timer By Event after each change in the Float variable, but maybe I missed something; I tried running a playtest and now the steps are totally gone.
I guess I didn’t put Set Time By Event in the right place.
So, if I understand correctly, what I need to do is to move all the branches that indicate the various float values, after the Do Once that precedes the Set Timer By Event and connect all the possible nodes?