Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::LUA

Quests::LUA Section regarding LUA scripts, help, questions, answers

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2015, 12:52 PM
iluvseq
Sarnak
 
Join Date: Aug 2009
Location: Somewhere
Posts: 53
Default Client:HateList() or determining which mobs are aggro on a client...

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
Reply With Quote
  #2  
Old 01-18-2015, 01:01 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Does a client have a hatelist?
Reply With Quote
  #3  
Old 01-18-2015, 02:12 PM
iluvseq
Sarnak
 
Join Date: Aug 2009
Location: Somewhere
Posts: 53
Default

That's my question!

There are methods for it throughout the code, but it doesn't seem to ever return anything, so I'm guessing it does not.
Reply With Quote
  #4  
Old 01-18-2015, 02:39 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by iluvseq View Post
That's my question!

There are methods for it throughout the code, but it doesn't seem to ever return anything, so I'm guessing it does not.
I never thought to see how a PC is handled when they are charmed. When charmed do they gain their own hatelist or does the NPC having done the charming use its hatelist to decide who the charmed PC attacks, etc?

Your post has me interested now, just wish I were in a position to look.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 11:47 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3