Other great resources: Official JS API docs, Scripting Forum
startPositions[]
- Aubergine
Â
Overview
When you start a game, you see starting positions shown on the map preview – 'startPositons' is an array of Position objects defining the co-ordinates of those starting positions.
The array indexes are position numbers, not player IDs. So startPositions[0]
returns a position object for starting position 0.
To work out what position a particular player is in, use:
startPositions[playerData[playerID].position]
You can use start positions to get an idea of where player bases are on the map. Note, however, that players (especially humans) might choose to build their base (or some of it) somewhere else on the map.
Properties
Each (numerically referenced) element in the array contains an object that defines the x,y of a starting position on the map.
Property | Type | Description | Game Version |
---|---|---|---|
x | Number | The x co-ordinate of the player's starting position | 3.1 Beta 1 |
y | Number | The y co-ordinate of the player's starting position | 3.1 Beta 1 |
type | Constant | POSITION | 3.1 Beta 11 |
Examples
// work out what position I started in var myStartPosition = playerData[me].position; // now get the map coords of that position var myStartXY = startPositions[myStartPosition]; Â // trace to console console("Position "+myStartPosition+" at (x,y): "+myStartXY.x+","+myStartXY.y);
Availability 3.1 B1+
Requires:
- Warzone 3.1 Beta 1 and above
- The return value was updated in Warzone 3.1 beta 11
Contents
Jump to:
See also
Related articles:
- playerData[] – contains data about each player, including their start positions
- derrickPositions[] – specifies positions of oil resources
Â