We're going to make an elevator with two props and have it close the door once you press the button inside and go to the next level. Once at the next level the door will open and wait for you press the button again.
First you want make a
prop_dynamic with the
models/props_lab/freightelevator.mdl model. Give it a
Name of
prop_elevator and make the
Parent elevator (we will be getting to that in a moment). Now make another
prop_dynamic with the model
models/props_lab/elevatordoor.mdl. Give it the
Name prop_door and
Parent it to
elevator. If you look at the front of the elevator model you will see a dark beam on both sides of the door and wouldn't you know it the elevatordoor.mdl fits right in there.
Now we come to the parent I was talking about. Get the
NODRAW texture and make a brush the size of your elevator from the top. Here is the important part. Make sure the top of the brush is level with the floor in the elevator. If not, wherever the top of the brush is where the player will walk. So it?s better to have even with the elevator floor.
Now make the brush you just make a
func_tracktrain (Ctrl+T) with the
name elevator and change the
Max Speed to
50 (the default of 100 is a little fast). Also change the
Height above track to
0 and for
First Stop Target put
path_track_01. Go to the flags tab and check only
No Pitch and
No User Control.
To make it clear what we have done so far is get our elevator and door and tied them to the
func_tracktrain. So wherever the func_tracktrain goes so will the elevator and the door. Now we just need to tell it where to go.
To do that you need 2
path_track entities.
Name the first one
path_track_01 and for the
Next Stop Target put
path_track_02. Go to the Outputs tab and add these 2 outputs.
My outputs named: OnPass
Target entities named: elevator
Via this input: Stop
With a parameter override of: <none>
My outputs named: OnPass
Target entities named: prop_door
Via this input: SetAnimation
With a parameter override of: open
Since we changed the
Height above track to
0 for our
func_tracktrain we can set the floor of the elevator right where we need to. In the x/y (top) view put the X in the middle of the
path_track entities right where the X for the
func_tracktrain is at. In the y/z (front) or the x/z (side) view put the X for the
path_track even with the top of the floor you want it to start on.
Do the same as above for the other
path_track but
name it
path_track_02 and set the
Next Stop Target to
path_track_01. Of course put this one above or below depending on what way you want it to go.
Now we need to trigger all this. To do that we get our NODRAW texture again and make a small brush that covers the button inside the elevator.
Make this brush a
func_button (Ctrl+T), give it the
Name of
elevator_button and made the
Parent elevator. Go to the Flags tab and check only
Don't move and
Use Activates. Now go the Outputs tab and add the following two outputs.
My outputs named: OnPressed
Target entities named: prop_door
Via this input: SetAnimation
With a parameter override of: close
My outputs named: OnPressed
Target entities named: elevator
Via this input: StartForward
With a parameter override of: <none>
And there you have it. The door will start open, you get inside and press the button, the door will close and the elevator will move. But theres one more thing. If you try it now you can just walk out the sides and back. To stop this get the Player Clip texture and made a brush for the sides and back. Select all of them and make it a
func_brush (Ctrl+T). Make the
Parent elevator and you're set.