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.
Bunker disabling
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.
Triggers
- Player 1
- Player 2
- etc...
- Current player brings at least 1 [building] to [location: arena]
- Move 1 Terran SCV from [location: arena] to [location: SCV dump] for Current Player
- Center Location [location: Bunker Converter] on [building] at [location: arena]
- Create 3 [marines/firebats/ghosts] at [location: Bunker Converter] for Current Player
- Remove Unit at Location 1 [building] at [location: Bunker Converter] for Current Player
- Create 1 Terran Bunker at [location: Bunker Converter] for Current Player
- Run AI script Enter Closest Bunker at [location: Bunker Converter]
- You can use a 1000-millisecond wait trigger here but risk wait blocks. Instead, we have chosen to split the actions that would ordinarily follow the wait into a second trigger.
- Preserve trigger.
- Player 1
- Player 2
- etc...
- Current player brings at least 1 Terran Bunker to [location: Bunker Converter]
- Current player brings exactly 0 [marines/firebats/ghosts] to [location: Bunker Converter]
- Disable doodad state for Terran Bunker owned by Current Player at [Location: Bunker Converter]
- Move 1 Terran SCV from [location: SCV dump] to [location: arena]
- If you have used Wait, place these actions in the first trigger after the Wait, instead of in a second trigger.
- Preserve trigger.
Notes
- 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.
Bunker stacking
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.
Triggers
Copy the first trigger from the sections above. A second trigger must be used when stacking.
- Player 1
- Player 2
- etc...
- Current Player brings at least 1 [building] to [location: arena]
- Move 1 Terran SCV from [location: arena] to [location: SCV dump] for Current Player
- Center location [location: Bunker Converter] on [buildings] at [location: arena]
- Create 3 [marines/firebats/ghosts] at [location: Bunker Converter] for Current Player
- Remove 1 [building] at [location: Bunker Converter] for Current Player
- Create 1 Terran Bunker at [location: Bunker Converter] for Current Player
- Run AI script Enter Closest Bunker at [location: Bunker Converter]
- Preserve trigger.
- Player 1
- Player 2
- etc...
- Current player brings at least 1 Terran Bunker to [location: Bunker Converter]
- Current player brings exactly 0 [marines/firebats/ghosts] to [location: Bunker Converter]
- Disable doodad state for Terran Bunker owned by Current Player at [Location: Bunker Converter]
- Remove 1 [Stacked Building] at [Location: stacked building loc]
- Move 1 Terran Bunker at [location: Bunker Converter] to [location: stacked building loc]
- Move 1 Terran SCV at [location: SCV dump] to [location: arena]
- Preserve trigger.
And there you have it.
Notes
- 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. :)