Quote: "I can't imagine anyone wanting a health value displayed as 0.52 or something"
But the health value doesn't need to be a decimal...maybe I'm not explaining this well.
So I'm making this RPG type script where a health bar is displayed - I've created HUDs for the health bar in 20 different intervals. Normally you could use the plrhealthless and plrhealthgreater commands to set which HUD should display when, however, the player can increase their maximum health, so obviously this won't work as these health values will constantly change.
So I've made this script to find out the ratio of health that the player has left, and am using this to compare health values.
Here is my full script, minus most of the HUD commands to save space:
:state=0:dimvar=healthcheck,state=1
:state=1:setvar=healthcheck $PH,subvar=healthcheck 100,divvar=healthcheck %healthmax,state=2
:state=2,vargreater=healthcheck 0.95:hudshow=health20,hudunshow=health19,hudunshow=health18,hudunshow=health17...etc
All I'm doing is dividing one variable by another (two integers) which should result in a value from 0-1, but as soon as a decimal value is required it goes into a fit and only displays 0
Official LightStorm Engine BETA Tester
/?m=forum_view&t=190541&b=21