-
Notifications
You must be signed in to change notification settings - Fork 52
Entity
MMOMinion edited this page Oct 30, 2013
·
14 revisions
- 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.
- 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'
- 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).
- distance
- Returns distance to 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).
-- 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