Other great resources: Official JS API docs, Scripting Forum
Droids
- Aubergine
What are droids?
Droids are player-owned movable units such as trucks, tanks, cyborgs and VTOLs.
What can I do with droids?
They are the most flexible objects in the game:
- Construction droids can build, demolish or repair structures
- Repair droids can repair other droids
- Sensor droids act as mobile sensor towers and can have units assigned to them
- Command droids delegate your orders to their assigned units and share their experience with those units
- Weapon droids can be used to attack structures, droids and features
- Transport droids can store other droids in their cargo hold and transport them around the map
In addition:
How do I get droids?
I most maps, you'll start with at least one construction droid (usually a truck) and/or a factory (where droids can be built), but not always.
You can get new droids in the following ways:
- Add them to the map instantly using addDroid() (which should only be done in campaign missions)
- Build them at a factory using buildDroid()
- Steal them from other players using Nexus Link turrets
- Get them via reinforcements in a campaign
Are they private to my script?
No. They can be seen by all other scripts, and can even be controlled by other scripts (although you shouldn't do that, obviously).
Are they persistent?
Yes. Droids and their properties are automatically stored in save games and persist the save/load cycle.
Availability 3.1 B1+
Requires:
- Warzone 3.1 Beta 1 or above
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:
- makeTemplate() – check various things before building a droid
- componentAvailable() – is a component (propulsion, body or turret) available?
- addDroid() – instantly add a droid to the map
- buildDroid() – produce a droid at a factory
- getDroidProduction() – find out what droid a factory is currently producing
- setDroidExperience() – set experience of a droid
Organise them:
List or count them:
- hackGetObj() – get a single droid
- enumDroid() – list droids on the map
- enumArea() – list droids in specific area
- enumRange() – list droids near a location
- enumGroup() – list droids in a group
- enumSelected() – list droids that are selected
- countDroid() – count droids
Tell them what to do:
- orderDroid() – give a basic order
- droidCanReach() – can the droid reach it's destination?
- propulsionCanReach() – can a specific propulsion travel between two points?
- orderDroidBuild() – build a structure
- orderDroidLoc() – move to a location the map
- orderDroidObj() – do something to another object (attack, repair, etc)
How to's:
- Working with Commanders
- Working with Factories
- Working with Repairs & Rearming
- Working with Sensors
- Working with Transports
- Working with Construction
- Working with VTOLs
Transfer them between players:
- donateObject() – donate a droid to an ally
- eventObjectTransfer() – a droid was transferred or assimilated
Find out what's happening to droids:
- eventDroidBuilt() – droid built or added
- eventDroidIdle() – current orders completed
- eventSelectionChange() – human (de)selects droids
- eventArea<Label>() – droid enters a labelled area
- eventObjectSeen() – droid appears on your sensors
- eventAttacked() – cluster was attacked
- eventAttackedUnthrottled() – same as above, but unthrottled
- eventPickup() – picked up an artifact or oil drum
- eventDestroyed(), bind() – destroyed or recycled
Remove them:
- removeObject() – instantly remove a droid
- DORDER_DESTRUCT – an alternate method
- DORDER_RECYCLE – recycle a droid
- enableTemplate() – allow construction trucks to be built before HQ
- enableComponent() – make a droid component available to research
- makeComponentAvailable() – make a droid component available
- setDesign() – enable or disable design mode
- setDroidLimit() – limit the number of droids a player can make
- getDroidLimit() – determine the limits set for droids
- setExperienceModifier() – change rate at which droids gain experience