Bunker Disabling and Stacking
Terran Bunkers can be a useful tool in StarCraft mapping. In defense maps, the structures can be used as a stationary "tower" that can host different infantry units. With clever triggering, Bunkers can be cloaked and stacked.
This tutorial explains how one can use these bunkers.
In some StarCraft UMS maps, like Tower Defense, certain Terran buildings are automatically replaced with invisible Terran Bunkers when constructed. Typically, the replaced building determines what units (Marines, Firebats, or Ghosts) are loaded into the Bunker; the buildings are priced accordingly. Triggers detect the completion of the building using the Bring condition; they then remove the building, and replace it with a Bunker and the corresponding units. These units are loaded into the Bunker using an AI script, and then the Bunker is disabled.
- Moving the SCV away from the Bunker prevents it from entering the Bunker and being permanently lost.
- Although the Bunker can carry up to four infantry units, it is best to use only three, as four units may have pathfinding issues trying to enter the Bunker.
- Remember to have a building in place before creating the infantry on that location. Otherwise, the infantry will be in the way when the Bunker is created. (The pre-existing building displaces the infantry when they are created).
- If you decide to split the trigger into two, as shown above, the [Location: Bunker Converter] must be at least 4x3 in size (i.e. the size of a bunker) in order for it to correctly detect whether infantry is still there. It is recommended to use a location size that is a tad bigger, in case of unit placement issues.
- You also need hyper triggers to make the transition between buildings smooth.
The same logic applies here. Units are created and moved into a Bunker, and then the Bunker's doodad state is disabled. This time, however, the Bunker is moved using triggers. This makes the area walkable and buildable, but it also allows the units in the Bunker to shoot from the Bunker's original position. (This is because the units themselves were effectively positioned at the center of the Bunker; they were not moved with the Bunker because the Bunker was disabled when it was moved.) This can be seen in maps such as Path Defense and Clock Defense.
In order to stack the Bunkers, you must pre-place a pile of perfectly stacked buildings using a third-party map editor. When a player plays the map and a Bunker is created, a building from the pile is removed. This marks the entire pile as being buildable, making it possible to stack the newly-created Bunker on top of it. The act of moving the Bunker marks the pile as being "occupied", while making the Bunker's original location buildable again. This system gives the illusion that players can stack the invisible Bunkers; the system will function until all of the pre-placed buildings have been removed.
Copy the first trigger from the sections above. A second trigger must be used when stacking.
And there you have it.
- You can only stack as many Bunkers as there are stacked buildings. If, for example, you only pre-placed ten stacked buildings, then this system would only stack ten Bunkers. When the player attempts to build an eleventh Bunker, it would become invisible, but it would not be moved.
- It is important to note that StarCraft has a maximum number of units that can be attacking at the same time. This means that if you have fifty Bunkers stacked in the same location, with each containing three Marines (for a total of 150 Marines), then they would all end up attacking at the same time. This can cause unit freeze, which can be seen more commonly in Terran Valkyries and Zerg Devourers due to their attack animations. To avoid this, you can limit the amount of Bunkers a player can create by removing newly-built initial buildings if the Current Player has no more stacked buildings at their [Stacked building loc]. (This also allows the system to degrade gracefully when no more buildings can be stacked.)
- You need Hyper Trigger to make the transition between buildings smooth.
All credit goes to UnholyUrine for writing this tutorial. :)