How can I stop Auto-Sprint if player press any movement key?

I’m running an regular sprint with Shift and auto-run set to RightBracket.

Both drain stamina drop to 0, it start walking but if It’s from auto-run it will auto-walk and never stop unless I press the RightBracket again.

What can I do to stop the auto-run/auto-walk with WASD?

Unless I’m missing something couldn’t you just unflag them on any kind of movement input?

Actually it’s set in a way that when you press ] it will auto-run, you won’t have to touch your keyboard or mouse, now I want to press a movement key to stop the Auto-Run from working or be flag as ‘auto-sprint’. Right now I found a work around to to stop the movement but I’m still stuck with the flip-flop on value A which for me to double click ] to have auto-run again.

I understand your blueprint toggles auto sprint when pushing ‘]’. What I provided resets the isAutoSprinting and isAutoWalking bools when any other movement input is given (WSAD / Controller).

You also shouldn’t be using a flip/flop you should be using a branch that checks the current state of isAutoSprinting and the Stamina field like so:

Ahhh sorry now I understand better thank you, I’ve put the change you gave me but the movement input is feeding the signal forever, any idea why?

That’s interesting, I dont think there is anything wrong with your blueprint, do you have a controller plugged in somewhere? Sometimes if they are older they can have a bit of drifting which can cause constant input.

Not that I’m aware, the Mouse movement and gamepad input also has constant input, I’m confuse…

Ah right, sorry about that, the input also returns when it’s 0 thus why we use it as a scale value.

0 - No input
Greater than 0 - forward input
Less Than 0 - backward input

You can do a simple check like so:

Here if the value is equal to 0 then false is triggered, else true is and you can use what was posted previous.

Doing as this did indeed fix the AutoSprint, I had to remove the set isSprinting as it was killing the regular sprint with shift.

Now the issue is that if I press “s” it moves forward, I don’t believe it should have kill the movement input?

You’re not passing the Axis Value to the Movement Input as it’s scale value:

Thank you it’s all fix now!! I’ve learn a lot with just that, I really appreciate your help.

1 Like