(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

ParameterTypeMandatoryNotesAvailability
playerNumber(tick)The ID of the player who will own the droid.3.1 B1+
xNumber(tick)The x co-ordinate (tile) where the droid should be added.3.1 B1+
yNumber(tick)The y co-ordinate (tile) where the droid should be added.3.1 B1+
nameString(tick)The name of the droid.3.1 B1+
bodyString(tick)The body component.3.1 B1+
propulsionString(tick)The propulsion component.3.1 B1+
reservedNull(tick)Not currently used, specify null.3.1 B1+
droidType

Constant

Null

(tick) 3.1

(error) 3.2+

On Warzone 3.1 branch, a droidType must be specified:

  • DROID_ANYUsed to bypass droid type filtering in functions that list or count droids.
  • DROID_COMMANDA commander unit, to which other units can be assigned.
  • DROID_CONSTRUCTA construction truck or a cyborg engineer.
  • DROID_CYBORGA cyborg warrior capable of attacking the enemy.
  • DROID_ECMA droid that has an Electronic Counter Measures (radar jammer) turret.
  • DROID_PERSONA droid that uses "legs" propulsion, for example a civilian or a scavenger machinegunner.
  • DROID_REPAIRA droid that has a repair turret, capable of repairing other droids.
  • DROID_SENSOR
  • DROID_SUPERTRANSPORTERA heavy transport unit, capable of airlifting any type of droid (including VTOLs) to some other location on the map...
  • DROID_TRANSPORTERA cyborg transporter (or possibly a super transporter in Warzone 3.1 Beta 4 and earlier), capable of airlifting droids to some other location on the map.
  • DROID_WEAPONA droid capable of attacking other droids.

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.

t1String(tick)The first turret to attach to the droid.3.1 B1+
t2String(error)The second, optional, turret to attach to the droid.3.1 B1+
t3String(error)The third, optional, turret to attach to the droid.3.1 B1+

Return values

ValueTypeNotesAvailability
<droid>Droid objectOn Warzone 3.2 and above, if the droid is created its associated droid object will be returned.3.2+
nullNullIn Warzone 3.2 and above, if the droid is not created, null is returned.3.2+
trueBooleanIn Warzone 3.1 branch, true is returned if the droid was created.3.1 BRANCH
falseBooleanIn Warzone 3.1 branch, false is returned if the droid was created.3.1 BRANCH
<error>ErrorMost 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?

This function is broken in Warzone 3.1.0 and earlier releases.
Availability 3.2+

Requires:

  • Warzone 3.1 Beta 1
  • Improved and bug-fixed in Warzone 3.2
Contents

Jump to:

Scripting: Droids

Related objects:

Constants:

  • .action – what action is the droid doing?
  • .droidType – what category of droid is it?
  • .order – what is the droids order?

Create them:

Organise them:

List or count them:

Tell them what to do:

How to's:

Transfer them between players:

Find out what's happening to droids:

Remove them:

Player Initialisation: