Stamina system not working

So the stamina system is not working right. I followed one youtube video and it’s working right in there but in my case it isn’t working (stamina does not decrease).

And of course, I have check the variables that they have the correct values.

Thanks!

what tutorial were you watching? there all kinds of potential issues with this script. what is your goal with this functionality? maybe we can find a better way to accomplish it.

to address some of the issues, first running something like this on tick could be a performance issue. i would suggest doing the script on a timer or as a button press event. using the equal nodes could cause issues as well since floats may not be 100 percent accurate or there could be dalays in the script so the value changes too rapidly. to combat this i would use a more open determinate such as >=. another issue i see is the two set nodes for sprint true near the top center, with these you are setting the value to true then immediately to false which is redundant.

Hi,

As Thompson said running this off the tick will eat performance fast and cause delays ( lag like behavior ).

Ue4 Blueprinting is awesome but no programming language that I know of will let you get away with fast switching a variable from one frame to the next it will just consider it a null change.

I think the majority of your issue stems from using a tick. try using timers.

Hmm, first of all thanks for comments! If you guys say that this type of stamina (for sprinting) is eating performance then how you would create the code? Im making FPS multiplayer so every performance issue is on the scope.

And here is the tutorial: - YouTube

I had to dig this up and dust it off from an old ue4 game i made but it should work for you.

I call it stamina with an stamina over time return.

Check it out maybe it’ll help you.

Ps. I was young and did not care about neatness much back then so I rarely cared to use reroute nodes lol I am way better now. Excuse the mess.

I’ve made a stamina system that doesn’t rely so much on EventTick, and has checks built into it to make sure stamina isn’t being drained when it shouldn’t be. Only when player is inputing sprint and is actually moving.

https://youtu.be/OPGazvSnIBQ

I hope the video helps.