'Shoot to open' door tutorial
by TheSchwartz (view all articles)

1 rating / 5 stars
Make a door open when shot
by TheSchwartz (view all articles)

1 rating / 5 stars

After making a topic on how to make a door open when you shoot at it, I promised to make a tutorial after I got a helpful hint from Nickelplate. Here it is, the hint was great enough to give me the answer.
To make the door I've made a small map of a two large rooms with a portal that connects them, I want to make a large metal gate that you can open by shooting it.
After this I make a brush for the door, I select a suitable metal texture in the texture browser and select the block tool to make the brush. Since the wall is 16 units thick I've made the brush 8 units thick and placed it so that it fits the portal. The portal with the brush outline is shown in top view in here:
To make this block into the door I select it and press the 'toEntity' button. In the appearing 'Object Properties' dialogue i select the class func_door and specitfy:
Move Direction: Up (this can be specified in a list box for that property)
Lip:2
Name:MainGate
I have also specified some door sounds but this is not mandatory.
Now comes the tricky part I place two brushes the same size of the door on both sides of the door. These must be very thin. The picture shows the door with the two buttons, I have hid the wall and portal:
Each of the 'nodraw brushes is made into a func_button with these properties:
Parent:MainGate (the name of the door)
Flags:Don't Move, Damage Activates, Touch Activates and Use Activates
I also specify an output to be sent for each button when they are 'pressed' using the Object Properties dialogue:
The parent property is very important, if not used the door will move up when used and the button brushes will stay where they are and the portal will be unpassable. However the Parent property make the buttons cling to the door and follow the movements of the door. This feature is pretty handy and can be used to ad buttons and other features to moving entities in HL2.
All that remains know is to test the map. Funny thing happened when I did that, I was online and was suddenly fragged by a player that had joined my test game, we had some short lived fun and if he/she reads this I hope I will get a comment, I can't remember the players name.
Download an example map, from the prefab examples category under 'shoot to open door'.
Hope that explains it for you all, any comments to improve the tutorial are welcome...
To make the door I've made a small map of a two large rooms with a portal that connects them, I want to make a large metal gate that you can open by shooting it.

After this I make a brush for the door, I select a suitable metal texture in the texture browser and select the block tool to make the brush. Since the wall is 16 units thick I've made the brush 8 units thick and placed it so that it fits the portal. The portal with the brush outline is shown in top view in here:

To make this block into the door I select it and press the 'toEntity' button. In the appearing 'Object Properties' dialogue i select the class func_door and specitfy:
Move Direction: Up (this can be specified in a list box for that property)
Lip:2
Name:MainGate

I have also specified some door sounds but this is not mandatory.
Now comes the tricky part I place two brushes the same size of the door on both sides of the door. These must be very thin. The picture shows the door with the two buttons, I have hid the wall and portal:

Each of the 'nodraw brushes is made into a func_button with these properties:
Parent:MainGate (the name of the door)
Flags:Don't Move, Damage Activates, Touch Activates and Use Activates
I also specify an output to be sent for each button when they are 'pressed' using the Object Properties dialogue:

The parent property is very important, if not used the door will move up when used and the button brushes will stay where they are and the portal will be unpassable. However the Parent property make the buttons cling to the door and follow the movements of the door. This feature is pretty handy and can be used to ad buttons and other features to moving entities in HL2.

All that remains know is to test the map. Funny thing happened when I did that, I was online and was suddenly fragged by a player that had joined my test game, we had some short lived fun and if he/she reads this I hope I will get a comment, I can't remember the players name.
Download an example map, from the prefab examples category under 'shoot to open door'.
Hope that explains it for you all, any comments to improve the tutorial are welcome...