It appears that Client:HateList() does nothing? The #hatelist command on a client returns nothing even when the client is engaged in combat?
Is this correct?
I'm building a routine that has guards who will only assist those who have good faction. To do that, I need to get a list of all the mobs who have client on their hatelist.
The only way I can figure out how to do this is to walk GetMobList() and call CheckAggro(client) on each mob in the zone. This seems pretty heavy duty, although it does work.
Is there a better way?
My code:
Code:
local ProxRangeXY = 40
local prox_friends = {}
function event_spawn(e)
eq.set_proximity(e.self:GetX() - ProxRangeXY, e.self:GetX() + ProxRangeXY, e.self:GetY() - ProxRangeXY, e.self:GetY() + ProxRangeXY)
eq.set_timer("setprox", 2000)
eq.set_timer("checkaggro", 500)
end
function event_timer(e)
if (e.timer == "setprox") then
eq.clear_proximity()
eq.set_proximity(e.self:GetX() - ProxRangeXY, e.self:GetX() + ProxRangeXY, e.self:GetY() - ProxRangeXY, e.self:GetY() + ProxRangeXY)
elseif (e.timer == "checkaggro" and #prox_friends > 0) then
local mob_list = eq.get_entity_list():GetMobList()
for i,friend in pairs(prox_friends) do
for ent in mob_list.entries do
if (ent:CheckAggro(friend) and ent:CalculateDistance(e.self:GetX(), e.self:GetY(), e.self:GetZ()) < ProxRangeXY) then
e.self:AddToHateList(ent)
end
end
end
end
end
function event_enter(e)
local faction = e.other:GetFaction(e.self)
if (faction < 5) then -- only help folks Amiable or better
table.insert(prox_friends, e.other)
end
end
function event_leave(e)
for i, friend in pairs(prox_friends) do
if (friend == e.other) then
table.remove(prox_friends, i)
end
end
end