(info) Other great resources: Official JS API docs, Scripting Forum

scavengerPlayer

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
scavengerPlayer value:7 77 7 710

Human / AI player id range:

(remember they are zero-indexed
so player #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.

// 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.

Availability

Requires:

Contents

Jump to:

See also

Related articles: