Stamina Drian Problem?!?!

I have a stamina system, and when a press shift it doesn’t drain stamina if I’m not running, BUT when I hold shift after i have already started sprinting and then I stop with shift being pressed down it still drains the stamina and plays my camera shake. What do I do?

Hey @Stale_bathtub483

so you want to drain stamina when you are sprinting => Running/velocity above 0 + SHIFT and you want to gain stamina when you are standing/velocity=0 ?

Where do you set your IsSprinting boolean to true or false? Where do you call your stamina events?

im sorry idk what you mean by stamina events, this is a better look at my stamina though.

Hey @Stale_bathtub483

I meant your CustomEvents called GainStamina and DrainStamina, sry. Do you call these Events with your CustomEvents for sprinting? Can you Show your CustomEvents for sprinting?

so you want to drain stamina when you are sprinting => Running/velocity above 0 + SHIFT and you want to gain stamina when you are standing/velocity=0 donwloa game freeat apkloky

This is my run I am really new to unreal, but I’m not calling drain or gain that event only happens when that specific blueprint is called, I don’t have time to look at my code now this is a picture from yesterday but I can get more screenshots if necessary.

Hey @Stale_bathtub483

here is an example how you can create a stamina system:

In this example I call the stamina event with the timer.

Sprinting.zip (55.8 KB)

This example is from this post losing stamina while holding shift and not moving - #6 by L1z4rD89 where you will also find your stamina system. I think you are missing the IsVelocity > 0 check like this:

i will try this i will also look into your stamina thank you i will let you know if there is any trouble or if it doesnt work.

THANK YOU, seriously that fixed it, i had to add that line of code to my camera shake to but now it works thank you very much.

sorry but it fixed my problem but now when i stand After i have ran and then run again it doesn’t drain until i let go then hold again

Hey @Stale_bathtub483

the velocity check does not work as intended. Can you try this:

or

and:

SprintingAlternative.zip (54.2 KB)