Are you a Level Designer? Are you looking for help/support or other level designers? Then this is the group for you! Doesn't matter what you map for, if your a beginner or a professional this is the group for you.

Report article RSS Feed Hammer Editor tutorial advanced Elevator

Learn how to create an elevator in Valve's Hammer editor. Cabine with moving doors and buttons.

Posted by gionny on Dec 21st, 2009
Intermediate Mapping/Technical.

<!--[if !mso]> <xml> Normal 0 21 false false false MicrosoftInternetExplorer4 </xml><xml> </xml> <!--[if gte vml 1]>
On the right side next to your view ports click on Brows to select a texture.
<!--[if gte vml 1]>
A new window appears. Type "dev/dev_measurecrate02 " under the point "Filter
<!--[if gte vml 1]>
This will be the texture we are going to use.
Click on the "create Tool" button on the left.
Now go to your TOP view and drag a square of 512x512
Go to your side view and drag the square upwards to 1472 units.
Now pres "Enter". A block has been created and should look like this:
<!--[if gte vml 1]>
Now pres Ctrl+H to make this block hollow and type in the new mask "-8". This will create the walls outside of your cube and not inside.
If you want to test your elevator you should probably create a ground plate.
Now move your camera inside the hollowed block and klick on "ig". This will allow you to delete faces of the hollowed cube without de-grouping the hole thing.
<!--[if gte vml 1]>
Once inside the cube select the bottom and delete it.
Do the same for the top.
It should look like this:
<!--[if gte vml 1]>
Now create the cabin. Therefore click again on ig to deactivate it and then on the "create tool" on the left bar. Go to your top view and drag a square (512x512) and then go to your side view and drag the height to 136 units and pres enter. (HINT: to choose the right height or size of your elevator place an info_player_start entity in front of your elevator. so you can see how tall you should make the cabin.)
<!--[if gte vml 1]>
Again use Ctrl+H to hollow this block BUT THIS TIME TIPE "8" in the dialog! Because now we want the walls to be inside the cabin. Otherwise it would collide with the outer walls and cause grafikbugs.
Now we have our cabin. But we will need doors to be able to enter the elevator. Klick on "ig" to ignore grouping and select the side of the cabin you want your doors at. Then move your camera outside the elevator and select the same side of the outside wall (make sure you hold Ctrl while selecting). This way we will cut the doors into the cabin AND the wall.
Select the "clipping tool" on the left bar and go to your side view. Place the info_player_start entity in front of the door we are going to create. MAKE SHURE YOU ARE DIVIDING AND NOT CUTING! (all lines should be white!) and pres enter.
<!--[if gte vml 1]>
Divide the faces on the right side of the info_player_start, on the left side, in the middle AND on top of the info_player_start. When you are done it should look like this:
<!--[if gte vml 1]>
Congratulations! You just cut out 4 doors. 2 for the cabin and 2 for the outside. Now select them and click on the "texture application mode" button in the left bar and then on "Browse". Select the "dev/dev_measuregeneric01b" texture and click on apply. There you are! You can see your doors.
<!--[if gte vml 1]>
Now all we need is to cut out the doors in the upper floor and we are nearly done. So select your cabin and move it to its end position. (MAKE SHURE TO UNCHECK "ig"!)
Now activate again "ig" and select the side you created your doors (outside NOT THE CABINE!)
Here you will need only 2 "cuts". The top and bottom edge of the doors. When you are done it should look like this:
<!--[if gte vml 1]>
Now we are nearly done. Go and select a texture (remember? Browse on the right side of the views) and select under filter "invisible". Select your "block creation tool" and drag a square in the top view (16x16) and its height (from top to ground) 1344 units. YES IT WON'T TOUCH THE GROUND! Pres enter.
Select the invisible square you just created AND your elevator and group them together.
Last but not least create 3 buttons. I am not going do describe how to create them as a block. If you don't know it please reefer to another tutorial (it would get far to detailed now). When you are done with your buttons we will start creating our entities.
Select the button on the upper floor. Pres Ctrl+T to tie the Button to the entity. From the dropdown-list select func_button.
Give this button the name "button_elevator_outside_up". (HINT: names should make it possible for you to figure out the entity by the name ;) ). Go to the FLAGS and check "Don't move" so the button won't move into the wall after being pressed. Repeat this for the other 2 buttons. Name the button inside the elevator "button_elevator_inside" and the other button "button_elevator_outside_down" (don't forget to set the flag!). Now click on "ig" and the select your doors one by one. Give each door an appropriate name after selecting the "func_door" function. The doors of the cabin should be named "door_cabine_01" and "door_cabine_02" and the doors outside something like "door_elevator_outside_down_01" and soon... I know these names look really long but it makes it easier to identify each entity. When you are done with it select all your doors (uncheck "ig") and go to the flags. Uncheck "touch opens" and check "toggle". Make also sure the move direction is correct for each door (refer to the top view port to assign the right direction).
In order to move your cabin-doors and the button inside enter the entity options and under "parent" tipe in elevator. Now the button and the doors will move with their parent.
When you are done select your cabin. Tie it to an entity (Ctrl+T) and give it the function "func_door" (sounds silly but it works XD ). Name it elevator. Scroll down to "move direction" and select "Down" from the dropdown menu (since your elevator is up it will move down to you)
<!--[if gte vml 1]>
Go to flags and uncheck "touch opens" and check "toggle".
Congratulations.... now you got all necessary entities!
Now let's get to the tricky part. The control of the elevator....
This is the point where it gets really tricky and it took me long to figure it out. First your elevator should not move till the doors are closed. as soon as your elevator reached his destination the doors should open. Usually the doors of an elevator won't close if you stuck the doors.... if you made this up for you it should be easy to program it.
Pressing the button to call your elevator should close the doors. because you don't know if the doors are open. So say the buttons they shall close ALL doors! To do so select all buttons and enter the entity-properties by pressing right mouse in a view (not 3D view!). Go to outputs and click on "Add" and set the values as followed:

