Versions Compared

Key

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

Defines the player ID for the scavenger faction on the map.

 

Values

The scavenger player always uses a fixed player slot on maps, depending on the number of players the map is designed to accommodate.

maxPlayers:2345678910
Scavenger player IDscavengerPlayer value:7 77 7 710

Highest human or Human / AI player IDid range:

(remember they are zero-indexed
so player #2 has player ID 1)

12345678

#1 is player id 0, etc.)

0..10..20..30..40..50..60..70..80..9

(warning) If there are no scavengers on the map (scavengers == false), the value of scavengerPlayer will be -1.

If you are making a custom scavfact.js (the AI script that controls the scavenger faction), scavengerPlayer == me.

Example

(warning) Remember the scavengerPlayer constant is only available in Warzone 3.2 and above.

Code Block
themeRDark
languagejavascript
linenumberstrue
// this is normal way of doing things...
if (scavengers) { // scavengers are enabled
  var scavDroids = enumDroid(scavengerPlayer); // get a list of their droids
}
 
// but this approach is probably better...
if (scavengerPlayer!=-1) { // there are actually scavs on the map
  var scavDroids = enumDroid(scavengerPlayer); // get a list of their droids
}

Notes

Because of bug #3123 early betas weren't able to get lists of scavenger objects via the enumDroid() and enumStruct() functions - they would throw an error stating that the player ID was invalid. In that scenario, the only way for an AI to get information about scavengers is via objects passed in to events such as eventAttacked() and eventObjectSeen().

If the .player property of the attacker or detected object matches the following criteria, it's a scavenger:

maxPlayers ≤ object.player < 12

So, you can get a rough idea of where scavengers are via eventAttacked() when one attacks you, then build a sensor at that location (or send a sensor droid) to see if you can get more scavenger objects via eventObjectSeen().

There appear to be issues enumerating scavenger structures and droids from within rules.js.

It is currently not possible to determine the colour of the scavenger player from within the JS API.

Div
classbox

Availability

Requires:

Div
classbox

Contents

Jump to:

Table of Contents
excludeContents

Div
classbox

See also

Related articles: