startPositions[]

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

Property

Type

Description

Game Version

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

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);