Versions Compared

Key

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

Rebuilds all Players Objects.

 

Syntax

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

Parameters

There are no parameters.

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.
  • Custom extensions will need to accommodate this scenario (eg. they might need to clear down internal caches) – if they don't strange things could happen.

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
title
Stable
Ominous

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