Hi there, I am in desperate need of help. As always, my coding skills are limited, so if you have the time, I would be gratefull for simple yet explanatory answers.
I have spend the better part of the day trying to get Raid Targets to work. I started out by trying to use a template as suggested. This worked relatively good with the, IMO, huge problem that once you reload your UI, it doesn't find the table anymore. Took me a while to figure that one out. Restarting the game whenever I make a minor change is not an option for me.
First off, my raid targets are currently spawned like this:
Code:
local raidtarget = {}
for i = 1, 40 do
raidtarget[i] = oUF:Spawn('raid'..i..'target', 'oUF_Raid'..i..'Target')
raidtarget[i]:SetPoint('LEFT', raid[i], 'RIGHT', 5, 0)
end
When I spawn the raid frames like this, I get a distored picture, because for some reason oUF orders the raidmembers in a really weird way.
Code:
local raid = {}
for i = 1, 5 do
local raidgroup = oUF:Spawn("header", "oUF_Raid"..i)
raidgroup:SetManyAttributes('groupfilter', tostring(i), "showRaid", true, "yOffSet", -5)
table.insert(raid, raidgroup)
if(i==1) then
raidgroup:SetPoint("BOTTOMLEFT", UIPARENT, "BOTTOMLEFT", 100, 392)
else
raidgroup:SetPoint("BOTTOM", raid[i-1], "TOP", 0, 5)
end
raidgroup:Show()
end
I tried inserting: 'sortMethod', 'index', into it, but that didn't work/help.
So I went on and spawned the raidframes like this. This has the downside that I cannot order the raid by groups and hence the raidframes adjust whenever someone joins or leaves, but I could deal with that if I had to. Its more of a cosmetic downside. On the bright side, it does allow me to properly anchor the raid targets to their parents and get the expected results.
Code:
local raid = {}
for i = 1, 40 do
raid[i] = oUF:Spawn('raid'..i, 'oUF_Raid'..i)
if i == 1 then
raid[i]:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 100, 392)
else
raid[i]:SetPoint('BOTTOM', raid[i-1], 'TOP', 0, 5)
end
end
Now, since I have both raidframes and raid targets spawned, I want to build a filter that only spawns the approriate target when the parent unit is a MT. This is where I have hit a roadblock. I realize that I probably need a postupdate function tied to changing targets and possibly the MT status (which I have yet to find an event for, is there one) and that I need to filter the targets before they are actually spawned.
What I am wondering currently is:
- Can I even do this. Can oUF spawn and despawn frames in the blink of an eye in the middle of a raid?
- If the above is impossible, how would I go about to hide the frames when necessary? raid..i:Hide() doesnt seem to work.
I did get the whole thing working with tags like this:
Code:
oUF.Tags['[raidtargeticon]'] = function(u) if(not UnitExists(u)) then return '' end local i = GetRaidTargetIndex(u..'target'); return i and ICON_LIST[i]..'22|t' or ' ' end
oUF.Tags['[raidtargetname]'] = function(u)
if (not UnitExists(u)) or (not UnitExists(u..'target')) then return "" end
if not (GetPartyAssignment('MAINTANK', u)) and not (GetPartyAssignment('MAINASSIST', u)) then return ''
elseif (GetPartyAssignment('MAINTANK', u)) and not (GetPartyAssignment('MAINASSIST', u)) then return UnitName(u..'target') and oUF.Tags['[raidtargeticon]'](u..'target') ..oUF.Tags['[perhp]'](u..'target')..' ' ..'|cffff6464' ..string.sub(UnitName(u..'target'),1,15)
elseif (GetPartyAssignment('MAINASSIST', u)) and not (GetPartyAssignment('MAINTANK', u)) then return UnitName(u..'target') and oUF.Tags['[raidtargeticon]'](u..'target') ..oUF.Tags['[perhp]'](u..'target')..' ' ..'|cff64ff64' ..string.sub(UnitName(u..'target'),1,15)
end
end
oUF.TagEvents['[raidtargeticon]'] = 'UNIT_TARGET RAID_TARGET_UPDATE'
oUF.TagEvents['[raidtargetname]'] = 'UNIT_TARGET RAID_TARGET_UPDATE UNIT_NAME_UPDATE UNIT_HEALTH'
However, all atempts to convert this to actual bars have failed so far. Help please?