Skip to content

Filling the array

Roberto de Deus Barbosa Murta edited this page Nov 7, 2019 · 1 revision

To retrieve an array, use the GetEntityArray function:

ETHEntityArray bombs;
GetEntityArray("bomb.ent", bombs);

Now bombs stores an array that contains every bomb.ent entity in scene. The index [] operator for this object is overloaded in order to provide direct access to the ETHEntity@ handle.

bombs[i].SetPosition(vector3(10,20,30));

It is also possible to fill an array with the Insert method, as shown below:

ETHEntityArray party;
party.Insert(SeekEntity("knight.ent"));
party.Insert(SeekEntity("mage.ent"));  
party.Insert(SeekEntity("rogue.ent"));  
party.Insert(SeekEntity(druidEntityID));

The += operator is also overloaded. It may be used to concatenate two arrays.

Clone this wiki locally