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 2 Current »

Determine if a destroyed structure was demolished by trucks or engineers.

 

Code

// Determine if a STRUCTURE object is being demolished
function wasDemolished(structure) {
  return (!structure.status); // status == 0 if structure was demolished
}

Example

function eventDestroyed(victim) {
  if (victim.type == STRUCTURE && wasDemolished(victim)) {
    playSound("pcv340.ogg"); // demolished
  }
}

Availability

Requires:

  • Warzone 3.1 Beta 1 and above.

See also

Related articles:

  • eventDestroyed() – triggered when one of your game objects is destroyed
  • STRUCTURE – indicates game object type is a structure
  • .status – structure construction status

 

  • No labels