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

Droid object

Droids are mobile game objects (items on the map), and have a huge number of properties and related API features...

 

Properties

Inherits all properties of a Game object (id, x, y, z, player, selected, name, health, armour, thermal, born, etc.) then adds/overrides the properties listed below.
PropertyTypeDescriptionGame version
typeConstantDROID3.1
orderConstant

The current order (task) that the droid is doing:

  • DORDER_ATTACKInstruct a droid to attack something.
  • DORDER_BUILDInstruct a construction droid to build a Structure object at a specific location.
  • DORDER_CIRCLEInstruct a VTOL to circle around a specific location.
  • DORDER_COMMANDERSUPPORTAssign an attacker droid to a commander droid so that it will attack whatever the commander droid targets.
  • DORDER_DEMOLISHInstruct a construction droid to demolish one of your structures.
  • DORDER_DESTRUCTInstruct a droid to self-destruct!
  • DORDER_DISEMBARK
  • DORDER_DROIDREPAIRInstruct a repair droid to repair a damaged Droid object.
  • DORDER_EMBARK
  • DORDER_FIRESUPPORTAssign a attacker droid to a sensor droid so that it can attack whatever the sensor droid targets.
  • DORDER_GUARDInstruct a droid to guard a structure.
  • DORDER_HELPBUILDInstruct a construction droid to help with an existing structure building site.
  • DORDER_HOLDInstruct the droid to hold its current position until instructed otherwise.
  • DORDER_LINEBUILDIndicates that a construction droid is building a line of structures (eg. a long wall).
  • DORDER_MOVEInstruct a droid to move to a new location.
  • DORDER_NONEIndicates that a droid is currently idle.
  • DORDER_OBSERVEInstruct a sensor droid to observe (target) a Droid object, Structure object, or even a Feature object.
  • DORDER_PATROLInstruct a droid to patrol between it's current location and a specified location, attacking any enemies it detects along the way.
  • DORDER_REARMInstruct a VTOL to return to a rearming pad for repairs and rearming.
  • DORDER_RECOVEROrder a droid to recover a collectible item such as an oil barrel or artefact (crate).
  • DORDER_RECYCLERecycle a droid...
  • DORDER_REPAIRInstruct a construction droid to repair a damaged Structure object.
  • DORDER_RETREATInstruct a droid to retreat to a pre-defined retreat point. Does not retreat to HQ! Read docs before using!
  • DORDER_RTBInstruct a droid to return to your base.
  • DORDER_RTRInstruct a land droid to go to a repair facility for repairs.
  • DORDER_RTR_SPECIFIEDInstruct a land droid to go to a specific repair facility for repairs.
  • DORDER_SCOUTInstruct a droid to "scout" to a new location.
  • DORDER_STOPInstruct a droid to stop what it's doing.
  • DORDER_TEMP_HOLDUse DORDER_HOLD instead of DORDER_TEMP_HOLD.
  • DORDER_UNUSEDAs it's name suggests, this constant is not used.

... Constants were added over time so check each constant's doc page for version info.

3.1 ...

actionConstant

This is the action that the droid is taking to carry out it's current order, as defined in action.cpp.

The constants are not currently exposed to JS API, however you can see a full list here: .action.

3.1
droidTypeConstant

Defines what sort of droid it is:

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

3.1
group

Number

Null

<not defined> 

Defines what group the droid is in, or returns null if the droid isn't in a group.

If the droid isn't in a group then the group property will return null.

Warzone 3.1 and earlier:

If the droid isn't in a group then the group property won't exist!

3.1

Improved in 3.2

experienceNumber

A number representing the droid's experience.

This number can optionally be set using the setDroidExperience() function.

3.1
armed

Number

Null 

Defines the weapon capability remaining, as a percentage, for VTOLs.

Warzone 3.2.0:

If the droid isn't a VTOL, the property returns null.

So, 100 = fully armed, 0 = no shots left (the VTOL needs to go to a reaming pad before it can make more attacks).

Warzone 3.1 and earlier:

  • If the droid isn't a VTOL this property won't exist!
  • The armed property for machinegun and cannon VTOLS was broken in 3.1 branch, but fixed in the 3.2 branch.

3.1→3.2.0

Improved in 3.2

Deprecated in 3.2

