Other great resources: Official JS API docs, Scripting Forum
Working with Construction
<stub page>
Methods of Construction
There are two primary methods of construction in the JS API:
- orderDroidBuild() – Make a construction droid build the structure, like a player would in the game
- addStructure() – Instanly place a structure on the map
This guide will look at both of these methods.
Before construction starts...
Before you start building or adding structures to the map, there are some checks to run through...
Is the structure available?
There are several functions that allow you to determine if a structure can be built:
- isStructureAvailable() – returns true if the structure is researched and within structure limits
- getStructureLimit() – get the structure limit for a given type of structure
Where can it be built?
Â
Droid-built structures
Â
Instantly-placed structures
Â