How to make stamina bar for Running? (UMG)

Hi there! I’m just having a little trouble so, that’s why I’ here! :smiley: So, my question probably is simple but I’m learning UE4, and I’m still noob. So, how to create UMG based stamina bar, that would be affected by running? Of course through Blueprints. Any ideas are welcome!

Hello ,

There are multiple ways to do this, but if a Progression Bar works for you, you could do it this way. First, you’ll need to set up a variable in your character or player controller’s blueprint to track your Stamina. Be sure this is set as Editable. You’ll need to link this up to your running to decrement this variable while running. After that, you can create a Progress Bar in your widget. If you select the Progress Bar, you should be able to find the Percent value and see a “Bind” option beside it. From the Bind dropdown, select “Create Binding”. This will bring you to a scripting graph for the widget to calculate what the Percent will be. You can then set it up like this:

After that, if you spawn the UMG, you should be all set up. It should decrease the progress bar’s percent every time you decrease the stamina. As a note, the Percent field goes from a 0 to 100 value. If your Stamina’s max is something above 100, you will need to do the necessary math to get its percentage compared to your max within the Binding we created.

Hope this helps!

Edit: Grammar