Hey wanted to create a custom trigger that would be able to tell me if i have aggro of less than 2 mobs in 8 yards. I wrote the code below inspired by the range check nameplate, but it doesnt seems to work.
function()
if not aura_env.last or aura_env.last < GetTime() - 0.2 then
aura_env.last = GetTime()
local count = 0
for i = 1, 40 do
local unit = "nameplate"..i
if UnitCanAttack("player", unit) and WeakAuras.CheckRange(unit, 8, "<=") then
local statusTarget = UnitThreatSituation("player", unit)
if statusTarget ~= nil then
if statusTarget > 1 then
count = count + 1
end
end
end
end
aura_env.count = count
end
return aura_env.count and aura_env.count < 2
end
If anyone can land me a hand 🙂