Quick script I whipped up to scan all unitIDs possible and output all units targeting you:
PHP Code:
local unitIDs = {"player","pet","vehicle","target","focus","mouseover","npc",party=4,partypet=4,raid=40,raidpet=40,boss=4,arena=5}
local scanData={}
local scanResults={}
local function scan(unitID)
if not unitID then
table.wipe(scanData) table.wipe(scanResults)
for key,val in pairs(unitIDs) do
if type(key) == "number" then
if UnitExists(val) then
scan(val)
end
else
for n=1,val do
local u = ("%s%d"):format(key,n)
if UnitExists(u) then
scan(u)
end
end
end
end
if next(scanResults) then
print("Targeting you are:")
for name, unitID in pairs(scanResults) do
print(("%s (%s)"):format(name,unitID))
end
else
print("No people targeting you found!")
end
else
local guid = UnitGUID(unitID)
if scanData[guid] then return end
scanData[guid] = true
local target = ("%starget"):format(unitID)
if UnitExists(target) then
if UnitIsUnit(target,"player") then
scanResults[(UnitName(unitID))] = unitID
else
scan(target)
end
end
end
end
SlashCmdList.SCANTARGETS = function() scan() end
SLASH_SCANTARGETS1 = "/scantargets"
How to use. Untested. Report back with issues.
Oh yeah, /scantargets to use.