Need some help with setting up a progress bar to track hp, mp and xp. Trying to set it to where the bar shows the percentage of current hp to max hp but can’t get it to work. Have very little knowledge about this so the more detailed the better thanks in advance.
Progress bars (I’m assuming you talk about the default UMG widget) have a function called
SetPercent which takes a normalized value (between 0.0 and 1.0). Use this when health, xp etc. change.
These are the steps to implement it:
- Add health variable to the appropriate object. Can be player controller, player state, character actor, or some other manager class
- When health changes, broadcast event along with the new value, maybe even the new and the old
- In the HUD widget’s construction script (EventConstruct node), bind to this event and change the progress bar’s value. I’m assuming the progress bar is a part of your HUD widget.
Which of these steps do you need more help with and how much?