#Custom Threat / Range check

7 messages · Page 1 of 1 (latest)

fickle hull
#

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 🙂

bold venture
#

seems to work as described, only problem i noticed is it still returns true if there's no mobs near you. if you want that fixed you can add something like this

    if not aura_env.last or aura_env.last < GetTime() - 0.2 then
        aura_env.last = GetTime()
        local count = 0
        local unitexists = false
        for i = 1, 40 do
            local unit = "nameplate"..i
            if UnitCanAttack("player", unit) and WeakAuras.CheckRange(unit, 8, "<=") then
                unitexists = true
                local statusTarget = UnitThreatSituation("player", unit)
                if statusTarget ~= nil then
                    if statusTarget > 1 then
                        count = count + 1
                    end
                end
            end
        end
        aura_env.count = count
        aura_env.unitexists = unitexists
    end
    return aura_env.count and aura_env.count < 2 and aura_env.unitexists
end```
drowsy agate
#

if i have aggro of less than 2 mobs

#

return aura_env.count == 1

flat crag
#

does WeakAuras.CheckRange() still work after the nuke?

drowsy agate
#

blizz roll back on their change but only against npc

flat crag
#

ah nice, I'd heard they were going to revert it but didn't know they already had