(remember they are zero-indexed so player #1 is player id 0, etc.)
0..1
0..2
0..3
0..4
0..5
0..6
0..7
0..8
0..9
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
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:
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.
scavfact.js – the scavenger faction AI script bundled with Warzone
Ultimate Scavenger AI Mod – a game mod that replaces the normal scavfact.js with a massively improved version, and also adds a new "Crane" construction droid for scavengers