isVTOLBoolean

Tells you if the droid is a VTOL or not:

  • true – yes
  • false – no
You can also use the isVTOL() function to find out if a droid object is a VTOL.
3.2
costNumberThe amount of power it cost to create the droid.3.2
isRadarDetectorBoolean

Does the droid have a radar detector turret?

  • true – yes
  • false – no
3.2
range

Number

Null

The maximum range of the droids weapon, or null if not applicable.

(question) It's not clear whether range will be present for sensors.

3.2
isCBBoolean

Does the droid have a counter battery (CB) turret?

  • true – yes
  • false – no
3.2
isSensorBoolean

Does the droid have a sensor turret?

  • true – yes
  • false – no
3.2
canHitAirBoolean

Can the droid attack aircraft (VTOLS / transports)?

  • true – yes
  • false – no
3.2
canHitGroundBoolean

Can the droid attack stuff on the ground (tanks, structures, features, etc)?

  • true – yes
  • false – no
3.2
hasIndirectBoolean

Does this droid have indirect fire capability (eg. artillery)?

  • true – yes
  • false – no
3.2
bodyString

The ID of the body that the droid is using. Some of the more common bodies are listed below:

  • "Body1REC" – Viper
  • "Body5REC" – Cobra
  • "Body11ABT" – Python
  • "Body4ABT" – Bug
  • "Body8MBT" – Scorpion
  • "Body12SUP" – Mantis
  • "Body2SUP" – Leopard
  • "Body6SUPP" – Panther
  • "Body9REC" – Tiger
  • "Body3MBT" – Retaliation
  • "Body7ABT" – Retribution
  • "Body10MBT" – Vengeance
  • "Body13SUP" – Wyvern
  • "Body14SUP" – Dragon
  • "TransporterBody" – Cyborg Transport
  • "SuperTransportBody" – Super Transporter
For a full list, including cyborgs and scavenger bodies, see: body.ini
3.2
propulsionString

The ID of the propulsion that the droid is using.

For a list of propulsion types, see: propulsion.txt

3.2
cargoSizeNumber

The amount of cargoCapacity the droid will consume if loaded in to a transport.

In campaign mode:

  • 1 – for all droids, regardless of body size

In other game modes, the cargo size is based on bodySize:

  • 1 – LIGHT bodies
  • 2 – MEDIUM bodies
  • 3 – HEAVY bodies
3.2
cargoCapacity

Number

<not defied>

For transports only, this defines the total capacity of the cargo hold.

For non-transport droids, the property will be undefined, so you should either check the property exists or that the droid is a transport before attempting to read the value.

3.2
cargoSpace

Number

<not defined>

For transports only, the amount of cargo space remaining.

For non-transport droids, the property will be undefined, so you should either check the property exists or that the droid is a transport before attempting to read the value.

3.2
cargoCount

Number

<not defined>

For transports only, this defines the number of droids in the cargo hold.

For non-transport droids, the property will be undefined, so you should either check the property exists or that the droid is a transport before attempting to read the value.

3.2
bodySizeNumber

The size of the droid's body, which can be used to determine the number of factory modules required before you can build it:

  • LIGHT – All cyborgs, super-cyborgs, scavenger units, Viper, Bug, Leopard, Retaliation
  • MEDIUM – Cyborg transport, Cobra, Scorpion, Panther, Retribution
  • HEAVY – Super transporter, Python, Mantis, Tiger, Vengeance, Wyvern, Dragon

For more information, see: Working with Factories.

3.2
weapons[]Array of Weapon Status

An array containing basic information about the weapons attached to the droid. Each object in the array contains two properties:

  • .id – (not sure if this is implemented yet)
  • .name – the name of the weapon – use getWeaponInfo() if you want to get the associated Weapon Object.
  • .armed – the percentage (0 ≤ armed ≤ 100) of total shots remaining before the weapon needs to re-load or re-arm.
  • .lastFired – the gameTime at which the weapon was last fired
3.2
Tip:
There's an undocumented feature in the official Warzone Guide that lets you inspect stats for any droid configuration.
Availability 3.1 B1+

Droid objects were introduced in:

  • Warzone 3.1 Beta 1 and above
  • Several updates to Base objects since then
  • Lots of new features planned for 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: