Other great resources: Official JS API docs, Scripting Forum
Structure object
- Aubergine
Properties
Property | Type | Description | Game version |
---|---|---|---|
type | Constant | STRUCTURE | 3.1 |
status | Constant | Describes construction status of the structure:
| 3.1 |
stattype | Constant | What sort of structure is it?
| 3.1 |
modules | Number, | The number of modules built on the structure, or Warzone 3.1 Beta 2 and earlier: The property would not exist for structures that couldn't have modules. | 3.1 beta 2 |
group | Number | The group that the structure is in, or null if it's not in a group. | 3.2 |
cost | Number | What did the structure cost to build? | 3.2 |
range | Number, Null | The maximum range of the structures' weapon, or It's not clear whether range will be present for sensors. | 3.2 |
isSensor | Boolean | Does this structure have a sensor on it?
| 3.2 |
isCB | Boolean | Does this structure have a counter battery (CB) turret on it?
| 3.2 |
isRadarDetector | Boolean | Does this structure have a radar detector on it?
| 3.2 |
canHitAir | Boolean | Can this structure attack aircraft (VTOLs / transports)?
| 3.2 |
canHitGround | Boolean | Can this structure attack ground units and other structures?
| 3.2 |
hasIndirect | Boolean | Does this structure have an indirect fire weapon (such as artillery or archangel missiles)?
| 3.2 |
weapons | Array of Weapon Status | An array containing basic information about the weapons attached to the droid. Each object in the array contains two properties:
| 3.2 |
Availability 3.1 B1+
Introduced in:
- Warzone 3.1 Beta 1 and above
- Several updates to Base objects since then
- Lots of new stuff planned for 3.2
Contents
Jump to:
Where to get them?
Lots of API features return structure objects, including...
Functions: enumArea(), enumRange(), enumStruct(), enumStructOffWorld(), label(), objFromId()
Events: eventAttacked(), eventAttackedUnthrottled(), eventDestroyed(), eventDroidBuilt(), eventObjectSeen(), eventObjectTransfer(), eventResearched(), eventStructureBuilt(), eventStructureReady()
Other: If specified when using queue() or setTimer(), the resultant function calls will be passed a structure object. If you bind() to a structure object, the function called when it is destroyed will be passed the structure object.
Working with Structures
Create them:
- isStructureAvailable() – find out if a structure of a given type can be built
- pickStructLocation() – find a place to build a structure
- DORDER_BUILD, DORDER_HELPBUILD, DORDER_LINEBUILD – order a construction droid to build a structure
- addStructure() – instantly add a structure to the map
Remove them:
- removeStruct(), removeObject() – instantly remove a structure from the map
- DORDER_DEMOLISH – tell a construction droid to demolish a structure
List them:
- enumStruct(), enumStructOffWorld(), enumArea(), enumRange() – get a list of structures
- objFromId() – get a structure object using it's ID
Tell them what to do:
- buildDroid() – tell a factory to build a droid
- pursueResearch() – tell a lab to research something
- activateStructure() – tell a structure to perform its special task (fire laser satellite...)
- setAssemblyPoint() – set rally point for factories and repair facilities
Find out what's happening to them:
- eventStructureBuilt() – when they are built
- eventStructureReady() – when they are ready to perform a special function
- structureIdle() – manually check if a structure is idle
- eventDroidBuilt() – when a factory finishes building a droid
- eventResearched() – when a lab completes its research task
- eventObjectSeen() – when a sensor detects something
- eventAttacked() – when they are attacked
- eventDestroyed() – when a structure is destroyed
- baseType – determines what map-placed structures are removed at start of game
- enableStructure() – enable a structure to be built
- setStructureLimits() – set limits on how many of each structure can be built