How do I do Level Blueprint to Widget Progress Bar?

I made a hunger system in my level blueprint and instead of printing a string I want to cast it to my hud through a progress bar. Does anyone know how to do this. Providing screenshots would be very helpful. Thanks!

  • Thrillride Games

The best way to go about this would to have your hunger system in your Player controller or Character/Pawn. If you added the HUD to the screen through your player controller, then you can simply promote the HUD to a variable and reference that to update your HUD whenever it changes.

Hi Prototype6143,

Thank you for replying to my post. I’m quite new to blueprints and unreal engine so maybe you could help out a little more? I took my hunger system and put it into my TopDownCharacter as shown here:

However, I don’t know where to go from here. I have the progress bar setup in the widget it is connected to but I am not sure what to put to bind it. Could you provide screenshots of what I would need to do to bind it for a progress bar? Also, is what I have so far (the blueprint in the TopDownCharacter) correct?

Thank you,
Thrillride Games

Unfortunately I am not able to access UE4 at the moment, but im more then happy to try and help.

From your setup things are pretty simple, but as for the tick event, this is something you would normally try and avoid as much as possible (Trying not to use tick unless its necessary for performance reasons). So here is an alternative which you can use and change to meet your needs.

Character Hunger Setup:
1: Find (Or recreate if you deleted it) the “On Begin Play” event and create/link a “Set Timer By Event” node in your character
2: Create a new “Custom Event” and name it something like “Event_UpdateHunger”
3: Link the little red box in the top right corner of the custom event to the little red box on the Set Timer by Event node.
4. Set the interval timing for the timer (33.33333 as seen in your delay).
Note: This timer will countdown and trigger your event automatically and you will no longer need to use the event tick for this.
5: You can then link the Set Hunger variable (Plus the clamp, Subtract, and Hunger variable) to your custom event.

This will now handle your hunger decreasing ever X seconds

Health Bar Setup:
1: As you will only need to create your health bar widget once in your character, you can add the create and Add widget to viewport nodes after the timer event on begin play.
2: Promote the returned Widget (between the create and add widget to viewport nodes) to a variable so you can access it later on.
3: The simplest way to go about this would be to bind the player hunger variable in your Widget. You can do this by going into your widget, selecting the text/ progress bar and in the properties next to Value(percentage) select Bind.
4: In the Bind function, you can then cast to your character and get the returned Hunger variable and set that as the value.
Note: Keep in mind that the progress bar is of a 0-1 value, so you might need divide the current value by the max value in order to get it to display 0-1. Also note that binding variables does add a small performance hit, so if it gets to a stage where you are updating a lot of variables in your hud, that it might be better to work with event triggers rather then binding variables directly.

Let me know if this helps!

Hi again,

It was a little hard for me to understand but I think I did everything as I was supposed to. However it is still not working. This is what I have for the progress bar:

I drug off from the hunger variable and added an int / int and set the bottom value to my max hunger but that didn’t work either. Am I doing something wrong?

Thrillride Games

I had a few minutes to throw together what ive explained above really quick to see if that helps…

In your character:

And your widget binding:

It looks like you almost had it in your screenshot, however, because the progress bar works on that 0-1 scale, throwing an int into it with a ToFloat node will basicly return either 0 or 1 (Empty or full), and nothing in between. But the setup ive shown here should work :slight_smile:

Hope the images help a bit more!

Thank you for the screenshots. It finally works! I was way off in my character lol. Have a nice day :smiley:

Thank you,
Thrillride Games