View Single Post
10-21-10, 03:32 PM   #8
Luponius
A Murloc Raider
Join Date: Oct 2010
Posts: 9
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.

Last edited by Luponius : 10-22-10 at 01:37 AM.
  Reply With Quote