entities - Windower/packages GitHub Wiki

This library provides access to the game's entity array and helper functions.

local entities = require('entities')

Dependency Required

To use this library, you must include entities in the manifest.xml file for your package:

<dependency>entities</dependency>

Tables

The entities table can be accessed directly with an entity's index to get the entity_object or nil if there is no entity at that position. It can also be iterated with pairs or ipairs to go through the entire entity array.

The following helpers are also provided:

Additionally, the entity array is subdivided into three categories, which provide the same helpers as the root table. They can be used for stricter access as well as to improve performance of the helpers that have to search through the array:


entities:by_id

Searches the entity array (or section) for the provided ID.

Definition

function entities:by_id(id : number)

Parameters

id number

The ID of the entity to find

Return

The entity_object with that ID if found, otherwise nil.



entities:by_name

Searches the entity array (or section) for the provided name. The search is case-sensitive.

Definition

function entities:by_name(name : string)

Parameters

name string

The name of the entity to find

Return

The first entity_object with that name if found, otherwise nil.



Data Entries

entities.npcs table

Provides the same behavior as the entities table, but restricted to the NPC section (indices 0x000 - 0x3FF).


entities.pcs table

Provides the same behavior as the entities table, but restricted to the PC section (indices 0x400 - 0x6FF).


entities.allies table

Provides the same behavior as the entities table, but restricted to the ally (pets, trusts) section (indices 0x700 - 0x8FF).

⚠️ **GitHub.com Fallback** ⚠️