Overview
Activates the special feature of a structure, such as firing laser satellite.Syntax
activateStructure(structure,target); activateStructure(structure,{x:xPos,y:yPos});
Parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
structure | Structure object | The structure that will perform the special action. | |
target | Game object {x:xPos, y:yPos} | The target location – this can be a game object, or any other object that has x,y properties. |
Return value
Value | Type | Description |
---|---|---|
true | Boolean | The structure was activated |
<error> | Error | Something 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
- structureIdle() – find out if a given structure is ready
- eventStructureReady() – an event that's triggered when a structure is ready for its next command