Other great resources: Official JS API docs, Scripting Forum

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

This event is triggered when you get a new droid as a result of buildDroid() or addDroid()...

 

Syntax

function eventDroidBuilt(droid, structure) {
  // do stuff
}

Parameters

ParameterTypeMandatoryDescriptionGame version
droidDroid object(tick)An object representing the droid you just received.3.1 Beta 1
structure

Structure object

Undefined

(error)

If the droid was produced at a factory, for example you used buildDroid() function, this will be an object representing that factory.

If the droid wasn't built at a factory, for example if you used the addDroid() function, this parameter will be undefined.

3.1 Beta 2

Return value

Warzone does not process the event handlers' return value.

Example

Example event handler
function eventDroidBuilt(droid,structure) {
  // droid object will always be defined - you probably want to give it some orders
  if (structure) {
    // the droid was built at your factory, which is probably now idle
  }
}
It's also possible to gain droids by assimilation or transfer from another player - see eventObjectTransfer() for dealing with that scenario.
Availability 3.1 B1+

Requires:

  • Warzone 3.1 Beta 1 and above.
  • The 'structure' parameter was added in Warzone 3.1 Beta 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:

 

  • No labels