This AI is still in early stages of development.
Players.refresh()
- Aubergine
Owned by Aubergine
Rebuilds all Players Objects, use with care!
Syntax
Players.refresh(); // rebuild all the players objects
Parameters
The function does not care whether you are brave, stupid or terminally-inquisitive.
Return value
Does not return anything other than a nagging doubt that you just did something stupid.
Notes
All Players Objects will be rebuilt. Some important things to note:
- All caches associated with the Players API will be invalidated
- Any players which are not alive at the time of the refresh will be marked as vacant slots.
- Spectator detection will be disabled if the game is more than a few seconds old. So, even if there are spectators, they will not be marked as spectators and will start being treated as enemies or allies. You can override this by defining a custom isSpectator() function.
- Any mods targeted at Players Objects will be reapplied after the objects are rebuilt. Mods can supply their own refresh functions to be called after being re-applied if desired.
The only time this should be used is during an eventStartLevel() that is caused by using loadLevel() – in this scenario the player has just started a new "level" (map) within the current game, or something like that. The loadLevel() function and it's effects are not yet fully understood.
If in doubt, don't use Players.refresh()!
Example
Tempting fate...
Players.refresh(); // are you really sure you want to do this?
Contents
Jump to:
See also
Related articles:
- Player Initialisation – general info on player initialisation
- Environment Sequences – common sequences of events in the JS API
Players API
Topics:
- isPlayerAlive() — A global function that performs a basic, un-cached check to determine if a player is alive.
- eventTeamRevived() — A global event triggered when a team is revived (one or more of it's players resurrected).
- eventPlayerDefeated() — A global event triggered when a player is defeated.
- eventPlayerRevived() — A global event triggered when a player is revived (brought back to life).
- Modding Players API — The Players API supports modding...
- isSpectator() — A global function that performs a basic, un-cached check to determine if a player is a spectator based on presence of a Satellite Uplink at the start of the game.
- Players[] — Main interface to Players API and an array of all players in the game, including Scavengers.
- Players.alliesAndMe[] — Returns an array of players objects for living allied players, including me.
- Players.alive[] — Returns an array of players objects for living players.
- Players.allies[] — Returns an array of players objects for living allied players.
- Players.refresh() — Rebuilds all Players Objects, use with care!
- Players.dead[] — Returns an array of players objects for dead players.
- Players.scavenger — Returns the players object associated with the Scavenger faction, even if Scavengers are disabled.
- Players.me — Returns the player object associated with your script.
- Players.enemies[] — Returns an array of players objects for living enemy players.
- Players.mod() — Extend the Players API and Players Objects with your own features...
- Players Objects — The objects returned by the Players API are enhanced versions of Player objects...
- eventTeamDefeated() — A global event triggered when a team is defeated (all it's players defeated).