-
Notifications
You must be signed in to change notification settings - Fork 13
EntityList
Urguwno edited this page Jul 13, 2014
·
7 revisions
- The EntityList is a lua metatable.
- The EntityList returns a lua table, where the index of each entry represents the EntityID and the value at this index is an objects of type ENTITY.
- The EntityList can be called with several filters, seperated by comma, which can be combined to get the entity(-ies) wanted. Make sure you use a combination of filters which can logically combined, meaning, using "nearest,lowesthealth" wont work, since each of it excludes the usage of the other.
- Example:
local el = EntityList("nearest,onmesh,gatherable,maxdistance=20")
if ( el ) then
local i,e = next(el)
while (i~=nil and e~=nil) do
-- the 'd' command is a global command for printing out information into the console
d("EntityID: ".. tostring(i).. " Entity : "..tostring(e))
local i,e = next(el,i)
end
end
- maxdistance=number
- Returns Entities within a distance of "number".
- mindistance=number
- Returns Entities beyond a distance of "number".
- nearest
- Returns the closest Entity.
- targetingme
- Returns Entities which are targeting the player.
- targeting=number
- Returns Entities which target the entity with the ID "number".
- lineofsight
- Returns Entities within line of sight to the player.
- alive
- Returns Entities with health > 0.
- dead
- Returns Entities with health == 0.
- hostile
- Returns aggressive Entities
- friendly
- Returns friendly Entities
- nocritter
- Returns Entities which are no critters
- interacttype=xxx
- Returns Entities with interacttype xxx
- onmesh
- Returns Entities which are on the navigation mesh.
- gatherable
- Returns Entities which you can gather or harvest.
- minlevel=number
- Returns Entities with a level higher than "number".
- maxlevel=number
- Returns Entities with a level lower than "number".
- lowesthealth
- Returns the Entity with the lowest health.
- shortestpath
- Returns the Entity with the shortest path (navigation path, not direct distance!).
- type=number
- Returns Entities with the enum UNIT_TYPE "number"
- contentid=number
- Returns Entities which have the given contentID, this can be used to search for specific NPCs/Enemies/Targets. Has been changed to also accept a list of content id's separated by a semicolon.
- exclude_contentid=number
- Returns Entities which do not have the given contentID, this can be used to exclude specific NPCs/Enemies/Targets. Also accept a list of content id's separated by a semicolon.
- exclude=number
- Returns Entities without the one with the entityID "number". Has been changed to also accept a list of entity id's separated by a semicolon.
- aggro
- Returns Entities which are having aggro towards the player.
- attackable
- Returns Entities which you can attack.
- targetable
- Returns Entities which you can target.
- isvendor
- Returns Entities which are vendors.
- npc
- Returns Entities which are npcs.
- player
- Returns Entities which are players.
- distanceto=number
- Calculates every distance-filter towards the entityID passed as "number" instead of the player.
- clustered=number
- Returns the enemy who has the most enemies around him up to a distance of "number", use this to get the best AOE target.
- noplayersaround=number
- excludes entities with other players around within a distance of "number".
- blacklisted
- Also returns entities that have been blacklisted
- The EntityList has Functions that can be used, in this example we are accessing a specific Entity by doing a lookup in the EntityList by EntityID.
local entity = EntityList:Get(EntityID)
if ( entity ) then
d("EntityID: ".. tostring(entity.id).. " EntityName : "..tostring(entity.name))
end
- :Get(number)
- Returns Entity from the EntityList which has the EntityID "number". If that Entity does not exist, an empty table will be returned.
- :AddToBlacklist(EntityID,Duration)
- Adds the entity with the passed entityid to the blacklist for the duration (in milliseconds). if duration is 0, the entity will be permanently blackliste
- :RemoveFromBlacklist(EntityID)
- Removes the entity with the passed entityid from the blacklist.
- :GetBlacklist()
- returns a lua table with the blacklisted entityids as keys and the remaining blacklisting time as the value. 0 means permanent.