Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Rebuilds all Players Objects, use with care!

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
Players.refresh(); // rebuild all the players objects

Parameters

There are no parametersThe 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

Code Block
themeRDark
languagejavascript
titleTempting fate...
linenumberstrue
Players.refresh(); // are you really sure you want to do this?

 

 

Div
classbox
Availability
Status
colourGreen
titleOminous

Requires:

Div
classbox
Contents

Jump to:

Table of Contents
maxLevel5

Div
classbox

See also

Related articles:

Div
classbox

Players API

Topics:

Child pages (Children Display)
alltrue
depthall
pagePlayers API
excerpttrue