-
Is it possible to make the health bar percentage have the way the current health is? i dont know how to explain it… but here is my best try:
-
Basically my character has 200 health. In the stats screen it should say 100%. But is it possible to decrease 100 health, aka 50% of 200, to make it also say 50% in the stats screen?
It’s possible. So, whatever your max health is is the number you’ll divide by.
Current health divided by max health times 100.
Example:
Current HP: 200
Max HP: 200
Equation:
200/200 = 1
1x100 = 100
This result is your percentage of health remaining.
Let’s do the same thing with 100 health.
Current HP: 100
Max HP: 200
Equation:
100/200 = 0.5
0.5 times 100 = 50
You have 50% health remaining.
You can also round the result to have whole numbers.
2 Likes
*set maxhp 200
...
The monster takes a swipe across your face with its terrible claw!
*set hp -100
...
(top of stats screen)
*temp hppercent
*set hppercent (hp / maxhp)
*set hppercent hppercent*100
Then when you display hppercent, it’ll output a percentage of your max health. In this case 50.