Hi there, I have this addon I have made that hides (Alpha=0) the Player and Pet frames when mana or health is at max. However, it does not work on my Rogue, for which the frame still does not show even when energy is below max. Any help in solving this and/or input appreciated!
local f = CreateFrame("frame");
f:RegisterEvent("UNIT_HEALTH")
f:RegisterEvent("UNIT_MANA")
f:SetScript('OnEvent', function()
if arg1 ~= "player" then return end
if UnitHealth("player") < UnitHealthMax("player") then
PlayerFrame:SetAlpha(1)
PetFrame:SetAlpha(1)
elseif UnitMana("player") < UnitManaMax("player") then
PlayerFrame:SetAlpha(1)
PetFrame:SetAlpha(1)
elseif UnitMana("player") < 100 then
PlayerFrame:SetAlpha(1)
PetFrame:SetAlpha(1)
elseif UnitHealth("player") == UnitHealthMax("player") then
PlayerFrame:SetAlpha(0)
PetFrame:SetAlpha(0)
end
end)