Versions Compared

Key

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

Get Returns the players object associated with the Scavenger faction, even if Scavengers aren't enabledare disabled.

 

Syntax

Code Block
themeRDark
languagejavascript
linenumberstrue
var scavs = Players.scavenger; // returns scav players object

Return value

The Players Object associated with the Scavenger faction.

Notes

The Players Object will be returned even if Scavengers are not present on the map.

This is useful because the players object's .isAlive property is a much more accurate and concise way to determine if there are Scavengers roaming the map than using the native scavengers and scavengerPlayer globals:

  • It checks to see if Scavengers are enabled on the map first
  • If they are, it checks to see if they actually have any structures or droids
  • The result is cached to keep performance high

(warning) Scavengers don't have a start position, so:

Players.scavenger.position == undefined

Example

Code Block
themeRDark
languagejavascript
titleAre Scavengers roaming the map?
linenumberstrue
var scavsRoamingMap = Players.scavenger.isAlive;
Div
classbox
Availability
Status
colourGreen
titleStable

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