Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /var/sites/a/ on line 20
Wavelength | Your Game Editing Resource | Tutorial 4
Welcome, Guest! Login | Register

Tutorial 4 [Print this Article]
Posted by: Hellbringer
Date posted: Apr 07 2003
User Rating: 5 out of 5.0
Number of views: 8058
Number of comments: 2
Description: Door Antics...

(*Note:  This tutorial assumes you have both Half-Life AND
Worldcraft v2.0
.  This tutorial is designed for those of
you who are new to Level editing and CSG (Constructive Solid Geometry)
or Brush-type maps. 

tutorial covers:

  • Brush

  • Door Entities

  • Lifts

  • Entity
    Key/Value pairs

Welcome to Tutorial #4 - This tutorial will be covering a few topics,
as listed in the title. I'm going to keep the intro short (again); but as always,
feel free to email me (link at the bottom of the page) with any questions or
comments. Don't be shy if something confuses you or raises any questions you
want answered right away. Blue statements
are the functions I want you to perform.

I AM going to assume that by now you've mastered how to perform the functions
we did in tutorials 2 and 3.

  You came
here for this tutorial, though -so without further ado, why don't you load
up Worldcraft now
.  All tutorials are going to assume you have
the latest version, and use the default setup with a 2-button mouse - you should
also have all of the proper directories and tools configured before using this
tutorial.  Refer to the documentation and the setup guide.  I will
be covering the individual commands each time we execute a new command for the
first time.  

Once Worldcraft has been loaded, go up to the "File"
menu item and click on "open"
the file from our last tutorial
, and be sure the textures load up
properly!   In Half-Life, all textures are stored OUTSIDE of the map in
.WAD files. These must be loaded by the map-editor so that you can apply them
to various brushes. Without textures, your shapes and levels would be done in
single colors; and who wants that?? Also, I personally like to have all of the
menus and status bars turned on (you can select which ones are displayed from
the "View | Screen Elements" menu). You may not want this if you have
a small screen or are running at lower than 800x600 resolution; but at least
note this: ALL Worldcraft menus and toolbars are DOCKABLE.

I have mine arranged like this
(Note: this screenshot was from v1.6; but
I still suggest something similar to this setup) - it gives me a large main
workspace for my maps, and an organized area for referring to textures, VISgroups,
and some entity controls. Feel free to experiment around and find what's comfortable
for you - as it is important that you have an arrangement that allows you to
work freely and without frustration. 

first on the list
is some fun with DOORS. The func_door entities are some
of THE most versatile entities in most Quake-engine games. Today I'm going to
show you how to make doors that have to be "used" to be opened, triggered
open (in 2 different ways), and doors that rotate.

  The simplest
to show is a door that needs to be "used" to be opened.
Before we do ANYthing, though, let's go ahead and Save
our map AS "tutor4"
. That way our changes won't accidentally
get saved into the "tutor3" map file. In whatever view you find easiest,
select our door entity. Now, hit
or "Edit | Properties" to bring up
the entity properties dialog box. Click on the "Flags"
  Flags work like Keys, only they don't take a value - they're
just "on" or "off".  Place
a checkmark in the Flag that says "Use only".  Now close this
dialog box, compile, and run the map
. Notice that you have to walk
up to the door and hit the "use" button to make it open? In every
other respect, it functions just the same as a normal door.

  Now that
we've learned
how to make a door require one kind of action, let's move
on to ANOTHER trigger type... This kind is known as a "walk-over"
or "walk through" trigger. This gets a bit more complex; as we have
to add some things to our map. First, zoom in once
on each 2d view, then switch to block-creation mode
and set
your grid to 16 unit-spacing
. Make a block
32 x 32 units starting in coordinates (80, -80) in the XY view
. Adjust
it in the XZ or YZ views so that it rests on the floor and is 32 units tall
This new block should neatly fit into the corner of
our room
. Once you've adjusted it to the proper dimensions, go ahead
and hit ENTER to complete the brush-creation.
Now, select our new "trigger" brush with
the selection tool
. Once we turn it into a trigger, it won't show
up in the game - but it WILL show in our level editor... so let's make its texture
something that reminds us of its purpose. In the texture
box, hit the "browse" button
. Now, in the filter
window type "trigger"
; then double-click
on any of the "trigger" textures
that it displays.

how things should look just before you double-click...

apply this
texture to our "trigger" brush by hitting the Apply
texture tool user posted image
. Lastly, let's make this an actual trigger. Hit
the "to entity" button in the objects box
.  If the
entity properties window doesn't pop up, select our trigger brush and hit "ALT-ENTER". 
You must change the entity class to "trigger_multiple".
Trigger_multiple is a trigger type that can be re-activated over and over. We
need a way to associate this trigger with our door. Luckily, there are handy
"name" and "target" key/value pairs. So scroll until you
see them, and in the "target" field (you
will need to click on it) enter "door1" (without the quotes)
This will be our target for this trigger. We're done for now, so go ahead and
close the entity properties box. We need
to name our door, so use the selection tool to higlight
our door. Press ALT-ENTER and fill in the "Name" key with "door1"

It is now associated with the trigger. With the selection
tool, grab our trigger brush once more
. We put in one - but what
about when the player gets on the other side of the door?? They need one on
THAT side to come back through!! So go ahead and press
"CTRL+C" to copy this brush
. Also, press
"CTRL+E" to center the views on it
- this will make it
easier when we paste it back in. In the XY view, scroll left (west) until the
central part of the view is within the 2nd (western) room. . Go ahead and press
"CTRL+V" to paste in this brush
. (NOTE: I'm telling
you all these keyboard shortcuts deliberately... Using them saves a LOT of time
over the course of making an entire "real" map.)
necessary, grab inside the brush and move it in the XY and/or XZ / YZ views
so that it is completely within our second room.

my positioning of our two triggers...

  Go ahead
and compile and run this map. See how you
have to run over the (now invisible) triggers to open the door? Also, did you
notice that you can still "use" the door?? We never changed that attribute
- so it remains... triggers don't PREVENT the door from opening any other way,
EXCEPT for walking up to it (i.e. walking up to it and NOT touching any trigger).

make it
easier to find out how to trigger this door for the player, shall
we?? Let's make our triggers Push-buttons that the player can press. First,
go over to the trigger in the 2nd (western) room. Select
it, and re-size it in the YZ or XZ view to be 16 units tall
. Now,
hit the browse button on the texture box.
In the filter window, type "button".
Go ahead and pick any one of the first 5 or 6 by double-clicking
it (NOTE: I deliberately do this because our button is 32 units on a side,
and I want a texture that evenly fits on it)
. Don't forget to hit
the texture application button again [IMG]"
ALIGN="Top" WIDTH="16" HEIGHT="18">
!! Now, hit
to bring up the Entity properties dialog box.
We must change the entity class from "trigger_multiple"
to "func_button"
. Notice how the target attribute is preserved,
however (if you click on "target", you should
still see "door1" listed
). For buttons, we must once again
change the "angle" attribute so that it looks right. By default, the
angle is 0, and this would make our button slide to the east if it was triggered.
We need to change it so that when this button is pressed it moves DOWN (notice
the button is on the floor - I want the effect of the button receeding into
it). So click the drop-down arrow on the "Angle"
field and select "Down"
.  Also, to keep the button
from dissappearing INTO the floor, find the "lip"
key and enter a value of "4"
.  You can go ahead and
close the entity properties box now.

our floor-button with all its attributes filled in as they should be (before
closing the entity properties box)...

lets change
our other trigger into a button. Select
it and hit the texture application button
(our Button texture should
still be displayed in the texture box). Let's make this button a wall-mounted
one, eh?? Go ahead and move it over so that (in the
XY view) the upper left corner of the trigger brush is at coordinates (-112,
. Now, resize the brush so that its right
edge (in the XY view still) is on coordinate (-96)
- this should
make the trigger brush 16 units wide on the X axis in the XY view. This thing
is starting to look like a button; however, its still sitting on the floor.
Let's go to the XZ or YZ view and move it UP by 32
(remember that the player is approximately 64 units tall, so
this will put the button closer to chest-level).

our trigger in position to be a wall-button...

  Now its
time once again to hit "ALT+Enter"
to edit the entity properties. Once again, change this
entity to a "func_button", add the "lip" value of "4",
give the "target" key the "door1" value, and adjust the
. What's that you say? You don't know what angle to put in??
Well, here's a hint: Look at the XY view and assume we want the button to move
"into" the wall its up against. This is to the WEST in the XY view.
So, click in the Angle compass-dial in the westerly direction (the left-hand
side). What number did you get close to?? If you said "180", you're
correct. NOTE: the Angle line might not always line up perfectly; so ALWAYS
go with the numbers
. If you didn't get 180
on the nose, enter it in the Angle text-field
. The compass will move
to reflect this. 180 is DUE WEST (straight left in the XY view). All set?? Great,
then close the entity dialog and test out your level
by compiling and running it
!  By the way, you may notice that
the textures for the buttons aren't aligned.  I'm leaving this up to you
if you want, refer back to turorial #3 if necessary to check how to align textures...

so our buttons
aren't really pretty - but I'll leave it up to YOU to do
the texture manipulation at a later time to clean it all up.

Throughout the rotating doors section, I will NOT be specifying any sounds for
the doors. You can go back and add them later; but for now please just follow
the tutorial. Thanks!

  Now that
we've done
all kinds of moving doors and triggered doors, let's get fancy
- let's have our door ROTATE. In Quake 1, making an object rotate was a VERY
painful process - but luckily that's been solved for future games. The key to
rotation in Half-Life is the ability to evnision a rotation POINT (like a hinge).
You then insert what's called an "origin" brush along that hinge,
set a few attributes, and voila! Care to try a few?? Great!

we're going
to need to select our existing door
and hit the "to world" button
in the objects box. Then
deselect the door. This is because we'll
need to re-define our rotating door to include the origin brush we're about
to create. Hit the "browse" button in the
texture box and type "origin" in the filter field. Then, double-click
on any of the "origin" textures that appear
. Switch
grid spacing to 8 units; and select the zoom tool. Zoom in a bit on the door
in your 2d views. Then choose the brush creation tool
. The origin
brush's CENTER point is what will be used as the rotation point for our door
- so we need to make sure that the center-point falls on a part of our door
that makes sense. For example, create a brush that
is 16 x 16 units in the XY view, starting at coordinates (-192, 8) and ending
at coordinates (-176, -8)
. Then stretch
this brush in the XZ or YZ view so that its top and bottom line up with the
top and bottom of our door-brush
. Press
"Enter" to confirm the new brush

our origin brush (I selected it so it would stand out more)...

  You may
see in the 3d view (depending on where its positioned) some of the origin brush.
That's okay - origin brushes are invisible in the actual game. Go ahead and
select both the door-brush and the origin-brush
(select one, then select the other while holding "CTRL"). Click
that magic "to entity" button
(or use "CTRL+T"),
and when the dialog box comes up, choose "func_door_rotating"
as the entity class
. Set the "name"
field to "door1" (without the quotes of course)
, and let's
look at something new: find the "Distance (deg)"
. This replaces the "angle" attribute with rotating
objects. It determines how far (in degrees) the object will rotate.  Positive
numbers ALWAYS rotate AWAY from the player; and negative numbers mean the object
will rotate TOWARDS the player (no matter which side they stand on). For
now, "90" is perfect.  Lastly, find the "delay before close"
key and put "2" in this field
(a value of "4"
doesn't seem to work properly once the level compiles).

our new rotating door!

  Go ahead
and close the entity dialog box. Now, compile and
run your map once more
. Notice something??? The door rotates around
its mid-point along one edge - so that when it rotates all the way, it goes
"into" the wall some!!
This is NOT good for a realistic
door effect!  The way to fix this is to build a door-frame out of brushes,
and re-size the door so that when it rotates, it doesn't stick "into"
the wall, but butts up against it instead.  I don't have the time right
now unfortunately to show this effect, but you can see it in many of Half-Life's
levels where there is a swinging door.

you might
be asking yourself - THAT seems kinda limited; you mean I can
only have a door rotate clockwise or counter-clockwise on the Z-axis?? (Remember
that our hinge point was running up and down, i.e. In the Z-axis) My reply to
this is: Not at all!!   We do have to change the origin brush
some, but you can rotate on any axis you like, provided you set the right flags.
Flags are like entity attributes; except they work as checkboxes... either they
are "on" or "off" (you don't assign various values to them)...
you can access them from the entity properties dialog box by hitting the "flags"
tab near the top of the box. Let's start by changing our origin brush, though-

our door and once again hit the "to world" button
. Then
select and delete our origin brush. With
the brush creation tool, create a new brush in the
XY view starting at coordinates (-192, 0). Drag over and down to coordinates
(-176, -64). Then, in the XZ or YZ views, resize this brush to be 16 units high.
Lastly, move the brush in the XZ or YZ views so that it sticks up above our
door-brush by 8 units (so the center of the brush will be on the top corner
of the door).  Press "enter" to create the brush

our NEW origin brush.

Once again select
both the door and the origin brush
(this getting familiar by now??
*chuckle*), and go for that "to entity" button.
As before, select "func_door_rotating" and
put "door1" in the "name" attribute field.  Lastly,
find the "delay before close" key and put "2" in this field

(for some reason, "4" doesn't work once the level compiles). Now,
click on the "flags" tab. See
the "X Axis" and "Y Axis" flags??? These determine what
axis the door will rotate on if you don't want it to rotate on the "Z Axis"
(this should be pretty obvious)... The way to determine which axis you want
to select is to look at the XY view. We want our door to open like a garage-door
this time around, so we want the "hinge" to be along the axis that
the door is in. Notice our door sits running North-South?? This is in the Y
axis, so this time let's select the "Y Axis"
. Close the entity properties box, and
compile and run the map to test it out

flags showing that the door should rotate in the Y axis...

we're going to rotate the door on the X axis. I'm not going to make
this one pretty or very functional; but this is just a demonstration of what
is possible. Just go back into the entity properties box by selecting
our door and hitting "ALT+Enter", and change the selected flag from
"Y Axis" to "X axis". Re-compile and run the map
See what this one does??? Notice also that it automatically took the mid-point
of the Origin brush along the X axis - even though we had designed the origin
brush for the Y axis.

at the risk
of being a spoil-sport, I think I'm going to have to cut this
tutorial short. We've covered a LOT of new information today; and I want some
time for it to sink into you before we move on. Play around with these options;
and see what you can come up with.  Some things I didn't cover, but you
should try: Change the degrees of rotation, add sounds to your buttons and doors
(with the "move sound" and "stop sound" keys), change the
speeds of movement, and try changing your origin brushes to be centered in different
spots. Next tutorial I'll cover the lifts, and delve into some lighting. 'Till
then, take care and happy editing!

Rate This Article
This article is currently rated: 5 out of 5.0 (1 Votes)

You have to register to rate this article.
User Comments Showing comments 1-2

Posted By: Noitamina on Aug 17 2004 at 11:46:42
And once again a perfect tutorial for me..ive learned much.....thanx hellbringer

Posted By: freakinparker on Aug 29 2005 at 14:45:45
thanx for the tutorial helped me make doors :)

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005

Latest Comments
knock knock
General | News
By: MIFUNE | Dec 31 2017
knock knock
General | News
By: omega | Dec 22 2016
knock knock
General | News
By: MIFUNE | Oct 10 2015
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
knock knock
General | News
By: Whistler | Nov 05 2011
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (7 guests)
About - Credits - Contact Us

Wavelength version:
Valid XHTML 1.0! Valid CSS!