PDA

View Full Version : [TUTORIAL] The Elevator Trifecta


spaceweasels
01-25-2008, 02:33 PM
It's been a while since I wrote up a tutorial. So, I'll write three in one. What a deal!

Basically I'll show my fellow map makers how to make three different types of elevators. I'll start with the basic “door as elevator” technique that's very common, with a twist! Next I'll show you how to turn a prop into an elevator. Lastly, I'll show you how to create an elevator using func_movelinear and discuss the advantages and disadvantages between a movelinear entity to a door entity.

We'll be doing a lot of unit counting and calculations, so clean your multiplication table from all those cobwebs.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators-part1.jpg

Alright, so to start off create a large room. The room I created was 768x768 with a height of 832. You want to add two floors inside the hollow cube. Make sure you have equal spacing between the floors. In my example, I have a basement, a first floor and a second floor. Each in 192 units from floor to ceiling; since the floors are 64 units thick, it's 256 units from floor to floor. Here's how my basic map looks so far:
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators01.jpg

Now we want to create an elevator shaft. We want the elevator shaft to be 128x128 units. Instead of resizing our floors, we can use the carve tool. Create a box where the shaft will be and make sure it's thicker that the floor brush. Right click on the new brush and select carve.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators02.jpg

Once carved, you can delete the carving brush we just created. Create a basic elevator, using a brush for the top, bottom and sides. I'll leave the design up to you, but it should be 128x128 units and should be on the first floor under the shaft we created. Here's what mine looks like:

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevator03.jpg

You'll notice I have a yellowish button in the elevator, don't create this button yet. This is the twist, and I'll talk more about it in part 2.

spaceweasels
01-25-2008, 02:33 PM
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators-part2.jpg
Use the CNTL+left mouse button to select all the elevator brushes. Now right click and select tie to entity.

The entity window will appear. Select the func_door entity and press the apply button. Give it a name (like elevator), make sure you have the move direction set to up. You'll notice my lip number might seem weird (-104) this is the amount of space (in units) between the top most part of my elevator and the second floor. You'll need to measure and see how many units you have between your custom elevator and the second floor. Lastly, go to the flag tab and remove the check next to touch opens and place a check next to toggle.
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators04.jpg

Now we'll create a button that travels with the elevator, which controls whether it goes up or down. I used a small cylinder brush, but you can use any brush you want. Once the brush is created, select tie to entity. Select func_button and press apply. Give the button a name if you want (optional), but make sure the parent field has the name of the func_door entity we created. With a parent specified, our button is going to do whatever it's parent does. In this case, go up and down.
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators05.jpg

Go to the flags tab and remove the check on use activates and place a check next to touch activates. I put a check next to don't move, but that optional.
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators06.jpg

Now, go to the outputs tab. Create one output, which has the following:
On Pressed -> Elevator -> toggle
If you didn't name your door entity elevator, then make sure you put that name in the target field.

Lastly, create two more button, one on the first floor, the other on the second floor. They are identical to the button in the elevator except do not specify a parent. Now those buttons will call the elevator when it's on a different floor.

Now test your map out (without RAD, since we have to lights). It should work well.

spaceweasels
01-25-2008, 02:34 PM
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators-part3.jpg

Now that we got a small exposure into parenthood, we'll be doing the same, but this time applying a parent to a prop to turn it into an elevator. For this example, the prop I'm using is “elevator_well_platform”, but you can use any dynamic prop for this. The first thing you want to do is remove the door elevator from the shaft. Don't delete it, since we'll use the basic brushes for the last tutorial.

Now use the entity tool to place a prop_dynamic_override on the first floor of the elevator shaft. Select the model you want to use, and in the parent field type propelevator. We haven't created this entity yet, so don't worry about having missed a step. Make sure you don't select a static prop, they won't load properly, but either a dynamic or physic prop will work.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators07.jpg

Now we want to create a brush, which will act as our elevator. I added a crossbar in my elevator, and the crossbar acts as the elevator entity. Here it is:
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators08.jpg

