Stamina System

So i have a sprint system with a stamina bar which works fine until yo hold shift before walking and it does not drain stamina but still works fine when walking first then sprinting?

IDK if i am missing something but shouldn’t it work even when sprinting before walking

Below i have attached images of my sprint logic and my drain stamina logic.


Hey @Diesel_Carter!

So the reason for this is because you have the EnhancedInputAction for your sprint running off of Started, which means execute one time as button is pressed. It can’t be reset until you lift the key and start it again.

Try going into your input action and setting it to “Hold” instead of “Pressed”, then here use “Triggered”. You can also remove the “Drain Stamina” loop at the end of your “Drain Stamina” function, as here it’ll just run every tick with “Hold”.

That is the main issue I see here. It’s hard to tell without active video of what’s happening. Hope that helps!

Could you explain to me what you mean by set it from pressed to hold? Also How do i maintain that delay on the drain stamina event? This is what is happening. Also for some reason i can stand still hold sprint and drain stamin is there a fix for that?

Thanks

Use a Sequence node, a Do Once node, and a timer. :slight_smile:
Have an event that can be called that resets everything, that you can call on Release, on running out of Stamina, on getting knocked over, whatever.

You need to have a check at the beginning for your current movement speed being greater than let’s say 300. So it can’t activate sprint if you’re moving slower than 300. :slight_smile:

Hey @Diesel_Carter!

Did you manage to get it figured out? Let us know what you did for future answer seekers! :slight_smile: