Advertisement
sorvani

#_Tunare.lua

Mar 7th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. -- #_Tunare NPCID: 127001
  2. -- This is Tunare up in her tree.
  3. function event_combat(e)
  4.     if (e.joined) then
  5.         -- spawn #tunare to fight
  6.         eq.spawn2(127098,0,0,-247,1609,-40,424);
  7.         call_zone_to_assist(e.other);
  8.         eq.depop_with_timer();
  9.     end
  10. end
  11.  
  12. function call_zone_to_assist(e_other)
  13.     -- grab the entity list
  14.     local entity_list = eq.get_entity_list();
  15.     -- aggro the zone onto whoever attacked me.
  16.     -- do not aggro these mobs
  17.     local exclude_npc_list = Set {127001,127004,127097,127098,127105};
  18.     for i = 127000, 127999, 1 do
  19.         -- if the current NPCID is not in the exclude list add the client to their hate list.
  20.         if (exclude_npc_list[i] == nil) then
  21.             local npc = entity_list:GetNPCByNPCTypeID(i);
  22.             -- npc.valid will be true if the NPC is actually spawned
  23.             if (npc.valid) then
  24.                 npc:AddToHateList(e_other,1);
  25.             end
  26.         end
  27.     end
  28. end
  29.  
  30. -- Set function example from Programming In Lua
  31. -- http://www.lua.org/pil/11.5.html
  32. function Set (list)
  33.   local set = {}
  34.   for _, l in ipairs(list) do set[l] = true end
  35.   return set
  36. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement