I'm trying to get a counter to show the players health in percent. So, for example, if the player had 15/20 health, then the counter would say 75%. I'm using this formula:
100 / (Value("HP") / Value("HP max"))
However, MMF seems to round off the value of (HP / HP max) every time. So instead, if the player had 15/20 health, it wouldn't return 1.333, but MMF would round it off to 1.0, so the counter would say 100%. I've tried sticking random .0's in there, and I've tried multiplying/dividing with 1.0 everywhere to get MMF to work with decimals, but it doesn't seem to work.
I have a feeling there's a very simple answer to this, that I might even have used before in MMF 1.5, but I just can't come up with anything
n/a
Deleted User
16th March, 2007 at 12:32:12 -
I remember having the same problem using the MMF 2 demo, are you sure you've got the latest version/build of MMF 2?
That's all I can think of E_E
Your formula for percentage seems to be wrong (though it's probably just a typo) - you'd need to use (100 * Current HP)/Max HP. Multiplying first will make the rounding error less catastrophic.
i remember having this problem even back in TGF. I fixed it, and i think i did it by dividing with 1.0, just don't remember what i divided it with i used this in my Monster Combat game though, so if needed i can look through it when i get home.