Percent HP Numbers

Is it possible to display the actor's HP as a percent in battle? I don't know how else to say it, so if somebody has any questions, feel free to ask. Thanks.

AceTheMad
I tried but it did not work properly for me.
under def real_number
when hp return (((@battler.hp / @battler.mhp) * 100).to_i)

It starts with 100, but as soon as a player gets hit it goes to 0.
Code:
((@battler.hp.to_f / @battler.mhp.to_f) * 100.0).to_i

if you divide integers by integers, it doesn't acknowledge the decimal point.
you can turn an integer into a float by adding .0, but when it's a variable, you add .to_f.
This works. Now the question is how to show a % as well.
on the function drawing the HP, use a spritnf command to bring it all together.
Code:
hp = (formula)
draw_text([rect], sprintf("HP: %d %s", hp, "%"))
or, directly, through string cuts:

Code:
draw_text([rect], "HP : #{hp} %")

I don't know what the actual function is, but it's definitely going to be a draw_text somewhere... track it down.
I figured it out myself using lots...and LOTS of testing.

In Battle Luna, under refresh_type0, I replaced

self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, str, type[:align])

with

self.bitmap.draw_text(0, 0, self.bitmap.width, self.bitmap.height, ((str.to_f / @max_number.to_f * 100).to_i).to_s + "%", type[:align])

So, if anybody else needs to know how to do this, there's your answer.

Thanks for the help, guys. This can safely be closed.

Original thread: https://forums.rpgmakerweb.com/threads/percent-hp-numbers.95022/