Player data and scripts, alliances/teams, and player interactions... |
Players and their alliances/teams are defined during game set-up. There are several ways which game set-up can be performed:
The Game Configuration is exposed to the JS API via a number of globals and functions. Those relating to players and are listed to the right.
In current Warzone releases, there can be up to 10 human/AI players, plus an optional Scavenger player, in a game.
Each player has a unique ID, and everything associated with that player (such as Droids, Structures and even Features) is linked to the player ID.
These players have IDs in the range: 0 → maxPlayers-1.
The player ID is determined by the order in which the player was added to the game, not their map position. Player 0 is always the human game host, even if that player has been moved to a different map position.
In Warzone 3.2 and above, you can determine if there are multiple human players using the isMultiplayer, and determine which players are human or AI by looking at their associated Player object in the global playerData[] array.
For more information, see Players.
The Scavenger Faction player is treated separately from all other players – they are not listed in playerData[], and their ID is ≥ maxPlayers:
Even when enabled, Scavenges might not appear on the map if the map designer didn't define any Scavenger factories or trucks. For more information, see Adding Scavengers to Maps.
Unlike other players, scavengers tend to have multiple bases – they generally treat factories as if they were HQs. This means that the Scavenger Faction doesn't have a defined map position: While they might only appear in one place on the map, they could just as easily have lots of little bases scattered anywhere on the map.
If you want to turn a human or AI player in to Scavengers, check out NoQ's Warzone Mini: Scavenger Wars mod which does just that!
Most map features (trees, log cabins, etc) are owned by player 99. However, special features, such as oil resources, oil drums and artifacts, are owned by player 12.
The special features can either be picked up (in the case of oil drums and artifacts) or built on (in the case of oil resources).
For more information on features, see the imaginatively titled "Features" section of the documentation.
All human, AI and scavenger players have at least one Javascript environment associated with them, in to which a relevant script is loaded.
Note: Unlike all other players, Feature players don't have an associated script. If you want to perform actions on features, the best place to do it is either in rules.js or an 'extra' script (as defined in ini files).
For more information, see Player Scripts.
The game settings allow human and AI players to be optionally formed in to alliances, with the applied setting defined in the alliancesType global.
These alliances, if enabled, can be either dynamic or fixed:
For more information, see Alliance.
Players can interact during the game in a number of ways:
For more information, see Interactions.
There's a number of user guides available for multiplayer: