Difference between revisions of "Automatic Doors"

From Staredit Network Wiki
Jump to: navigation, search
(Created page with 'The Installation tileset's door doodads can be opened and closed with the Set Doodad State action. When a door is disabled it opens and becomes walkable. When a door is enabled i…')
 
m (1 revision imported: Restoring SC1 backup)
 
(No difference)

Latest revision as of 23:35, 20 March 2015

The Installation tileset's door doodads can be opened and closed with the Set Doodad State action. When a door is disabled it opens and becomes walkable. When a door is enabled it closes and become a barrier.


In many maps, doors will open when a ground unit comes near them, and close when the unit moves away. In fact, when ordering a units to the far side of a door, they will expect the door to open for them, and walk up to it, rather than trying to find a path around the door. Doors, however, will not open and close automatically; triggers must be created for this to occur.


The first step in creating an automatic door is to place the door and create a location over it. You may want to set the location to ground-only to prevent air units from opening the door.

Automaticdoors.png


If you place the door as a doodad, it will belong to Player 12, and you will need to reference Player 12 or All Players in your Set Doodad State action. If you place the door as a unit, take note of which player owns it or use All Players.


Simply disabling the door when a unit is near and enabling it when the unit leaves may not be good enough. This can cause the door to behave very strangely, particularly if you are using Hyper Triggers. To prevent this problem, we will use a switch for each door. The switch will keep track of whether the door is open or closed at any given moment, so we don't accidentally enable or disable it needlessly.


You 'open door' trigger should look something like this:

StarCraft Trigger [template]
Players:
  • All Players
Conditions:
  • 'Door 1' is Cleared.
  • All Players brings at least 1 [men] to 'Door 1'.
Actions:
  • Preserve trigger.
  • Set 'Door 1'.
  • Disable doodad state for Left Upper Level Door for All Players at 'Door 1'.


Then, the close door trigger:

StarCraft Trigger [template]
Players:
  • All Players
Conditions:
  • 'Door 1' is Set.
  • All Players brings exactly 0 [men] to 'Door 1'.
Actions:
  • Preserve trigger.
  • Clear 'Door 1'.
  • Enable doodad state for Left Upper Level Door for All Players at 'Door 1'.


Make sure to choose the correct type of door.


Using this method, your automatic doors will be nearly fool-proof. If a unit moves in and out of the door's location very rapidly it is possible for the door's animations to mess up. This problem can be prevented by giving the open and close triggers a cooldown time.