Thanks on the SetAlpha() correction. So far this is where I'm at with the code:
Code:
onLoad:
-------
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
self:RegisterEvent("UNIT_TARGET")
onEvent:
--------
if event == "PLAYER_REGEN_DISABLED" and UnitExists("target") then
Self:SetAlpha(1)
self:GetParent():SetAlpha(0.9)
elseif event == "PLAYER_REGEN_DISABLED" then
Self:SetAlpha (0.8)
self:GetParent():SetAlpha(0.7)
elseif event == "PLAYER_REGEN_ENABLED" and UnitExists ("target") then
Self:SetAlpha (0.5)
self:GetParent():SetAlpha(0.4)
else
Self:SetAlpha (0)
self:GetParent():SetAlpha(0)
I also found this posted by you, Kagaro:
Changing a frame based on Target
OnLoad
self:RegisterEvent("UNIT_TARGET")
self:Hide()
OnEvent
if UnitExists("target") == nil then
self:Hide()
return
end
I guess that explains my mistake with the target checks, I assumed it automatically returns a positive if i have a target and a negative if i don't. Should of included == nil. Will try that when I can.