Triggered when a game object is destroyed... |
function eventDestroyed(gameObject) { // do stuff } |
Parameter | Type | Mandatory | Description | Game version |
---|---|---|---|---|
gameObject | The droid, structure or feature that was just destroyed. See "Notes" section below for important information. | 3.1 Beta 1 Updated in Warzone 3.2 |
Warzone does not process the event handler's return value.
By the time the event is triggered, the gameObject will already have been removed from the map so you can't use it with any other JS API functions – it's for reference purposes only.
This event is unthrottled, it will be called whenever an object is destroyed – avoid complex or time consuming processing in your event handler.
In Warzone 3.1, the event is triggered when:
In Warzone 3.2 and above, the event is triggered when:
As such, it's vital to check which player the destroyed gameObject belongs to before deciding how to react, regardless of game version.
function eventDestroyed(gameObject) { switch (gameObject.type) { case DROID: { // do stuff when a droid is destroyed // gameObject.order == DORDER_RECYCLE indicates droid was destroyed due to recycling break; } case STRUCTURE: { // do stuff when a structure is destroyed // gameObject.status != BUILT indicates structure was demolished by truck break; } case FEATURE: { // a feature was destroyed, picked up or claimed } default: { debug("eventDestroyed: Unknown object type: "+gameObject.type); } } } |
AvailabilityRequires:
|
ContentsJump to: |
See alsoRelated articles:
|