Open/Close Door Triggers in Installation Terrain -- Issue

Post Reply
User avatar
SaintKerrigan
Terran Nuclear Silo Safety Inspector
Terran Nuclear Silo Safety Inspector
Posts: 231
Joined: Tue Jan 29, 2008 2:08 pm
Location: Char

Open/Close Door Triggers in Installation Terrain -- Issue

Post by SaintKerrigan »

The way I currently have my door triggers set up, they open and close, but it's doubled (so when I enter the trigger, the door opens once, but as soon as I leave the door runs the open animation again, and then closes twice). I'm wondering if anyone could provide me with a proper method of making the door triggers. Thanks!
Tremble before my wrath!
User avatar
Thalraxal
Protoss Stargate Concierge
Protoss Stargate Concierge
Posts: 1212
Joined: Sun Aug 12, 2007 12:42 pm
Location: Ontario, Canada

Re: Open/Close Door Triggers in Installation Terrain -- Issue

Post by Thalraxal »

How many players are setting off the close trigger?  Try placing it under the Human player only (as opposed to All Players or a Force with multiple players), and that should clear things up.
User avatar
SaintKerrigan
Terran Nuclear Silo Safety Inspector
Terran Nuclear Silo Safety Inspector
Posts: 231
Joined: Tue Jan 29, 2008 2:08 pm
Location: Char

Re: Open/Close Door Triggers in Installation Terrain -- Issue

Post by SaintKerrigan »

The only problem with that is I want a computer player to be able to open the doors as well (the player character is following a computer character through the corridors of a battlecruiser).
Tremble before my wrath!
User avatar
Thalraxal
Protoss Stargate Concierge
Protoss Stargate Concierge
Posts: 1212
Joined: Sun Aug 12, 2007 12:42 pm
Location: Ontario, Canada

Re: Open/Close Door Triggers in Installation Terrain -- Issue

Post by Thalraxal »

Hm, tricky.  Try throwing a switch in there.  Like so:

On Open:
Conditions:
Switch 'Door Switch' is set
'Player(s) X' bring 'at least 1' 'men' to 'Door Location'

Actions:
Clear 'Door Switch'
'Disable Doodad State' for 'Whatevertypeofdoorthisis' at 'Door Location'
Preserve Trigger

To Close:
Conditions:
Switch 'Door Switch' is Cleared
'Player(s) X' bring 'at most 0' 'men' to 'Door Location'

Actions:
Set 'Door Switch'
'Enable Doodad State' for 'Whatevertypeofdoorthisis' at 'Door Location'
Preserve trigger
User avatar
AngelSpirit
Terran Goliath Dome Polisher
Terran Goliath Dome Polisher
Posts: 122
Joined: Tue Jun 23, 2009 7:18 am
Contact:

Re: Open/Close Door Triggers in Installation Terrain -- Issue

Post by AngelSpirit »

NOTE: Article taken from Maplantis.  By: [Author unknown]


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.

[imgwh 350x250]http://i25.tinypic.com/fogox2.png[/imgwh]

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:
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:
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.
Lavarinth wrote: You top the charts. Congratulations, to the OFFICIAL FORUM IDIOT, 1N73RC3P70R.
Shameless plug: Dwarf Fortress!
User avatar
SaintKerrigan
Terran Nuclear Silo Safety Inspector
Terran Nuclear Silo Safety Inspector
Posts: 231
Joined: Tue Jan 29, 2008 2:08 pm
Location: Char

Re: Open/Close Door Triggers in Installation Terrain -- Issue

Post by SaintKerrigan »

Thanks, guys. Problem's been solved.
Tremble before my wrath!
Post Reply