COUNTER-MAP:  Counter-Strike Mapping
Visit us on IRC at gamesnet.net, #countermap
Pic of the Week
Poll
Map Spotlight
Weekly Playtests
Random Map Idea
In the News
About Counter-Map
The Crew
Mapping Forums
Important Links

Submit

Tutorials

Mapster
Nemesis' Utilities
Map Packs
Texture Packs
Mapping Utilities
File Database
EditLife.net
 

 Back to Tutorials Page 

Doors
By Unarmed  Last changed Sep 10, 2006

 

This tutorial will guide you through the process of creating doors in a  Counter-Strike: Source map. There are two different doors that can be used, sliding and rotating doors, both will be explained here. Please note that this tutorial requires that you have some basic knowledge of Hammer.

 

You can download the completed VMF here

 


 

Getting Started.

 

Start "Hammer" from your SDK and if you have a map you wish to add doors to then load that. Otherwise make a simple map with two rooms that are connected and add a few spawns and a light or two. Make sure you have two connections from one room to the other since we are going to try two different doors. You should have something like this.

 

 - CLICK TO ENLARGE
(click to enlarge)

 


 

The Sliding Door

 

Choose a place in your map where you want your door. I chose the left opening in the screenshot above. Make a brush that fills that opening but make it slightly thinner than the actual wall and texture that as you wish. It should look something like this.

 - CLICK TO ENLARGE
(click to enlarge)

 

Now with your door selected we do exactly as when we created buyzones in our first map. We right click our brush and press the Tie To Entity. (Ctrl + T). Note that there is also a button on the right in Hammer labeled "To Entity" which does the exact same thing. You should now see a box with a dropdown list to your upper left. Select func_door from said list.

 

The observant will now notice that the window is still referring to this entity as a func_detail. This will be changed once we press "apply" or close the window.

As you can see there are quite a few keyvalues that can be set for a func_door. After you have finished this tutorial I strongly recommend you to play around with them and see what they do to your door. We are now going to take a look at the most important ones.

Down near the bottom you will find maybe the most important keyvalue of them all for a door. This is named "Move Direction (Pitch Yaw Roll)". This keyvalue specifies in which direction the door will move when opened. The distance a door moves is the size of the door itself, i.e. if a door moves up it moves the same distance as the door is high. The distance a door moves can be altered by the "Lip" keyvalue. Any number entered as a lip value will be reduced from the doors movement. If you want to make a door travel further then its own size enter a negative value.

Enough background, lets get started. Click "Move direction (Pitch Yaw Roll)" if you haven't done that already. As you can now see there are several helpers to get your doors moving right. At the top there is a little box that should have "0 0 0" written in it. These are the Pitch, Yaw and Roll values for your door, they tell it where to move! If you are like me and can never remember which one is which there are some helpers.

There is a little drop down menu in which "up" & "down" can be selected. There is also a little circle in which you can point the direction of the door. Note that this circle will only make your door move sideways never up/down. And last there is a little button labeled "point at" which if clicked will give you a little crosshair in the 3d view and then you can simply click in the direction you want your door to move.

Looking at my door I can see that it will look best if it moves upwards, so I simply select "up" from the dropdown list.

 


Having done that you will see that the Pitch Yaw and Roll values change.

I want my door to stop a few units before the ceiling so I also entered a value of "8" as a "Lip" keyvalue.

Now lets make our doors noisy as well. There are two keyvalues for this. Lets start with the first one, "Start Sound". This is simply the sound a door makes when it starts to move. Click that and then click "Browse" and select a sound of your liking. Note that you can filter for things like "door" to find your sound more easily. Also note that some sounds will not be played in Hammer. Changing the "Sound Type" to "Raw" instead of "Game Files" will give you only sounds that will play in Hammer also. I chose "doors/metal_move1.wav"

 

Now our door will make a noise when it starts to move. However this sound will only play until the sound is finished. I want it to loop until the door is fully opened. To get this effect i set the "Loop Moving Sound?" keyvalue to "yes". Now do the same thing again but this time set a StopSound for our door. For this I chose "doors/metal_stop1.wav". The stop sound can not be looped.

There are a few more values that need to be set on this door, the first one being "Speed". Speed is measured as Hammer units/second. Speed is set to "100" on doors. Since my walls are 128 units high the door will be open in just above one second. I want it to be slower so I set speed to "30"

