PDA

View Full Version : HowTo: Fade HUD out-of-combat



N00bZXI
01-13-2007, 11:06 PM
Assuming the frame names are Nurfed_hudplayer and Nurfed_hudtarget, add this to the end of layout.lua

If you need want to fade more frames, add them to the table.



local function hudalpha()
if event == "UNIT_HEALTH" and arg1 ~= "player" then return end
for _,v in pairs( { Nurfed_hudplayer, Nurfed_hudtarget } ) do
if not UnitAffectingCombat("player") then
if not UnitName("target") then
if UnitHealth("player") == UnitHealthMax("player") then
v:SetAlpha(0)
else
v:SetAlpha(0.7)
end
else
v:SetAlpha(0.7)
end
else
v:SetAlpha(1.0)
end
end
end

local f=CreateFrame("FRAME")
f:RegisterEvent("PLAYER_REGEN_DISABLED")
f:RegisterEvent("PLAYER_REGEN_ENABLED")
f:RegisterEvent("UNIT_HEALTH")
f:RegisterEvent("PlAYER_TARGET_CHANGED")
f:SetScript("OnEvent", hudalpha )


Set your hud alpha to zero in the layout.

edit: If this is not how the would show/hide pre-2.0 - please let me know!

KBTibbs
01-14-2007, 02:40 AM
This is great, but let me ask you... what exactly do you mean by the end?

Would it still be within the

if (not Nurfed_UnitsLayout) then
...
end


or would it be even outside of that?

elderbre
01-14-2007, 10:38 AM
Working fine, thanks

KBTibbs:
You can copy and paste it anywhere, start, end, I just put it right below the Text Format Variables commented area.

Also, if you don't want the whole HUD to completely fade, switch the first v:SetAlpha(0) to v:SetAlpha(0.7) or whatever the value you want.

N00bZXI
01-14-2007, 12:35 PM
Outside of everything, including that. If you put it within a table chances are the mod will explode.

a67rhf7823jn8747==