Instances
An Instance can be seen as a level inside your level. They are very useful if you need to build or script the same thing multiple things that work the same.times. A good example would be a door that can be opened by AI or a power box that can appear in random locations.
Instead of having to build and script it multiple times, you do it once and either spawn the instance multiple times or move it using InstancePoint Elements.
In gameplay, you won’t notice any difference between Instance and Units in your level,level.
Spawning
You can either use vanilla instances, or make your own custom ones, in both cases you can find them in the “Instance” tab in the Spawn Menu.
To create your own Instance, simply open your Map in the Project Manager, add a new module, select “Instance” and give it a unique name.
You can now open your new Instance like any regular level and edit it. While scripting your Instance, you can set up InstanceInput and InstanceOutput elements to send signals between the instance and your level. Keep the amount of elements below the Instance Index size, which is 250 by default. It can be increased if necessary, though it’s better to keep your instance size as small as possible.
After spawning the Instance in your level, you can send signals to it using the InstanceInputEvent Element in your level, and receive signals from the Instance with InstanceOutputEvent Element.
Instances can easily have randomized locations using the InstancePoint Element. Toggle the “Mission Placed” option in your Instance. Spawn and place the InstancePoint Element where you want the Instance to appear and link it with it. When executing the Element, the Instance will be spawned at the same location as the Element.