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

Overview

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

Availability

This function was added in Warzone 3.1 Beta 2.

Syntax

var returnValue = activateStructure(structure,target,ability);
 
// or this might sometimes work...
var returnValue = activateStructure(structure,{x:xPos,y:yPos},ability);

Parameters

ParameterTypeMandatoryDescriptionGame version
structureStructure object(tick)The structure that will perform the special action.3.1 beta 2
target

Game object

{x:xPos, y:yPos}

(question)

The target location – usually a game object, but some structures might accept any object with x,y properties.

The following structure types require a target:

  • LASSAT – Laser Satellite Command Post
3.1 beta 2
ability(question)(error)(question) (not yet documented)3.2

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