Door creation

From Valve Developer Community
Jump to: navigation, search

Creating a brush-based door.


To create a brush-based door, create a gap in the wall as a doorspace. See dimensions for sizing. To make the gap, split the wall in half and place a small brush over the top of the doorspace. Make sure that there is floor underneath the doorspace, otherwise there will be a leak.

Door creation 1.png

Creating a brush for the door

To start making the door, fill the doorspace with a brush. The brush should be a different texture from the wall (wood wall textures are good).

Door creation 2.png

Turning the brush into the door

To turn the brush into a door, right click on it while it is selected in one of the 2D views. Then select 'Tie to Entity' and from the entity list select either func_door_rotating for normal doors or func_door for up/down sliding doors. If the door is to slide, select func_door and scroll down the options until you reach 'Move Direction (Pitch Yaw Roll)' and select either up or down from the small box next to the select options bar. For rotating doors, you'll probably want to adjust the rotation point either by moving the blue ball (in the 3d view) using the 2d view, or by adjusting the 'Origin'.

Once this is done, to open the door (in-game) walk into it. To make it into a 'use' door, double click on it in 3d view, select the 'flags' tab on the properties window. Select 'use opens' and de-select 'touch opens'.

Making a button for your door

Name your door something like door1. To make a button for the door, create a small brush (can be any shape you want), and tie it (via Tie to Entity) to func_button. Name your button as well (i.e. door1_button). Then, once you have selected 'Apply', select 'Outputs' and 'Add Output'. The output should be:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnPress door1 Open   0.00 No

Then press 'Apply' again, to make the button.
When you test the map, walk up to the button and press 'Use'. The door should then open.

Making double doors

To make two func_door's or func_door_rotating's open and close together, it is necessary to use a combination of Outputs and logic_relay's (See logic_relay for more info). First, make two doors through the process stated above and name them accordingly (ie. door1 and door2). Second, add two logic_relay's somewhere near the doors (the location is not important, but it helps for organizational reasons to keep them close) and name them as well (ie. door1_relay and door2_relay). Third, open the properties of the first door, go to the 'Outputs' tab, and add an output similar to the following:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnOpen door2 Open   0.00 No

Do this for the other door too, but change the Target Entity to door1. What these outputs do is open one door when another one is opened (whether that be done via Touch, Toggle, a button, etc.). At this point, you could save and compile to test the doors out if you wanted, but they would only be able to open each other, not close each other. That is where the logic_relay's come in.

Now normally, you would think that you could repeat the process for closing the doors via Outputs (ie. having one door be closed by the other), but such is not the case. If you try it out for yourself, you will find that the game crashes as soon as you go to close one of the doors. So, to work around this little bug, you need to introduce a logic_relay for each door. If you've followed the above process so far, you should already have the two relays placed and named. Now, open the properties of the first door and add an output similar to this:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnClose door1_relay Trigger   0.00 No

Again, repeat this for the other door, changing the Target Entity to door2_relay. Next, open the properties for the first relay and add an output like so:

  My Output Target Entity Target Input Parameter Delay Only Once
Io11.png OnTrigger door2 Close   0.00 No

Repeat this for the other relay, changing the Target Entity to door1. Now save and compile, and you should have a working set of double doors.

To help you understand this concept of Outputs and logic_relay's better, here is a little diagram for the above example:

Player opens door1 -->The opening of door1 triggers door2 to open via the Output of door1

Player opens door2 -->The opening of door2 triggers door1 to open via the Output of door2

Player closes door1 -->The closing of door1 triggers door1_relay -->The triggering of door1_relay triggers door2 to close

Player closes door2 -->The closing of door2 triggers door2_relay -->The triggering of door2_relay triggers door1 to close