View Full Version : Hit Point Percentage
KumoShinagi
07-06-2005, 03:24 AM
I need help on how to make a % value from the current Hp of a party member.
I know how to use variables to a certain extent.
If anyone who is good at math, calculations, or formulas, please help or add.
Thanks in advance.
thetruecoolness
07-06-2005, 03:38 AM
Well the best way to get decimals in the game it to mutiply a number by a power of 10 for the number of decimals you want. In your case since you want percentage you want to get 2 decimal places, so multiply Hp by 100 then divide (HP * 100) / Max HP. So in RPG Maker 2 terms
Data: Variable [HP*100] = [Hit Points] * 100
Data: Variable [HP-Percentage] = [HP*100] / [Max Hit Points]
You have to multiply first because RPG Maker does not keep fractional parts so if you divided first and then multiplied the answer by 100 you would still get 0. This should work, though I haven't tested it I'm pretty sure it will.
KumoShinagi
07-06-2005, 03:49 AM
Thanks, I'll try it out. :)
EDIT: Works like a charm! Thank you very much! :D
littlemaster
07-06-2005, 05:46 PM
Oh snap. I tried this for the first time in my life and it works. You guys sure know what you're doing.
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.