Hi,
so I want to make a HealthBar with WeakAura that changes colors at different health% stages but I dont know how to put a %value in LUA Custom code, I just can put total hp values which I dont want.
Does anybody know how to correct that ? This is what I got so far http://pastebin.com/AeiZm8gJ but it triggers at i.e. 60 total health and not 60% health.
Thanks budds.
- - - Updated - - -
Got this fixed on my own and with some friends help.
For everyone else whos interested in sth like this; you need to define a maxhp (100%)
This is how it looks;
Code:
function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
local player_health = UnitHealth("player")
local max_health = UnitHealthMax("player");
local red, green, blue = 0,0,0
if player_health <= max_health*0.60 and player_health >= max_health*0.30 then
red, green, blue = 1,1,0
elseif player_health <= max_health*0.30 then
red, green, blue = 1,0,0
else
red, green, blue = 0,1,0
end
return red, green, blue, 1
end