PitBull4 : LUA Text Health color
Moderators: Fridmarr, Worldie, Aergis, _Chloe
4 posts
• Page 1 of 1
PitBull4 : LUA Text Health color
I'd like to change my health text color according to my health level. Does anybody know how to do this with LUA Text?
Loatr Tankadin since patch 1.9
- Ezharon
- Posts: 89
- Joined: Mon Nov 19, 2007 9:52 pm
- Location: New Caledonia
Re: PitBull4 : LUA Text Health color
- Code: Select all
local cur,max = HP(unit), MaxHP(unit)
local diff = max-cur
local pct = cur/max
local color = 0
if pct == 1.0 or pct == 0.0 then
color = 0xFFFFFF
elseif ( pct <= 0.50 ) then
color = 0xFF0030 + floor(pct*255)*512
else
color = 0x10FF30 + floor((1-pct)*235)*(131072)
end
return "|cff%x%s%%", color, Percent(cur,max)
White if 100% or 0%. Green to Red as health percent goes down.
- Raeli
- Posts: 124
- Joined: Wed Oct 31, 2007 10:23 pm
Re: PitBull4 : LUA Text Health color
hey,
There's a function built-in in Pitbull for this: HPColor(cur, max)!
simple colored percentage:
Bye, RedAces.
There's a function built-in in Pitbull for this: HPColor(cur, max)!
simple colored percentage:
- Code: Select all
local cur, max = HP(unit), MaxHP(unit)
local r,g,b = HPColor(cur, max)
return "|cff%02x%02x%02x%s%%|r",r,g,b,Percent(cur,max)
Bye, RedAces.
-

RedAces - Posts: 500
- Joined: Tue Dec 01, 2009 9:39 am
- Location: Germany
4 posts
• Page 1 of 1
Return to Add-ons, UI, and Macros
Who is online
Users browsing this forum: No registered users and 2 guests
