PDA

View Full Version : Error in my hud



Narghul
09-10-2007, 03:00 PM
My problem is that the "player" hud won't hide when I have full hp and mana..

can anyone locate the error?



----------------------------------------------------------------------------------------
-- Text Format Vars
-- (HP/MP text and status bars)
-- $miss = Missing hp/mp
-- $cur = current hp/mp
-- $max = Max hp/mp
-- $perc = Percent hp/mp
--
-- (Name/Level text)
-- $name = Name
-- $level = Level
-- $class = Class
-- $guild = Guild
-- $race = Race
-- $rname = PvP Rank Name
-- $rnum = PvP Rank Number
-- $key = Key Binding
--
-- Element Names
-- hp, mp, xp, combo, target
-- name, level, class, race
-- pvp, leader, master, feedback
-- group, status, buff, debuff
-- raidtarget, highlight, pet, portrait
--
-- StatusBar Animations
-- glide
----------------------------------------------------------------------------------------

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) --full, ooc, no target
else
v:SetAlpha(0.6) -- ooc, no target, NOT FULL
end
else
v:SetAlpha(0.8) -- OCC, Target
end
else
v:SetAlpha(1) -- IC
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 )

ManaBarColor[0] = { r = 0, g = 1, b = 1, prefix = TEXT(MANA) }; -- mana

if (not Nurfed_UnitsLayout) then

Nurfed_UnitsLayout = {};

Nurfed_UnitsLayout.Name = "|cffff0000Twin Dragons HUD|r";
Nurfed_UnitsLayout.Author = "Unknown - Updated: ElderBrE";

--Frame Design
Nurfed_UnitsLayout.Layout = {

hudplayer = {
type = "Button",
uitemp = "SecureUnitButtonTemplate",
vars = { unit = "player" },
size = { 200, 400 },
Mouse = false,
FrameStrata = "LOW",
Anchor = { "TOP", "$parent", "TOP", -200, -320 },
children = {
hp = {
type = "Texture",
layer = "OVERLAY",
size = { 200, 234 },
Texture = NRF_IMG.."dragon_player_HP",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, 0 },
--VertexColor = { 0.274, 0.274, 0.388, 0.90 },
vars = {
bar = 234,
height = 400,
width = 200,
fill = "top",
},
},
bg1 = {
type = "Texture",
size = { 200, 400 },
Texture = NRF_IMG.."dragon_player_HP",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, 0 },
VertexColor = { 0, 0, 0, 0.75 },
},

mp = {
type = "Texture",
layer = "OVERLAY",
size = { 200, 222 },
Texture = NRF_IMG.."dragon_player_mana",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", -2, -30 },
VertexColor = { 0.619, 0.619, 0.866, 1 },
vars = {
bar = 222,
height = 400,
width = 200,
fill = "top",
},
},
bg2 = {
type = "Texture",
size = { 200, 400 },
Texture = NRF_IMG.."dragon_player_mana",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", -2, -30 },
VertexColor = { 0, 0, 0, 0.75 },
},
},
},


hudtarget = {
type = "Button",
uitemp = "SecureUnitButtonTemplate",
vars = { unit = "target" },
size = { 200, 400 },
Mouse = false,
FrameStrata = "LOW",
Anchor = { "TOP", "$parent", "TOP", 200, -320 },
children = {
hp = {
type = "Texture",
layer = "OVERLAY",
size = { 200, 234 },
Texture = NRF_IMG.."dragon_target_HP",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, 0 },
--VertexColor = { 0.274, 0.274, 0.388, 0.90 },
vars = {
bar = 234,
height = 400,
width = 200,
fill = "top",
},
},
bg3 = {
type = "Texture",
size = { 200, 400 },
Texture = NRF_IMG.."dragon_target_HP",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, 0 },
VertexColor = { 0, 0, 0, 0.75 },
},
mp = {
type = "Texture",
layer = "OVERLAY",
size = { 200, 222 },
Texture = NRF_IMG.."dragon_target_mana",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, -30 },
--VertexColor = { 0.619, 0.619, 0.866, 0.60 },
vars = {
bar = 222,
height = 400,
width = 200,
fill = "top",
},
},
bg4 = {
type = "Texture",
size = { 200, 400 },
Texture = NRF_IMG.."dragon_target_mana",
Anchor = { "BOTTOMLEFT", "$parent", "BOTTOMLEFT", 0, -30 },
VertexColor = { 0, 0, 0, 0.75 },
},
},
},
},
},
}:
end

Tenten
09-12-2007, 08:42 PM
atm you have it set so that it will just disappear when u have full hp. it doesnt check for mana. try the one thats posted in the faq. there are two ways. either to set it as a function or to do as the last poster in the faq thread has posted :)

but i dont see any reason why it wouldnt disappear when ur at full health :| ur sure ur not targeting something? cus then it shows up :)

a67rhf7823jn8747==