round(usr.HP+usr.MaxHP*(50/usr.MaxHP))
if(usr.HP >= 0 && usr.MaxHP >= 0 || usr.HP <= 0 && usr.MaxHP <= 0)
round(usr.HP+usr.MaxHP*(50/usr.MaxHP))
else
round(abs(usr.HP)+abs(usr.MaxHP)*(abs(50/usr.MaxHP)))(50/usr.MaxHP)))*-1
ID:178307
May 29 2002, 10:28 am
|
|
This isn't actually a question, I just thought I would share this equasion with people. If you want to show someone's HP as a percentage rather than an actual number (which is useful for style and for making HP meters), the equasion for doing so is this...
round(usr.HP+usr.MaxHP*(50/usr.MaxHP)) if(usr.HP >= 0 && usr.MaxHP >= 0 || usr.HP <= 0 && usr.MaxHP <= 0) |
Have you tested this? Mathmatically, that expresion reduces to round(usr.HP + 50) which is definately not what you want.
Calculating a percentage is as easy as:
var/percentage = round(current_value/max_value * 100)