There is also a value named "Delay Before Reset" which tells the door how long, in seconds, it should stay opened before closing again. I want my door to stay open so I set that value to -1.

That's all the keyvalues we need to set! However we do need to change a few more things. Click the "Flags" tab up near the top to move away from the "Class info" tab.

This tab contains all the flags that can be set for the door. If any of you clicked the "apply" button you should now see those flags. For those like me, who didn't, see only a blank window. Click the apply button in the lower right corner and the flags show up. Also note how the name of the window now changes to "func_door" instead of "func_detail".

 

Listed here are the flags you can set for your door. Most of them are very self-explaining. I don't want the player to open the door only by touch, I want them to press "use" to open it. Therefore I uncheck "Touch Opens" and check "Use Opens". Note that you can have both active at the same time, should you want to. We can leave the rest of the flags unchecked.

Woohoo! We now have a fully functioning door which makes noises and opens on use! Things could hardly be better, eh? Do compile your map now and make sure that you got everything right before we move on to the slightly more complex func_door_rotating. Should you ever want to access the settings for the door again all you need to do is select your door and press Alt + Enter to bring up it's properties. "Tie To Entity" is only used the very first time to transform your brush into a door.


 

The Rotating Door

Great. Now to fill the second hole between these rooms. Just like with the func_door, create a brush that fills the hole but is slightly thinner than the wall. Also give it a nice texture. Some of you might feel that since many door textures contain a black border it can be a bit hard to make your doors look nice. Don't worry about that now, this tutorial is for doors, not texture application.

Now, a rotating door always rotates around something but how can Hammer know what the door should rotate around? how is Hammer going to know where the "hinges" of this door is? The answer is toolsorigin. Open your materials browser and select the material "toolsorigin".

Now make a brush with all sides textured as toolsorigin where the center of this brush is exactly where you want the "hinge" of your door to be. This will mean that parts of your origin brush will be placed inside a wall or another object. This is fine as long as the origin brush stays inside your map. You should have something like this.

 - CLICK TO ENLARGE
(click to enlarge)

Now select both your door brush and your origin brush and tie them to an entity (Ctrl + T). From the box that appears select "func_door_rotating from the dropdown list.

As you can see the keyvalues for a func_door_rotating are very similar to the ones of a func_door. Of course the func_door_rotating has no "Move Direction" since it rotates around its origin brush, instead it has a keyvalue named "distance" which controls the distance the door rotates in degrees. This time I will not change any of the keyvalues, giving us a door that moves 90 degrees and then closes again after 4 seconds since that is what the values are set to. If you like, feel free to edit them as you wish to customize your door, just like we did last time.

The flags of a func_door_rotating are also similar to those of the the func_door. You will however notice two very interesting new flags named "X Axis" and "Y Axis". By default a func_door_rotating rotates around the Z (up/down) axis just like your doors normally do. However this is not necessary. Should you want to make a rotating door that rotates around another axis, simply select the axis you want. Looking at your map from the top view in hammer X is across, Y is up/down and Z is Up/down when looking at your map from any of the other 2 views.

I am however happy with the flags as they are now and I'll leave them alone as well, leaving us with a door that now opens on touch instead of on use. And just like that we now have a rotating door in our map as well. Compile and run!


Final Result

Well done! You now master both sliding and rotating doors in the source engine! If you have been playing around a bit or just kept your eyes open you might have noticed that all the help messages in Hammer regarding the doors have referred to a button and not a door. This is because a button and a door are two entities which are extremely similar and VALVe were lazy and just copied the help from the button to the door. This means that you should have no problems using your new skills to create not only doors but also buttons!

I hope this tutorial taught you something, should you have any comments or suggestions feel free to contact me at Unarmedmaps@gmail.com.

//Unarmed

 - CLICK TO ENLARGE
(click to enlarge)

 

 Back to Tutorials Page 

 
Get Hammer level editor, the most commonly used editor for CS and HL levels.
- - - - - - - - - - - -

Get Zoner's Half-Life Compile Tools, the premier compiling tools for CS maps.
- - - - - - - - - - - -

Get the "experts" Hammer configuration for CS mappers to utilize advanced custom CS entities.
- - - - - - - - - - - -

An improved CS:S entity definition file, to allow CS:S mappers to use all entities and options.
- - - - - - - - - - - -