Originally Posted by darkra
local HIC = CreateFrame("Frame","HIC_Frame");
HIC:RegisterEvent("PLAYER_REGEN_ENABLED");
HIC:RegisterEvent("PLAYER_REGEN_DISABLED");
HIC:SetScript("OnEvent", function() HelmInCombat() end);
function HelmInCombat()
if(event=="PLAYER_REGEN_DISABLED") then
ShowHelm();
elseif(event=="PLAYER_REGEN_ENABLED") then
ShowHelm('false');
end
end
Works like a charm mate, thanks a lot
|
For efficiency purposes (globals are evil):
change
Code:
HIC:SetScript("OnEvent", function() HelmInCombat() end);
to
Code:
HIC:SetScript("OnEvent", HelmInCombat)
and
Code:
function HelmInCombat()
to
Code:
function HelmInCombat(self, event)
Get in the habit of doing this, otherwise you're going to see your mods start breaking when they take out the event/arg1 globals in a future patch (they are already deprecated)