Infinite stamina?

Hi, so I want to make my player’s stamina unlimited when being chased by AI but I don’t know how. anyone can help me?

Hi @AstroShipt

Im not sure what you are referring to as the default templates do not have stamina programmed.

Can you be a bit more specific? By default stamina has ro be coded for the default templates in ue5 so stamina would he unlimited as it doesnt exist.

Hey @AstroShipt! Welcome to the Forums!

To add on a bit more to what @High500 asked asked:

  • Where are you getting your stamina from? Blueprints or code?
  • Are you using a marketplace product or a tutorial? If so which one(s)?
  • Can you share screenshots of your blueprints so we can see what may need to be added or changed to get the effect you want?

Any additional specifics you provide will go a long way in solving your problem!

2 Likes

Hi, I got stamina from a blueprint by following a tutorial on youtube because I’m still new to ue5. the screenshots are here

what I want is when I’m being chased by the AI ​​that I made then I will be able to keep running without running out of stamina but I don’t know how

Hey @AstroShipt,

Looks like we may be missing some key elements here. Where is the “Drain Stamina” called initially once you start your “Start Sprinting” event? Can you show us the portion of your blueprints where “Start Sprinting” is implemented?

It’s looking like this should be an easy fix, we just need to prevent “Drain Stamina” from being called and used.

Hey @Quetzalcodename
Do you mean you want to see the “Start Sprinting” function?

Hey @AstroShipt,

If that is where you are calling “Drain Stamina”, then yes, could you show is that function?

Hey @Quetzalcodename
Here is the screenshot of the “Start Sprinting” Function

Hey @AstroShipt,

Thanks, now I can definitely see what you are doing. So you have a few options. First is to remove the call to drain stamina all together if you do not need it.

Second would be to add a branch between set “Is Running” and "Drain Stamina. This would only work if sprinting starts AFTER the chase has already begun.

The last and safest option would be to add another branch right at the beginning of Drain Stamina so that it checks if the AI is chasing before doing any calculations and resetting if it is.

I hope the above is the answer you were looking for!

1 Like

hmm actually I have tried it but every time I enter the variable “Chasing?” from BP_AI to BP_FirstPersonCharacter it gives me an error, because I don’t know how to cast to BP_AI. Like where to put it or something like that

Hey @AstroShipt,

Check out the documentation on blueprint communication:

As well as this non-Epic affiliated tutorial on blueprint communication:

1 Like

yooo finally it worked thank you so much :smiley:

1 Like