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 7 Next »

Overview

Activates the special feature of a structure, such as firing laser satellite.

Syntax

activateStructure(structure,target);
activateStructure(structure,{x:xPos,y:yPos});

Parameters

ParameterTypeMandatoryDescription
structureStructure object(tick)The structure that will perform the special action.
target

Game object

{x:xPos, y:yPos}

(tick)

The target location – this can be a game object,

or any other object that has x,y properties.

Return value

ValueTypeDescription
trueBooleanThe structure was activated
<error>ErrorSomething went wrong

Example

Toast the most recent droid/building that attacked me
var lastAttacker;
 
function eventAttacked(victim,attacker) {
  lastAttacker = attacker;
}
function eventStructureReady(structure) {
  if (structure.stattype == LASSAT) activateStructure(structure,lastAttacker);
}

See Also

 

  • No labels