function HealthPercentage() -- health value to display. whole numbers only. local TargetPercentHealth = math.ceil((UnitHealth("target") / UnitHealthMax("target") * 100)); -- recolor text at 35% (future idea: class detection) if TargetPercentHealth < 35 then PortraitHealth_Health:SetTextColor(1,0,0); else PortraitHealth_Health:SetTextColor(1,1,0); end -- change the portrait to show current health if UnitIsDead("target") then PortraitHealth_Health:SetText('Dead'); else PortraitHealth_Health:SetText(TargetPercentHealth .. '%'); end end