Select the new brush and tie to entity. Make it into another func_door, similar to the one we created earlier, but name it propelevator, and you'll need to remeasure the lip.

Optionally, if you don't want a crossbar, you can create a brush with the invisible texture on it, and make that the func_door entity.

Lastly, change the three buttons to point to propelevator instead of elevator and change the parent for the moving button to also point to propelevator.

It's as easy as that.


Note: I added a prop_static called elevator_well_track for the braces to either side. It's optional for this exercise and you can add them as well, it you wish.

spaceweasels
01-25-2008, 02:34 PM
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators-part4.jpg

So we've had a good run with using the func_door entity. However, you may notice it's short coming. It's either up or down. On or off. AC or DC. There is no middle ground. This works well enough if you have two elevations, but once you work with more elevations, the func_door trick can't help you. So we'll now start using the basement we created way back at the beginning. So go ahead a carve another 128x128 hole in the first floor to the basement, just above our original shaft. You can also remove(or just move) the prop elevator at this point.

Note: If you want to keep using the prop elevator, you can do so, you just need to change the func_door entity, the prop_dynamic_override entity can stay pretty much the same, except changing the parent name.

Now put the brush you created for the original elevator back in the shaft (unless you're still using the prop elevator). Go into the properties of the func_door and change the entity to func_movelinear and press apply. Here I changed the name of the entity to elevator-linear, you can do so if you wish. Set the move distance to the amount between floors (for me, it's 256, as explained in the first part). Make sure the move direction is UP.
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators09.jpg

Now we have to change the outputs on the func_button entities. On each button, instead of toggle we'll be using set position.
http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators10.jpg

You'll notice you'll need to enter a value for the parameter override field. The first floor will use 0 (zero), the second floor will use 1, and the basement will use -1. If you had a third floor, it would use 2 and a sub-basement would use -2.

You might wonder why we're using 0,1,-1,2,-2 for the parameter ovveride. Remember on the func_movelinear we set the move distance to 256 (in my case). This means that to reach the second floor, with entity has to use the move distance once. A third floor means it would have to use the move distance twice. The basement uses the move distance one, but in the reverse direction (down instead of up), that's why it's negative.

You'll need to create a button in the basement. You'll also have to change the button in the elevator itself. Since the elevator can go more than just between two floors, I created three buttons inside the elevators, each pointing to a different floor, and each have the parent field set to elevator-linear.

http://i28.photobucket.com/albums/c216/drdread/tf2tutorials/elevators11.jpg

As you can see, the func_movelinear is much more powerful and versatile, but it's trickier to use. Between two floors I still suggest using the func_door.
You can download the BSP and VMF files here! (http://tf2maps.net/showthread.php?p=5538#post5538)

I hope this tutorial was helpful, and that you all learned something valuable. Let me know if you need some clarification or help.

Paddy
01-25-2008, 05:38 PM
Great tutorial there! look forward to using it in a map now!

DJive
01-26-2008, 11:45 AM
essentially it could be setup to go from side to side im guessing?

Be cool to have a spawn room with 1 way out to a "train" that will take players to a choose of area's =)

Hawk
01-26-2008, 02:07 PM
Cool! I actually want to put an elevator in a map now! Thanks for this tutorial.

Paddy
01-27-2008, 11:51 AM
well i used it in a map and it works! yay! lol
but now im wondering how you could say make a door on each floor that only opens when the lift is there cos that would stop people standing under the lift so it cant stop!

Snipergen
01-27-2008, 12:43 PM
I missed you spaceweasels!

spaceweasels
01-27-2008, 01:20 PM
well i used it in a map and it works! yay! lol

Good!

but now im wondering how you could say make a door on each floor that only opens when the lift is there cos that would stop people standing under the lift so it cant stop!

Well, the easiest way is to make a door and tie that door with the switches, and give them a delay. Unfortunately, the doors will open whether the elevator is there or not.

The way to have a door know when the elevator arrives at the floor, is a tutorial for another day, I'm afraid.

I missed you spaceweasels!

Thanks. I've been busy, but I'm back.

Gearloose
01-27-2008, 07:48 PM
Hey, I hadn't thought of using setposition on a movelinear to have more than two stops. Cool!

zbandito
02-12-2008, 05:53 AM
Thanks. I believe much of this also applies to func_tanktrain. :)

