Originally Posted by
Speedtrax
Hey, I'm currently working on a new interface and pitbull is my unitframe of choice, however I've come to a point where I'd need some assistance from someone lua savvy :P
I'm trying to get the Health text to work like this. At full hp I want the health to only display as ex: 157k, but when damaged I want it to display: 95% - 147k and hopefully colored by hostility.
Thanks
Speed.
Code:
local c, m = HP(unit), MaxHP(unit)
local r,g,b = HostileColor(unit)
if c==m then
return "|cff%02x%02x%02x%s",r,g,b,VeryShort(c,true)
else
return "|cff%02x%02x%02x%s%% - %s",r,g,b,Round(100*c/m,0),VeryShort(c,true)
end
return
This should do it. If you want decimals on the percentage swap out "Round(c/m,0)" with "Percent(c,m)" or edit the number inside Round() with the amount of decimals you want. If you want decimals on the health, swap out "VeryShort()" with "Short()"