[TUTORIAL] The Elevator Trifecta

Discussion in 'Tutorials & Resources' started by spaceweasels, Jan 25, 2008.

  1. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    334
    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.

    [​IMG]

    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:
    [​IMG]

    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.

    [​IMG]

    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:

    [​IMG]

    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.
     
    • Thanks Thanks x 4
    Last edited: Jan 25, 2008
  2. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    334
    [​IMG]
    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.
    [​IMG]

    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.
    [​IMG]

    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.
    [​IMG]

    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.
     
    • Thanks Thanks x 5
    Last edited: Jan 25, 2008
  3. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    334
    [​IMG]

    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.

    [​IMG]

    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:
    [​IMG]

    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.
     
    • Thanks Thanks x 3
    Last edited: Jan 25, 2008
  4. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    334
    [​IMG]

    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.
    [​IMG]

    Now we have to change the outputs on the func_button entities. On each button, instead of toggle we'll be using set position.
    [​IMG]

    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.

    [​IMG]

    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!

    I hope this tutorial was helpful, and that you all learned something valuable. Let me know if you need some clarification or help.
     
    • Thanks Thanks x 4
    Last edited: Jan 26, 2008
  5. Paddy

    Paddy L1: Registered

    Messages:
    40
    Positive Ratings:
    0
    Great tutorial there! look forward to using it in a map now!
     
  6. DJive

    aa DJive Cake or Death?

    Messages:
    1,466
    Positive Ratings:
    736
    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 =)
     
  7. Hawk

    Hawk L7: Fancy Member

    Messages:
    419
    Positive Ratings:
    212
    Cool! I actually want to put an elevator in a map now! Thanks for this tutorial.
     
  8. Paddy

    Paddy L1: Registered

    Messages:
    40
    Positive Ratings:
    0
    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!
     
  9. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    I missed you spaceweasels!
     
  10. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    334
    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.

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

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

    Gearloose Guest

    Positive Ratings:
    0
    Hey, I hadn't thought of using setposition on a movelinear to have more than two stops. Cool!
     
  12. zbandito

    zbandito L1: Registered

    Messages:
    21
    Positive Ratings:
    2
    Thanks. I believe much of this also applies to func_tanktrain. :)
     
  13. AWESOME-O

    AWESOME-O L10: Glamorous Member

    Messages:
    782
    Positive Ratings:
    66
    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.
     
  14. Open Blade

    Open Blade L7: Fancy Member

    Messages:
    439
    Positive Ratings:
    34
    I thought of that but how do you get your hurt brush to move with the elevator?
     
  15. AWESOME-O

    AWESOME-O L10: Glamorous Member

    Messages:
    782
    Positive Ratings:
    66
    parent it to the elevator
     
  16. Rawnblade

    Rawnblade L1: Registered

    Messages:
    1
    Positive Ratings:
    0
    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?
     
  17. Hildreth's Will

    Hildreth's Will L1: Registered

    Messages:
    4
    Positive Ratings:
    0
    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
     
  18. Kill_the_Bug

    Kill_the_Bug L14: Epic Member

    Messages:
    1,454
    Positive Ratings:
    234
    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!
     
  19. Fraz

    aa Fraz Blu Hatte, Greyscale Backdrop.

    Messages:
    944
    Positive Ratings:
    564
    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
     
  20. HoundDawg

    HoundDawg L1: Registered

    Messages:
    48
    Positive Ratings:
    2
    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.