AWESOME-O
03-21-2008, 05:45 AM
well i used it in a map and it works! yay! lol
but now im wondering how you could say make a door on each floor that only opens when the lift is there cos that would stop people standing under the lift so it cant stop!

Good!

Well, the easiest way is to make a door and tie that door with the switches, and give them a delay. Unfortunately, the doors will open whether the elevator is there or not.

It can be done easier:
Just put an trigger hurt_on the downside of the elevator to go up with it. So if the elevator comes down and their under it they die.

Open Blade
05-07-2008, 08:00 PM
It can be done easier:
Just put an trigger hurt_on the downside of the elevator to go up with it. So if the elevator comes down and their under it they die.

I thought of that but how do you get your hurt brush to move with the elevator?

AWESOME-O
05-08-2008, 01:03 AM
parent it to the elevator

Rawnblade
05-22-2008, 10:54 AM
Wonderful tutorial, it definitely exposed me to more of the tools available at my disposal.

One of my map ideas is pretty much a vertical payload map, only the bomb is in fact an elevator. On my small test map, I've been playing around with triggers and such, and can't seem to find a way to make the platform move vertically past the first floor by simply having someone stand on it. What I'd like is for the platform to stop dead when the player gets off of it, and continue rising when he gets on.

The basic func_movelinear design hits a snag in that I cannot find a way for the trigger to increment the current position by 1 each time.. so my question is:

How would I set up an entity that only moves when a player touches it, and stands still otherwise?

Hildreth's Will
12-12-2008, 08:09 AM
I had a perfect use for an elevator, though I am trying to make a map with 6 floors and that may take time.

Still, it will look good if I can make them as well as yours. Thanks

Kill_the_Bug
02-05-2009, 11:56 AM
OH DUDE - THANKS YOU SO MUCH!!! i'VE BEEN WORKING ON AN OFFICE MAP AND COULDN'T FIGURE OUT HOW TO GET MY ELEVATOR TO DIFFERENT FLOORS - THANKS!

midget31394
02-06-2009, 11:31 AM
To make a door open as when the elevator reaches the level, couldnt you in theory do the same type of thing with spawn doors, using a trigger and a tfteam filter, do as the elevator goes up, the player hits the trigger and the doors open?

~M

HoundDawg
05-08-2009, 12:39 AM
Just be sure that the speed of the elevator is not too fast. HL2 is still using much of the HL1 base code, which cause issues on elevators moving too fast upward (not downward). The problem is when your elevator moves faster than players have their position updated, in which they'll sometimes get stuck into the elevator floor. Players in the past have learned to jump while going up, but that doesn't always work.

So, watch the upward speed. You may not notice this issue on a lan or with only a few players. But, on more full servers and a fast enough elevator, this becomes quite an issue.

Pianodan
05-08-2009, 06:32 AM
Wonderful tutorial, it definitely exposed me to more of the tools available at my disposal.

One of my map ideas is pretty much a vertical payload map, only the bomb is in fact an elevator. On my small test map, I've been playing around with triggers and such, and can't seem to find a way to make the platform move vertically past the first floor by simply having someone stand on it. What I'd like is for the platform to stop dead when the player gets off of it, and continue rising when he gets on.

The basic func_movelinear design hits a snag in that I cannot find a way for the trigger to increment the current position by 1 each time.. so my question is:

How would I set up an entity that only moves when a player touches it, and stands still otherwise?

I would think you could basically just set it up like a normal payload map, with a track that goes up. Use path_tracks and a func_tracktrain, with whatever model you want for the elevator instead of the standard bomb. Even if you want to do something slightly different, you can probably start with the pl tutorial and modify it from there.