Stamina bar fade

Hey all, I was wondering how I can create a effect like this:

(The orange part of the stamina bar)

For me it looks like this:

Only for certain actions (Jumping, rolling, attacking etc) and not sprinting.

Thanks, any help is appreciated :slight_smile:

Add another progressbar underneath the main stamina progressbar, call it SimProgress as an example, change the alpha color of the main stamina bar background image to 0 so you can see the other progressbar underneath.

When you set a new value of stamina in the main progressbar, add a delay and then start interpolating the SimProgress to match the main bar. The delay can be used to set some bool, and in event tick for example if that bool is true start interpolating, once done set it to false.

I hope this helps.

3 Likes

Thanks I will try that

Hey im not really sure what to do, I am unfamiliar with interpolating, how would I do all of that what you said?

I also cant add a delay in the part where I set a new value of stamina in the main progressbar

Here’s an example with health, it behaves similar to the stamina example you provided.
This function is called to set health, once done it calls SimHealth event.

This is the SimHealth event, ProgressBarHealthSim is the bar underneath the main health progressbar.

This is the interpolation I was talking about

1 Like

Is the 3rd image with even tick in the widget blueprint? I have my stamina system in my character blueprint so does that matter or not? And where do you set the percent float variable?

Or do you mind also sending a image of the code inside the set percent custom event? (if it is a custom event, if not, would you mind telling me what it is?

Yes, what we care about is the progressbar which exists in the widget BP.

Set percent is not a custom function it’s a node that comes with unreal, you probably used it somewhere to set the progress bar value, unless you’re not using a progress bar ?

I have not used set percent node anywhere, this is what I have:

I created a binding for the progress bar:

and this is my stamina system in my character bp on event tick

How do you set the progress bar value for the set percent? When I add a input float in the binding I get a error

Oh you’re using the bind option, I’m not a big fun of that, it’s not efficient. The set percent is more event based.

In this case you need to do the same for the sim progressbar expect it will copy your stamina bar percent and use the interpolate node so do it slower so it will look animated.

Something like this

1 Like

Ah I was already trying to get rid of the binding, so this is the correct way to do it without a binding right?


This is in the Event Graph of the widget blueprint

Where do you call the update health function?

That would essentially be the same thing, updating the percent on tick. You need to call an event on the widget from the character when the stamina is updated. So only setting the percent when a new stamina value is set.
There’s nothing wrong with doing it on tick or binding it’s just less efficient that’s all.

From the character

Well stamina gets updated on tick from character aswell, so I think it wouldnt matter that much (but I could be wrong :p) and I got it to worked with this:


So thanks a lot for learning me and helping me, but the one issue I have is that the interpolation also happens when just sprinting, is there a way to only let it happen when attack, rolling jumping etc? For example with a branch and the condition IsJumping or something?

You can use a bool in the character, when you jump or roll set it to false, when you sprint set it to true. In the widget check the bool if true only then simulate the progressbar.

So now I have this, but now the 2nd stamina bar is always visible, I can send a video

So I set it to if sprinting, it cant simulate:


But then it is always visible when sprinting:

Either set the sim percent to be the same as the main progress if springing is true, or do a and check (if springing and sim percent is the same as the main percent) because if you’re sprinting and you still have some sim percent you need to finish it.