• News

• Industries

• Learning & Support

• Community

• Marketplace

# Integer into progress bar

So I have taken my health (which is an integer) and converted it into a float to show in the progress bar:
[ATTACH=CONFIG]

However, the progress bar doesn’t go down but instead is either full or empty ( full to begin, as soon as I take any damage it goes straight to empty.)

any advice would be awesome thanks- Percy

because you do an integer division and then convert to float.
Basic Math:
100 Health / 100 = 1
50 Health / 100 = 0
25 Health / 100 = 0
You have to do it the other way round: first convert Health to Float and then Divide by 100.
I’d suggest to use a float in [0,1] for health, so you don’t have to convert it at all.

The above answer is only good if your MaxHP is 100. For a more generic solution, youcan use the following:

You can comvert it to a float, and then use an “Map Range Unclamped” node, where you take the input as 0 to MaxHp, and output it between 0 and 1, since the progression bar sees 0 as empty, and 1 as full.