If it helps, this is my current HP script snippet:
Code: Select all
function convertHP(currentHP, maxHP)
if currentHP and maxHP then
currentHP = tonumber(currentHP)
maxHP = tonumber(maxHP)
percHP = math.floor(currentHP*100/maxHP)
end
if percHP >= 81 then
HPcolor = "green"
elseif percHP >= 61 and percHP <=80 then
HPcolor = "yellow"
elseif percHP >= 41 and percHP <= 60 then
HPcolor = "orange"
elseif percHP <= 40 then
HPcolor = "red"
end
HP2:echo(currentHP, HPcolor, "c")
HP4:echo(maxHP, "green", "c")
HP5:echo(percHP, HPcolor, "c")
end