Is there any way to disable an action mapping when my stamina bar is lower than a certain amount?

Hey there,

I am trying to figure out a way to disable the ability to sprint and jump when I have no stamina left. I have a stamina system set up which decreases when you sprint or jump, however you can still continue to sprint and jump with 0 stamina. This is why I ask the question, can I disable the ability to sprint and jump if i have 0 stamina.?

Why yes of course.

You have a few options but disabling the mapping is not one you should try to achieve.

I’m not quite sure how you set up the run function but I’m sure you have something that makes you stop running when you release the button.

Add a branch on the “on actionButton pressed” and check if you are on or below 0 stamina. If so do nothing.

Add a “EventTick” and do the same. If it should be below 0 stamina add an execution line to the part where you already stop the running.

Does this get you somewhere or should I add a picture of a potential function?

Thanks for the reply!

I sort of understand what you mean but I am confused as too how I can check when I am below 0 stamina. I understand it but not sure on calling the right actions.

So this is how I have setup the whole stamina system, some of it comes from the tutorial on the forums by HorusHeretic (Sorry for all the links) :confused:

Ok now I’ actually confused. Shouldn’t it be like really easy?

If stamina is below or equal to 0 set “Is Sprinting” false. It’s that easy.

The nodes for that are real simple: “Get Current Stamina” into a “<=” node comparing it with 0. The pin to this branch goes into the fourth execution pin at the very beginning at your sequence node and if it throws true set “isSprinting” false.

Done.

In addition to what Erasio said, you should always clamp your stamina between zero and its max value, then check if its zero for a cleaner process. Type “Branch” after right clicking; it should give you an idea.

Thanks for spending the time to help me, it was easy to do however I should really go to bed as my mind is getting all confused, thanks again!