Entity index

From Valve Developer Community
Revision as of 05:45, 16 September 2009 by TomEdwards (talk | contribs) (Created page with 'An '''entity index''' is a unique integer given to every entity by the engine. It allows the same entity to be referred to across DLL boundaries. [[Entity limit|There can be…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

An entity index is a unique integer given to every entity by the engine. It allows the same entity to be referred to across DLL boundaries.

There can be up to 4096 entities in the index. The first 2048 entries are reserved for entities with edicts, which cross the client/server divide.

Note.pngNote:An entity index is not reliable between frames, as it can be freed from one entity and and reallocated to another at any time. Use CHandle for long-term storage.

Usage

To get an entity's index, call entindex(). When programming mods this is only useful for comparison with another entity index: most of the time a pointer can be used instead.

See also