MyOutputNamed: OnPressed
TargetsEntityName: "the name of one of your doors like: door_elevator_cabine_01"
Via this Input: Close
After A Delay in sec of: 1

(repeat this for every single door). When you are done the outputs should look like this:
<!--[if gte vml 1]>
Now select the cabin and go to "Outputs".
Click on "Add" and set the values as followed:

MyOutputNamed: OnFullyOpen

TargetsEntityName: door_elevator_outside_down_01 (repeat for door_elevator_outside_down_02, door_elevator_cabine_01 and Door_elevator_cabine_02)

Via this Input: Open

After A Delay in sec of: 1

Next add 2 other outputs:

MyOutputNamed: OnFullyClosed

TargetsEntityName: door_elevator_outside_up_01 (repeat for door_elevator_outside_up_02, door_elevator_cabine_01 and Door_elevator_cabine_02)

Via this Input: Open

After A Delay in sec of: 1

When you are done it should look like this:
<!--[if gte vml 1]>
Nearly done with this tutorial.... Only thing missing is to tell the cabin to move.
So go back and select all buttons. Go to "Outputs" and add a new one.

MyOutputNamed: OnPressed
TargetsEntityName: elevator
Via this Input: Toggle
After A Delay in sec of: 2

Congratulations! You are done. By giving the elevator-toggle a delay of 2 your elevator will wait till your doors close and then move.
(HINT: if you stuck a door by standing between them the elevator will move anyway and the doors will stay wide open... I tried to trigger the cabin by the door using OnFullyClosed as a trigger for the cabin but it didn't work proper... if you want your doors to close no matter what just set the Force close to "YES" and the stuck damage to 1 so that the player gets hurt if he stuck the door.

Bye

Post comment Comments
gionny
gionny Dec 21 2009, 12:07pm says:

uh just forgott one thing! in order to have your button move with the elevator as well as the doors select them, go into the entity-propertys. There is the point "Parent". Just type there the name of your elevator (here elevator). Now the Button and the 2 doors of the cabine will move with the cabine

greets

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Established
Apr 1, 2008
Privacy
Public
Subscription
Open to all members
Contact
Send Message
Email
Members Only
Membership
Join this group
Group Watch
Track this group
Tutorial
Browse
Tutorials
Report Abuse
Report article
Related Groups
Level Design Group
Level Design Group Hobbies & Interests group with 571 members
Source Developers
Source Developers Fans & Clans group with 956 members