Stamina drain not working correctly when using enhanced input on UE 5.1.1

Hi, I Followed this tutorial Sprinting And Stamina - Unreal Engine 5 Tutorial - YouTube , I followed everything except I used enhanced input instead of input action. When it reaches zero it doesn’t stop draining and does not stop sprinting.

Thanks in advance.

Can you share your blueprint?




widget




Hey! For some reason I missed the earlier replies. Sorry for that.

I’ll check this out and reply in a few minutes.

You need to set the sprint input like this:
image
Then place your functions like so:

IMO you need to first check if there is enough stamina to drain and then subtract:


When working with floats it’s good practice to use =< or >= and not ==. Explanation
You can also check for the velocity at the same time using AND.

If you set the sprint input to Hold and Release you should be able to use the Ongoing out pin to execute the drain rather than making it recursive-like with the delay node:

Also for both drain and regen you should multiply * delta so that it’s not framerate dependant.

Hope it helps.

Thank You. It works!!

1 Like

It’s cool and Thank you for your help it works!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.