Skip to content
MMOMinion edited this page Feb 12, 2014 · 14 revisions

Entity

  • The Entity is the central game-object. Entities are returned by the EntityList or by some functions like Player:GetTarget().
  • The Entity object is a lua table itself and has several entries itself.

Accessing an Entity

  • Here we are calling the EntityList to give us the nearest object on the mesh within a maxdistance of 20 which we can attack. The 'd' - debug print into the console the ID of that Entity as well as the whole table with all attributes.
  • Example:
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))
   end  
end
  • The returned Entity e is a lua table and the i is the EntityID.
  • The Entity attributes can be accessed like this:
-- the 'd' command is a global command for printing out information into the console
d(e.hp.percent)
-- returns the health percentage value of this entity 'e'
d(e.targetid)
-- returns the targetID of this 'e'
d(e.distance)
-- returns the distance to this entity 'e'

Entity Attributes

name
Returns Entity Name (string).
id
Returns Entity ID (number).
type
Returns Entity ENTITYTYPE(number).
chartype
Returns Entity CHARACTERTYPE(number).
contentid
Returns an unique ID for that type of Entity (number).
hp
Returns a lua table which holds health values (table).
```lua -- the 'd' command is a global command for printing out information into the console local hptable = Player.hp d(hptable.current) -- current Health d(hptable.max) -- max Health d(hptable.percent) -- Health percent ```
mp
Returns a lua table which holds MP / TP values (table).
```lua -- the 'd' command is a global command for printing out information into the console local mptable = Player.mp d(mptable.current) -- current MP/TP d(mptable.max) -- max MP/TP d(mptable.percent) -- MP/TP percent ```
tp
Returns TP of that Entity (number).
pos
Returns a lua table which holds the position of that Entity (table).
-- the 'd' command is a global command for printing out information into the console
local postable = Player.pos
d(postable.x) -- x position
d(postable.y) -- y position
d(postable.z) -- z position
d(postable.h) -- current heading in radians
distance
Returns (3D) distance to that Entity (number).
distance2d
Returns (2D) distance to that Entity (ignores the "up-axis") (number).
pathdistance
Returns path distance measured with the navigationsystem towards that Entity (number).
job
Returns Entity JOB(number).
level
Returns Entity level (number).
aggro
Returns if Entity is aggro towards the player. (boolean).
aggropercentage
Returns a numeric value 0-100 which represents the amount of aggro the Entity has towards the player. (number).
attackable
Returns if the player can attack this Entity (includes a targetable check already) (boolean).
targetable
Returns if the player can target this Entity (boolean).
alive
Returns if the health of that Entity is larger 0 (boolean).
aggressive
Returns if the Entity is aggressive (boolean).
friendly
Returns if the Entity is friendly(boolean).
incombat
Returns if the Entity is incombat(boolean).
los
Returns if that Entity is in line of sight to the player (boolean).
cangather
Returns if the player can gather/harvest this Entity (boolean).
gatherattemptsmax
Returns the maximum number of gatherattempts of this Entity (number).
gatherattempts
Returns the remaining number of gatherattempts of this Entity (number).
ownerid
Returns the EntityID this entity belongs to (number) (usable for a Pet).
fateid
Returns the fateID this entity belongs to (number).
action
Returns an identifier of the action this Entity is currently doing (number).
lastaction
Returns an identifier of the last action this Entity was doing (number).
onmesh
Returns if this Entity is on the currently loaded navmesh (boolean).
hitradius
Returns a value that represents the "size" of this Entity, aka how FAT it is ;) (number).
buffs
Returns a lua table with all BUFFS & DEBUFFS of that Entity (number).
castinginfo
Returns a lua table containing the currently channeled or cast action. The channeling info contains the casttime, channeltime,actionid and the targetid the action is channeled on. The casting info is only valid for a short time when a action is cast that has no channel time or when the channeling is done and the actual action effect is taking place.

Casting Info Attributes

channelingid
The id of the action that is being channeled (integer).
channeltime
The number of seconds since the channeling started (float).
casttime
The cast time of the action that is being channeled (float).
channeltargetid
The id of the entity that the channeled action is targeting (integer).
castingid
The id of the action that is being cast ( only valid for around 1 seconds, then it is reset ) (integer).
castingtargetcount
The number of entries in the castingtargets table (integer).
castingtargets
A table containing the targets of the action being cast (integers).