[Tutorials]Making awesome doors!

Discussion in 'Tutorials & Resources' started by spaceweasels, Nov 9, 2007.

  1. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Part 1.
    Making a team controlled sliding door with A PANE OF GLASS INSIDE!

    You can download the VMF file here.

    Okay, first create two rooms and connect them through a doorway. We'll be placing a door shortly. I'm going to make double doors. First I create the brush for the first door, like so:
    [​IMG]
    The door's dimensions are 128(height)x64(width)x20(thick).

    Next I'm going to create a carving brush to create a window pane in the (about to be) door. Like so:
    [​IMG]
    Using the carve tool can really save time, but it can also create brush errors, so be careful using it.

    Next I'm going to install the window itself. The dimensions of the window are 128(height)x64(width)x16(thick). You'll notice it's almost the exact same dimensions as the door frame (except for the thickness). This is important!
    [​IMG]

    Now select the window brush and the door frame brush (by using the CTRL key you can select numerous brushes together). Now right click and select tie to entity.
    [​IMG]
    We'll be making a door, so select func_door.



    Continued....
     
    • Thanks Thanks x 8
  2. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Now go into the door's properties. Give it a name (like door1) and specify the direction it's going to be moving. Select UP, since it's the easiest, if you haven't created sliding doors yet. Go to the Flags tab. Remove the check on Touch Opens and put a check on Toggle.
    [​IMG]
    I'll explain shortly why we need those flags.

    While you still have the door selected, copy and paste it, and put the new door right beside it. You don't need to make any changes (unless you gave it a different opening movement than up or down).

    Now let's create some team filters. These will tell the door when to open for which team. So click on the New Entity button (the lightbulb) and select Filter_activator_tfteam. Go to the properties and give it a name (prefereably one that specifies the team it filters for), and specify which team it's used for. In this example, I created the blue conrtol filter:
    [​IMG]
    Once you create the first team's filter, create the second.

    Now we'll create a sensor that opens the door for the proper team when you get near it. First select the TRIGGER texture. Next create two boxes on either sides of the doors. One will be the trigger for red and one for blue. If someone from the opposite team is on the wrong side, the door won't open for them anymore. Once the two boxes are created, select one and right mouse click. Select tie to entity. The entity you want to bind it to is trigger_multiple. Give it a name (it's optional, but it helps locate bad entities), and select the appropriate filter under filtername. Like so:
    [​IMG]

    Now select the Output tab. There are two outputs we want to build. One that says when to open the door, the other to say when to close the door. Here it is from my map:
    [​IMG]
    The first specifies that when someone from the allowed team (due to the filter) enters the trigger (or starts touching it), open the door. The second output says that when the person leaves the trigger, close the door. This is why we selected the toggle flag on the door. The door will remain open as long as someone is standing on the trigger. If you don't have the toggle flag set, the door will automatically close after a couple of seconds.

    Add two spawn points, one in each room, corresponding to the correct teams. Add two light entities in each room. Now compile and you're all set.

    Hope that was easy enough!
     
    • Thanks Thanks x 5
    Last edited: Nov 9, 2007
  3. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Part 2. Capture point controlled doors.

    Purpose: This tutorial will show you how to create a door that will only allow the owners of the nearest control point to open the door.

    You can download the VMF file of the completed map here.

    First open up the VMF map we created from Part 1. Currently we have one trigger on each side of the door, each specific with the team's room. We need to add another trigger on each side for the other team.Make sure you name each trigger with a unique name, and have start disable set to yes.
    [​IMG]

    Next we're going to create a sign that tells the teams who owns the door. The sign will give a visual signal, so there's no guesswork for the players. So click on the entity tool (the lightbulb) and select prop_dynamic. Open the properties, we'll be using the model exit_mounted.dll, make sure you give it a name. You'll need to set the skin setting as well. A skin of 0 (zero) gives you a red sign, while a skin of 1 gives you a blue sign.
    [​IMG]
    You'll want to set it to the opposite team's skin. That way it'll indicate when the map starts that the door is locked. So set the blue skin in the red room, and the red skin in the blue room. Now move the sign against the wall near the door. For this exercise, I name the signs exitsign-n and exitsign-s.

    Now we'll be creating the capture points. For this exercise, we'll make 3 capture points. One for each team and a third that will make sure that the game doesn't end, so we can fully test the door. I placed the third CP in a separated room where no one can get to it.
    The first two CPs will be team owned. The third will be neutral. You'll want to put the blue team's CP in the red room and the red team's CP in the blue room. Here's the properties I set for the control points:
    [​IMG]
    Make sure you name it, and set the team owner and give each one a unique index. On my finished map, I gave the blue team's CP an index of 0 (Zero), the red CP an index of 1, and the neutral CP an index of 2.

    Keep the properties open and click on the Outputs tab. Here are the Outputs I set:
    [​IMG]
    Basically the capture points will turn on the owner's trigger and turn off the opposite team's trigger. It will also reskin the prop_dynamic sign we placed earlier. You'll want to make sure the triggers it points to by name, are the same triggers that are in the same room. If you name the triggers in the opposite room, the door will never open.

    Continued...
     
    • Thanks Thanks x 3
    Last edited: Nov 11, 2007
  4. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Okay, now we're almost done.

    We need to create a trigger_capture_zone. So click on the brush tool (the blank box) and select the trigger texture again. Create two large boxes that covers each control point. For each, select them and right click and select tie to entity. The properties should look like this:
    [​IMG]
    I suggest you name each (it isn't necessary, but can help for problem solving). You'll want to make sure the control point field has the name of the CP the trigger has envelopped. You don't need to create a trigger for the neutral CP.

    Lastly, click on the entity tool. Select team_control_point_master. Go into the properties.
    [​IMG]
    Give it a name (again, for problem solving), and I set the cap layout to 2,0 1. This should put the neutral CP on top, and the red and blue CPs under neath it.

    Compile the map, startup TF2, and test it out. Here's how mine came out:
    [​IMG]

    As you can see the door sign, and the capture point start off on the blue team and the door won't open. Try playing as both sides to make sure the CPs, door and signs work properly.

    Let me know if you have any problems.
     
    • Thanks Thanks x 3
    Last edited: Nov 11, 2007
  5. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Part 3. Animated prop doors

    In this tutorial, I'll be using the garage door from CP_Well. It's a neat little effect for doors, but it requires a little subterfuge and slight of hand... er, door.

    First open up the first door tutorial file we created. we don't want to deal with the unnecessary entities of control points and what-not.

    Delete the window-pane doors we created earlier, and save this map as a new name.

    Next Click on the entity tool and create a prop_static. This is going to be the fame. The model name is main_entrance_door_frame.mdl .

    Resize your walls to fit the frame, and give it a bit of extra room. Here's how my map looked at this point.
    [​IMG]

    Now create another entity as prop_dynamic. Go into it's properties.
    [​IMG]
    Give it a name (I gave it garagedoor). The model used will be main_entrance_door.mdl. I also set the collisions to not solid. It will be clear shortly why I did that. Now position it so it looks attacked to the rails, but in a closed position, like so:
    [​IMG]

    Continued...
     
    • Thanks Thanks x 4
    Last edited: Nov 11, 2007
  6. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    At this point, you have what looks like a door, but it's not really a door. It also doesn't do anything. We'll be using other entities to control it.

    Now create a brush (any texture will do) that covers the door model (not the frame model though, just the door model). Right click on it and select tie to entity. Select func_door, give it a name (in this case I used door1 since my triggers are still set to that name). Set the move direction to up. Set the render mode to do not render (making it invisible but will still block everything.), I usually up the speed to 200 as well. Go to he flags tab, remove the check next to touch opens and put a check on toggle. Here's the properties:
    [​IMG]

    Now go to the Outputs tab. Set the following outputs:
    [​IMG]
    You'll notice that I've instructed that when this entity is open, it causes the prop_dynamic door model to use the open animation. And when the door entity closes, the prop_dynamic door shows
    the close animation.

    Last step is to make sure the triggers are still pointing to the new func_door entity. You should also put brushes over the cover the gaps between the door model and the walls.

    Compile and test it out.

    The door when it's closed:
    [​IMG]

    the door when it's open:
    [​IMG]
     
    • Thanks Thanks x 8
    Last edited: Nov 11, 2007
  7. ThatGuy

    ThatGuy L2: Junior Member

    Messages:
    51
    Positive Ratings:
    0
    Gah i'm new to mapping and hammer, im trying to learn slowly and over time..

    I don't understand how to use the carve tool, you make the door and then do what..?! please help me and give more details, thanks.
     
  8. Intraman

    Intraman L4: Comfortable Member

    Messages:
    191
    Positive Ratings:
    0
    This is a pretty decent tutorial so far. I didn't even think about putting a glass panel in a door.
     
  9. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    The carve tool just requires a regular brush(the 2nd brush), to intersect the brush you want to carve(the 1st brush). Select the (2nd) brush you'll use to carve, right click and select carve. Now move or delete the carve brush, and you'll get a carved formation (or a hole) in the 1st brush.

    I just used the carve tool to easily make four smaller brushes. You can opt to make the four brushes (for the frame: left, right, up and down) manually if you have problems/dislike the carve tool.



    Errata:
    I claimed in the first post the the window pane must be the same size as the door frame. This was true in the original Halflife/TFC when windows needed to be tied to an entity to be properly rendered. This is no longer true, so your window doesn't need to go "corner to corner".
     
  10. Alexforcefive

    Alexforcefive Guest

    Positive Ratings:
    0
    That was an amazing tutorial! You rock, spaceweasels.

    The SDK update allows you to use OnStartTouchAll now, by the way. I think it worked before anyway, but now it doesn't tell you your outputs are broken.
     
  11. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Thanks, I'm glad you liked the first part. I'm writing the second part right now.

    The reason I didn't use the OnStartTouchAll conditional, is because I'm unsure exactly what seperates it from the regular OnStartTouch conditional. The difference between OnEndTouch and OnEndTouchAll is significant and well documented.
     
  12. spaceweasels

    aa spaceweasels

    Messages:
    219
    Positive Ratings:
    336
    Two new tutorials. Check them out on the first page.
     
  13. Dox

    Dox L8: Fancy Shmancy Member

    Messages:
    588
    Positive Ratings:
    62
    Thanks for the great tutorial, cant wait to make my CPs and linked doors when I get back. (Well, that will be second, first I need to throw in some great architectural details I got during the weekend while wandering around this town I took a trip to. WISH I brought a camera.)
     
  14. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,535
    A note on carve: never ever ever use it for anything more than this situation (4-sided square-corner cut out of a wall type brush). It's always better to construct a hole yourself. Personally I never use it period, but I suppose it doesn't make a difference with simple things like this.
     
    • Thanks Thanks x 1
  15. Snipergen

    Snipergen L13: Stunning Member

    Messages:
    1,053
    Positive Ratings:
    150
    did you see how they make the real doors in the official maps? they also make an invisible wall that moves up and correspond with the animation of the model :) and thats how i make my doors too, because they do it too. :)
     
  16. timtim

    timtim L1: Registered

    Messages:
    10
    Positive Ratings:
    0
    Actually I stopped using the carving tool pretty early. you can al do it with the slicing tool as well. The slicing tool is like a saw. Just draw the line where to cut and click the tool button againt until every part you want to keep is white. Everything that is red gets cut off and thrown away. Maybe the Carving tool is faster but once you are working with bigger objects than a door hammer starts to make silly cuts with the carving tool where you can control that yourself with slice.

    Now back to topic. This is a real good tutorial. Thank you very much for the work!
     
  17. Boylee

    aa Boylee pew pew pew

    Messages:
    1,068
    Positive Ratings:
    631
    First up thanks alot for the great tutorial, was a big help in figuring doors out first time round. :thumbup:

    It probably worth a mention that func_door has a property called lip.
    Code:
    Lip determines how much of the door, in Hammer units, sticks out when it is fully open.
    basically it allows you to stop brush edges from overlapping when your custom made doors are open, i.e stops this from happening:
    [​IMG]