For some reason I thought you and the person asking about hiding raid frames in battlegrounds were the same person, so I used your function. Anyway, Will, I'd change that to..
local partyToggle = CreateFrame('Frame')
partyToggle:RegisterEvent('PLAYER_LOGIN')
partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
partyToggle:RegisterEvent('PARTY_MEMBER_CHANGED')
partyToggle:SetScript('OnEvent', function(self)
if(InCombatLockdown()) then
self:RegisterEvent('PLAYER_REGEN_ENABLED')
else
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
local _, zonetype = IsInInstance()
if(zonetype == 'pvp') then
party:Hide()
for _, v in ipairs(Raid) do v:Hide() end
else
if(GetNumRaidMembers() > 0) then
party:Hide()
for _, v in ipairs(Raid) do v:Show() end
else
party:Show()
for _, v in ipairs(Raid) do v:Hide() end
end
end
end
end)
local partyToggle = CreateFrame('Frame')
partyToggle:RegisterEvent('PLAYER_LOGIN')
partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
partyToggle:RegisterEvent('PARTY_MEMBER_CHANGED')
partyToggle:SetScript('OnEvent', function(self)
if(InCombatLockdown()) then
self:RegisterEvent('PLAYER_REGEN_ENABLED')
else
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
local zone = GetRealZoneText()
if(zone == 'Warsong Gulch' or zone == 'Arathi Basin' or zone == 'Alterac Valley' or zone == 'Eye of the Storm') then
party:Hide()
for i, v in ipairs(Raid) do v:Hide() end
for i, v in ipairs(pets) do
UnregisterUnitWatch(v)
v:Hide()
end
else
if(GetNumRaidMembers() > 0) then
party:Hide()
for _, v in ipairs(Raid) do v:Show() end
for i, v in ipairs(pets) do
UnregisterUnitWatch(v)
v:Hide()
end
else
party:Show()
for _, v in ipairs(Raid) do v:Hide() end
for i, v in ipairs(pets) do
RegisterUnitWatch(v)
v:Show()
end
end
end
end
end)
I didn't check to see if those are the exact zone names for the BGs, so if that doesn't work, you might want to check the names.
Assuming you're using haste's latest version with the Enable() and Disable() functions, try...
local partytarget = {}
for i = 1, 5 do
partytarget[i] = oUF:Spawn("party"..i.."target", "oUF_Party"..i.."Target")
if i == 1 then
partytarget[i]:SetPoint("TOPLEFT", party, "TOPRIGHT", 8, 0)
else
partytarget[i]:SetPoint("TOP", partytarget[i-1], "BOTTOM", 0, -4)
end
end
local partyToggle = CreateFrame('Frame')
partyToggle:RegisterEvent('PLAYER_LOGIN')
partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
partyToggle:RegisterEvent('PARTY_MEMBER_CHANGED')
partyToggle:SetScript('OnEvent', function(self)
if(InCombatLockdown()) then
self:RegisterEvent('PLAYER_REGEN_ENABLED')
else
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
if(GetNumRaidMembers() > 0) then
party:Hide()
for i,v in ipairs(partytarget) do
v:Disable()
end
else
party:Show()
for i,v in ipairs(partytarget) do
v:Enable()
end
end
end
end)
In the latest 3.0 patch line 38 in ouf.lua is throwing an error because UnitReactionColor is nil. Being lazy and not wanting to figure out what's changed until wowcompares posts this patch's data, I just added the old UnitReactionColor table to my ouf.lua.
local PartyTargets = {}
for i = 1, 5 do
PartyTargets[i] = oUF:Spawn("party"..i.."target", "oUF_Party"..i.."Target")
PartyTargets[i]:SetAttribute('showRaid', false)
if i == 1 then
PartyTargets[1]:SetPoint("TOPLEFT", party, "TOPRIGHT", 8, 0)
else
PartyTargets[i]:SetPoint("TOP", PartyTargets[i-1], "BOTTOM", 0, -4)
end
end
or
if(GetNumRaidMembers() > 0) then
party:Hide()
for i = 1, 5 do
PartyTargets[i]:Hide()
end
else
party:Show()
for i = 1, 5 do
PartyTargets[i]:Show()
end
end
Thanks Zariel. Actually this worked for the party frame doing if self:GetParent():GetName() == "oUF_Party" then but not the raid frame for some reason however I've managed to do what I intended by using if (not unit) for the raid and the above for the party so its working Thank you!
For the raid frame I believe it needs to be
self:GetParent():GetName():match('^oUF_Raid')
There are actually 8 frames that are matched by that, the headers for each group in a raid.. oUF_Raid1 through oUF_Raid8.
try printing each argument to check that they are correct
Well I've determined that the unit argument has nil value.
Quote from haste »
Easy solution: Don't run such updates in the setStyle function.
What would be a better way to go about it?
I tried iterating through the raid frames and assigning a font string to each with:
local numRaidMembers = GetNumPartyMembers()
for i = 1, 8 do
local stop = false
for j = 1, 5 do
if i == 1 then
cur = j
else
cur = ((i-1)*5)+j
end
if cur > numRaidMembers then
stop = true
break
end
local thisFrame = "oUF_Raid"..i.."UnitButton"..j
local name = thisFrame.."name"
local color = RAID_CLASS_COLORS[select(2, UnitClass("raid"..cur))]
thisFrame:CreateFontString(name, "OVERLAY")
name:SetFont(fontStyle, fontHeight)
name:SetShadowColor(0,0,0)
name:SetShadowOffset(0.8, -0.8)
name:SetTextColor(color.r, color.g, color.b)
name:SetJustifyH("LEFT")
name:SetPoint("TOP", 0, 0)
name:SetText(UnitName("raid"..cur))
name.UNIT_NAME_UPDATE = updateName
end
if stop == true then break end
end
That attempt is probably way off, and hasn't even taken into consideration updating when people join/leave, but I'm learning as I go. That bit is throwing the error: "attempt to call method 'CreateFontString' (a nil value)"
Obviously UnitClass() is being fed invalid input, but I have no idea why. I haven't been able to find where these functions are being called to see what is being passed to them.
I just started using Sanity 2 and I noticed that the strata of the backdrop is higher than that of the text, I looked through the XML and lua files but couldn't find anything obvious to change to fix it. I uploaded a screenshot as an example.
0
Disclaimer: I'm not a native speaker, so there are bound to be errors. ;)
0
0
I didn't check to see if those are the exact zone names for the BGs, so if that doesn't work, you might want to check the names.
0
0
0
or
0
?
0
For the raid frame I believe it needs to be
There are actually 8 frames that are matched by that, the headers for each group in a raid.. oUF_Raid1 through oUF_Raid8.
0
Well I've determined that the unit argument has nil value.
What would be a better way to go about it?
I tried iterating through the raid frames and assigning a font string to each with:
That attempt is probably way off, and hasn't even taken into consideration updating when people join/leave, but I'm learning as I go. That bit is throwing the error: "attempt to call method 'CreateFontString' (a nil value)"
0
I'm using a modified version of P3lim's layout.
The default has this in updateRaidHealth():
I'm putting names on the raid bars and want to colour them according to class, so I modified setFontString() and setRaidStyle() to the following:
I get the following error:
Obviously UnitClass() is being fed invalid input, but I have no idea why. I haven't been able to find where these functions are being called to see what is being passed to them.
0
http://sotilas.monkeh.net/sanity.jpg
Anyone suggestions to fix it?