Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt

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

Availability

...

 

Code

Code Block
theme

...

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

Example

Code Block
theme

...

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

Availability

Requires:

  • Warzone 3.1 Beta 1 and above.
Div
classbox

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