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

startPositions[]

An array of player starting positions on the map.

 

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.

PropertyTypeDescriptionGame Version
xNumberThe x co-ordinate of the player's starting position3.1 Beta 1
yNumberThe y co-ordinate of the player's starting position3.1 Beta 1
typeConstantPOSITION3.1 Beta 11

Examples

What is my starting position?
// 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);
The array index is not the player ID, it is the position ID on the map.
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: