Help with Stamina System

I am stuck, I have set up a very basic stamina system using blueprints. I wanted to avoid using tick so instead created custom events and functions incorporating timelines, something I have no experience with. The system seems to work find except for the fact that if I hold shift regardless of whether I am moving or not the stamina will decrease. I have tried using branches to check if my max walk speed is greater than 0 but still have been unable to get this properly functioning. Any help is much appreciated. Thank you.

As far as I can tell, if these four screenshots are the entirety of your stamina logic, you don’t have anything that checks if you’re moving or not.

I’d recommend you use the ‘InputAxis MoveForward’/‘InputAxis MoveRight’ events in your character blueprint to verify any time you move. Those two events return a value in the direction you move (0 if there was no input and 1 if you move forward/-1 if you move back, ect) once per frame depending on if you’ve moved or not. So if the value of the MoveForward Axis is 1, you know your character is moving.

Hey thank you for your reply. I should have clarified when posting I had tried and then removed speed checks when they didn’t seem to work. After posting last night I had the idea to try one other that I hadn’t yet which was getting velocity and looking to see if it was greater that 0 which I added to a branch in the stamina loss function. The only issue remaining is if I sprint then stop there is an intended 4 second delay for regeneration. If I sprint let go of shift then sprint again that delay doesn’t cancel, as soon as I let go of shift the second time stamina instantly starts refilling.

Good to hear you have the other part working. As for your last issue, replace the delay node in ‘StaminaLogic’ with a retriggerable delay. That way, any time the delay is triggered again, the duration will be refreshed.

I think what you are looking for is Velocity. I am using a similar set up using Custom Events and Timelines. To know if the Pawn is moving you need to check if Velocity X&Y = 0 and if true, do your logic to add stamina points back to your pawn.