Health "Bar" Number

So I a at a loss, I have searched for a answer for this. I have a Health Bar, but how do I have the HUD report the Health in numbers such as 78/100, etc. Any input would be great a B would be awesome…

Thanks!!

1 Like

Are your current health and max health numbers floats?

Float is required for the most part.

Right click in whatever folder you want to create your HUD. Click User Interface → Widget Blueprint

Once in there, place a Progress Bar. Down at the “Appearance” level, there should be Percent. Click to create a new bind for that.

(Ignore the Health Percentage thing above; I changed my graph to show you how I’d implement it. My Health Percentage is calculated in C++ Native Code. Also, ignore the typecast from Integer to Float.)

The cast is to my character type.

How do you set owning pawn?


This is in a regular blueprint. There’s probably a cleaner way to check. In Game HUD is my regular HUD.

Lemme know if that worked.

Currently Yes…I am considering changing them to Integers. Is one better than the other? I assuming it would be better for it to be an Integer.

I already have a Progress Bar, I have a functioning HUD. What I want to have happen is to replace the Progress Bar with Numbers:

Full Health: 100/100

Take some Damage:
69/100

Take more damage:

47/100

Etc…

Does that make more sense?? I guess I need a “tickng” or counting health bar.

Oh, so something more like what is pictured at the very top of the screen (ignore the overhead in-game part)


This is how I set that up using similar nodes to before:


I added that as a binding on the Content>Text function of a text block.

how do i make this not show a decimal?

If you just want a health value displayed there is no need for a “bar” of any kind. Why clutter the interface? Simply create a text box to represent the player health and have a binding or a function that updates the text within the box to display the player’s current health. So you can create a horizontal box with 2 text boxes inside. The first check the box in the upper right hand corner of the widget designer to make it a “variable”. The second text box you can hard code to the player’s max health or 100 if it will be a percent. Then simply update the first text box (the variable one) to equal player health through a binding or a function.

So if I understand correctly. When his player takes damage it is displayed with a decimal. Ex-69.11/100. He wants only whole numbers to be displayed. Ex- 69/100. Right? Okay so a solution is to not use the progress bar at all. Instead use two text boxes. One for current health and the other for max health. With text box health does this also mean that the player will take and gain damage as whole numbers or is it all in percentages but only displayed as whole numbers? Meaning the damged taken that is displayed, what player sees is 69/100 but it really it is still 69.11/100? I hope what I’m asking makes sense?

Round to Integer