Skip to content
MMOMinion edited this page Sep 28, 2013 · 2 revisions

Buffs

  • Each Entity has a buff-lua-table attached which holds all buffs of that entity.

Accessing Buffs

local el = EntityList("nearest,onmesh,attackable,maxdistance=20")
if ( el ) then
   local i,e = next(el)
   if (i~=nil and e~=nil) then
      -- the 'd' command is a global command for printing out information into the console
      d("EntityID: ".. tostring(i).. " Entity : "..tostring(e))
      local entitybuffs = e.buffs      
   end  
end
  • The returned table entitybuffs is a lua table with all buffs.
  • The Buffs can be accessed like this:
-- the 'd' command is a global command for printing out information into the console
local entitybuffs = e.buffs
if ( entitybuffs ) then
   local index,buff = next (entitybuffs)
   while index ~=nil and buff~=nil do
      -- Here we print out the name of the buff into the console
      d(buff.name)
   end
end

Buff Object Attributes

id
Returns the unique ID of that buff (number).
ownerid
Returns the EntityID who cast that Buff onto this Entity(number).
slot
Returns an index which is just the order/place of that buff in the whole list (number).
name
Returns Buff Name (string).
duration
Returns the time left until the buff disappears (number).