Difference between revisions of "EntityId"

From Nomad DB
m (Jan moved page Lua:EntityId to EntityId)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Every [[Entity]] that is spawned into the world has an '''Entity Id'''. It is a 64-bit unsigned integer, which is represented in Lua as a string.
+
{{Page_WD2}}{{Page_WDL}}
 
+
Every [[Entity|entity]] that exists in the game world has a unique '''entity ID'''. It is a 64-bit unsigned integer, represented in Lua as a string. This also applies when multiple instances of the same entity exist simultaneously. Additionally, entity IDs are dynamic, meaning that an entity that is always being spawned, like the local player, will have a different ID each time the game is run. An exception to this are entities inside [[World Loading Unit|WLUs]] as they have pre-defined IDs.
  
 
'''Example'''
 
'''Example'''
Line 7: Line 7:
 
</pre>
 
</pre>
  
== Invalid Entity Id ==
+
== Invalid Entity ID ==
Some functions that return an Entity Id, might return one that is invalid. To check, if an Entity Id is valid, compare it against [[Lua:GetInvalidEntityId|GetInvalidEntityId]].
+
Some functions that return an entity ID might return one that is invalid. An entity ID can always be compared against [[GetInvalidEntityId]] to check whether it is valid or not.
  
 
== Related Pages ==
 
== Related Pages ==
* [[Lua:GetInvalidEntityId]]
+
* [[GetInvalidEntityId]]
 +
 
 +
[[Category:WD2 Lua]]
 +
[[Category:WD2 Entity]]

Latest revision as of 20:35, 27 October 2020

Every entity that exists in the game world has a unique entity ID. It is a 64-bit unsigned integer, represented in Lua as a string. This also applies when multiple instances of the same entity exist simultaneously. Additionally, entity IDs are dynamic, meaning that an entity that is always being spawned, like the local player, will have a different ID each time the game is run. An exception to this are entities inside WLUs as they have pre-defined IDs.

Example

15738498423673481953

Invalid Entity ID

Some functions that return an entity ID might return one that is invalid. An entity ID can always be compared against GetInvalidEntityId to check whether it is valid or not.

Related Pages