
Buttons which open doors
Here we are going to make a simple door and a button to open it. Make sure
the texture lock is enabled:

1) Create a Block the same depth as the wall you want the door in and make its
Height and Width the size you want the door to be (You may want to spawn a
info_player_terrorist or info_player_counterterrorist to check its height and
width is correctly scaled).

2) Make sure the block you just created is selected and press the key
combination CTRL + SHIFT and C. This is the Carve Key combination (for those who
don't know, it makes a hole the shape the brush you are selecting into another
touching brush). Remember that that the Carve tool is usually inefficient, so only use it with simple shapes, no cylinders, etc.
3) Make sure your door is selected and press CTRL + T (The tie to entity key
combination) and type (into the place where it says func_detail) func_door. Then
change the settings to what I have here (or alternatively you could make it go
to other directions, go down to the "Other Movements" section):

and name the door Door1 (or anything, provided you remember it). Then go to
the flags tab and uncheck everything. Then click apply and close the window.
4) Using a button texture (or make your own, go to "Custom Buttons) create a
button and place it near your door (Use the info_player_terrorist or
info_player_counterterrorist you created earlier to make sure it is at proper
height).


Then tie the button to the entity func_button. Don't close the box yet.
Go to the tab "Output" and click the button add, then put this in the boxes:

Then go to the Flag Tab and check don't move. Click Apply and close the
window.
5)You're all set! Now compile the map in hammer (Although I recommend a Batch
Compiler, like Nem's Batch Compiler)by clicking F9 or by going to File -> Run
Map, but make sure to save first, because hammer could crash. Also make sure
that the "Don't run game after compiling is checked".
6) Go into CSS, HL2: DM, or whatever game you made it for and open the developer
console (If it doesn't work go to options -> keyboard -> advanced -> Enable
Developer's Console (~) and check it) and type "map [Your Map's name here]".
Lights that correspond with doors being opened or
closed
Here we are going to make a light witch turns green when the door is open
and red when the door is closed.
1) Make sure in the your door's property box (double click the door in 3D view
or right click it in other views and select properties) "Delay Before Reset" is
set to -1.
2) Create a small box on one of the walls. Make its depth about 16 units. Make
sure only the box is selected and Hollow it (CTRL + H) and set it to 2. Then
ungroup it (CTRL + U).
3) Delete the top brush.
4) Create an "light" entity and place it inside the brush you just made.
5) Open the light's property box and go to brightness, and use the pick colour
tool and select green (or the colour you want when it is open). After that name
it "light1". Open the flags tab and check "initially dark".
6) Select everything you've just made and hold SHIFT and drag it next to the
first box. There should now be 2 boxes. If there isn't, undo and try again.
7) Change the name of the new light entity to "light2" and the colour to red (or
the colour you want it to be when the door closes) in its property box.

8) Add these entries into the button's output tab.

9) Now you can try the map out in game!
Doors that open when a target is hit.
Here we are going to make a door that will open when a button is hit by a
projectile.
1) First, in an open space, create a bar like thing to stop the player and above
it create a brush with a "player clip" texture on it. The Player Clip texture
stops players from passing, but does not stop anything else, like bullets or
weapons.
2) Leave a space between the wall, player clip and the bar and put a door there.

3.1) If you want the door to break, tie it to "func_breakable" and make sure
its "Health" field is set to 0. Name it "Door2".
3.2) If you want it to open normally, make it the same settings as the first
door made in this tutorial. Name it "Door2".
4) Now, put a target somewhere visible from the bar and make it a button. In the
flags tab, uncheck "Touch Activates" and check "Damage Activates".

5.1) If you are using a breakable door, add this entry.

5.2) If you are using a normal door add the same entry as the first button
but change "OnPressed" to "OnDamaged".
6) Now you can test it out in game! |