addDroid()

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

addDroid()

Instantly place a droid on the map...

 

Syntax

// Warzone 3.1 syntax addDroid(player, x, y, name, body, propulsion, reserved, droidType, t1[, t2[, t3]]);   // Warzone 3.2 syntax -- droidType no longer required addDroid(player, x, y, name, body, propulsion, reserved, null, t1[, t2[, t3]]);

Parameters

Parameter

Type

Mandatory

Notes

Availability

Parameter

Type

Mandatory

Notes

Availability

player

Number

The ID of the player who will own the droid.

3.1 b1+

x

Number

The x co-ordinate (tile) where the droid should be added.

3.1 b1+

y

Number

The y co-ordinate (tile) where the droid should be added.

3.1 b1+

name

String

The name of the droid.

3.1 b1+

body

String

The body component.

3.1 b1+

propulsion

String

The propulsion component.

3.1 b1+

reserved

Null

Not currently used, specify null.

3.1 b1+

droidType

Constant

Null

3.1

3.2+

On Warzone 3.1 branch, a droidType must be specified:

Note: DROID_ANY is not a valid value.

On Warzone 3.2 and above, the droidType is no longer required as Warzone will work it out automatically.

3.1 branch

Not required in 3.2.

t1

String

The first turret to attach to the droid.

3.1 b1+

t2

String

The second, optional, turret to attach to the droid.

3.1 b1+

t3

String

The third, optional, turret to attach to the droid.

3.1 b1+

Return values

Value

Type

Notes

Availability

Value

Type

Notes

Availability

<droid>

Droid object

On Warzone 3.2 and above, if the droid is created its associated droid object will be returned.

3.2+

null

Null

In Warzone 3.2 and above, if the droid is not created, null is returned.

3.2+

true

Boolean

In Warzone 3.1 branch, true is returned if the droid was created.

3.1 branch

false

Boolean

In Warzone 3.1 branch, false is returned if the droid was created.

3.1 branch

<error>

Error

Most likely invalid parameters.

3.1 b1+

Notes

If this function is used in a multiplayer game, a desync will occur.

If you're making cyborg engineers or mechanics on Warzone 3.1, there is a bug with the droidType parameter – see notes in buildDroid() for more information and how to work around it.

Unlike buildDroid(), this function places the droid on the map instantly at no cost to the player. In addition, there are no checks on which turrets are specified – so, for example, you can put non-VTOL turrets on VTOLs (pic from NoQ):

Examples

Anyone want to post an example?