Players.alive[]

(info) This AI is still in early stages of development.

Players.alive[]

Returns an array of players objects for living players.

 

Syntax

var living = Players.alive; // array of living players objects

Return value

An array of living Players Objects, including Scavengers (if applicable), excluding spectators and vacant slots.

Notes

The indexes in the array are sequential and not based on player IDs.

Uses caching to boost performance. The cache is automatically invalidated every game tick. See Cache API for details.

Example

Iterating through living players
Players.alive.forEach(function(player) { // player = players object for current living player // player.id = id of living player });
Check if specific player is dead
// .isAlive filters out spectators and vacant slots var isLiving = Players[playerID].isAlive;