[Tutorial] MacNetrons guide to Gravelpit-like CP maps

Discussion in 'Tutorials & Resources' started by MacNetron, Feb 24, 2008.

  1. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    This guide will consist of 4 parts.
    Part 1 is the easy starter and will just show how to make a Control Point (=CP from now on).
    In Part 2, we extend our one CP room to a room with 3 CPs, named A, B and C. In Gravelpit-style, A and B together unlock C for capture.
    If that is not enough for you, in Part 3 we throw in some logic to unlock C for capture after A OR B has been capped. Now that will teach them not defending C!
    For the final piece the resistance, Part 4 will make the room ready for publication by adding final pieces like setup-time and its triggered doors.


    [Part 1]

    First, create a big room so everything we will build will fit. I've created a 2048x2048x384 sized one. You are of course free to make 3 rooms to 'replicate' the Gravelpit-style, but I've just textured one side Red and the other side Blue (Red and Blue textures by Youme, available on the forum).
    Now, a CP consists of a couple of brushes and entities, 4 to be precise (as you can see below):

    [​IMG]

    Lets create a CP.

    1) Create a brush at the bottom with a minimum size of 224 (mine is even 512x384 to create a nice big capture area). Keep its height low, so we can walk onto it. My base is quick and dirty textured with “hazardstrip001a”. I leave it to the reader to create a nicer looking one.

    2) Add an entity prop_dynamic and edit its properties:
    World Model: models/props_gameplay/cap_point_base.mdl (hint: filter on cap_point)
    Name: prop_cap_a
    Thats all, move the prop to the middle of the bottom brush.

    3) Add an entity team_control_point on top of the prop_cap_a. Properties:
    Name: control_point_a
    Print Name: A
    Default Owner: Red

    On the tab Outputs, add a new output with the following settings:
    My output named: OnCapTeam2
    Target entities named: prop_cap_a
    Via this input: Skin
    With a parameter override of: 2
    After a delay in seconds of: 0 (Click Apply)

    4) Last, create a boxed brush with texture “tools/toolstrigger”. Width and length of the bottom box and a height of (in my case) 256. Then tie it to an entity by Tools -> Tie to Entity or just CTRL-T.
    Class: trigger_capture_area (click Apply)
    Name: team_cap_area_a
    Control point: control_point_a

    That is it! You've done it, your CP is ready and fully operational.

    Some further explanations. The team_control_point (point 3) is controlling who is the owner of the CP and for instance dependencies. Just have look at the properties. The trigger_capture_area (point 4) is making sure a player inside it, is capping the point if he is allowed to do that at all. The added output triggers a change of the skin of prop_cap_a. It will turn blue (by showing picture number 2) after the event OnCapTeam2 is triggered. Team1 is Red and Team2 is Blue.

    Technically speaking, if you look closely who is referring to who, only building the last two would be enough for a CP, but that will not look very TF2-ish.

    For the names, I follow the convention: “what is it doing?”_”who/where is it?”. So in this case everything with the same functionality will be “grouped” together in the various pull down menus we will see later on. And of course “a” is just for this tutorial. We could also named it “factory”, but you already guessed that, right?


    [Part 2]

    Now, for a Gravelpit-style map, we need 3 CPs. As rehearsing is the key concept of learning, do Part 1 another two times. Veterans are allowed to copy two CPs from CP A :)
    Make sure you replace all “a”'s in the names with “b”'s and “c”'s (“Duhh!” I hear you say...).

    Now lets look at the properties again for the various parts as there are small adjustments needed. The changes or additions are marked in bold.

    Point A (and B but with “b”):

    3) The team_control_point:
    Name: control_point_a
    Print Name: A
    Default Owner: Red
    Index: 0 (and B: 1)
    Blue Previous Required Point 1: control_point_a (Yes! Itself!)

    4) The trigger_capture_area:
    Name: team_cap_area_a
    Control point: control_point_a
    Can RED Cap?: No

    Now our final Point C, I'll hope you say something like – I guessed that!:

    3) The team_control_point:
    Name: control_point_c
    Print Name: C
    Default Owner: Red
    Index: 2
    Blue Previous Required Point 1: control_point_a
    Blue Previous Required Point 2: control_point_b

    Each Index must be unique. We will see why later on. At CP C, we define which CPs are required to unlock capping. In this case, CP A and CP B are required to be capped by Blue, then and only then CP C will be available for capturing.

    [​IMG]

    You can see at the left (blue) side the CPs A and B and on the right (red) side CP C.

    Add an info_player_teamspawn for each team and you are able to test the map for both sides.
    And we run immediately into problems. When playing Blue, we instantly lose, and when playing Red, we instantly win. We have created a linear CP-game, like Granary and Well. Congratulations, but that was not our goal.

    Lets add the final entities to complete Part 2 (Yes, those are the small dots in the middle of my map).

    1) Add an entity team_control_point_master:
    Name: team_control_point_master
    Cap Layout: 2, 0 1
    Restrict team from winning: Red
    Switch teams on map win?: Yes

    2) Add an entity game_round_win:
    Name: game_round_win_red
    Team: Red
    Switch teams on map win?: Yes

    3) Last, add an entity team_round_timer:
    Name: team_round_timer
    Timer length (in seconds): 120
    Max timer length (in seconds): 120
    Start paused: No
    Setup timer length (in seconds): 10

    On the Output-tab, add a new output:
    My output named: OnFinished
    Target entities named: game_round_win_red
    Via this input: RoundWin
    After a delay in seconds of: 0 (Click Apply)

    The team_control_point_master draws the Cap Layout on the HUD (with the Indexes, so that is why they need to be uniquely numbered). And it restricts team Red from winning when Red has all CP captured. So only Blue can win by owning all CPs.

    Red can only win if the time runs out. To create this, we have a nice combo by team_round_timer and game_round_win. The timer creates a 2 minute (=120 seconds) game and has an output to game_round_win_red. When the timer hits 0, it triggers an OnFinished. With the output-link, it will now raise the event RoundWin on Reds win condition, so Red can now win too.
     
    • Thanks Thanks x 7
    Last edited: Feb 25, 2008
  2. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    [Part 3]

    As you might have seen looking at the team_control_points previous required points, you can select multiple points, but not the logical operator on them. So in our case, we need A AND B to be able to capture C. It might be nice to create a map with A OR B to unlock C for capping. Just for advanced logical mapping fun, or because you made your map a bit easy to defend.

    Because we can't change the logical operator of the required points, we need a trick to have C only have one previous required point, named D. When Blue captures A OR B, D will turn Blue too so it will unlock C.

    3) Add for CP D just a lonely entity team_control_point:
    Name: control_point_d
    Print Name: D
    Index: 4

    On tab Flags, check the option Hide Control Point on HUD.

    Now, we trigger the ownership (eg. Red, Blue, Neither) of CP D directly from CP A and B by adding the same output to both control_point_a and control_point_b:

    My output named: OnCapTeam2
    Target entities named: control_point_d
    Via this input: SetOwner
    With a parameter override of: 3
    After a delay in seconds of: 0 (Click Apply)

    Capping CP A OR B will now directly trigger setting the owner of CP D to Blue (=3). Only thing left to do is having just one previous required point at C:
    Blue Previous Required Point 1: control_point_d

    [​IMG]

    On the picture, CP D in action. Capping B triggers ownership of D to Blue and unlocks C.

    As of win conditions, Red still wins when the time runs out. Blue still have to capture all CPs, only now the order might be a bit different, because B, C, A is possible.

    Note: We can't do this trick unlimitedly. There is a maximum of 8 CPs allowed in TF2. If you add more, then the game will crash on loading the map.


    [Part 4]

    To reward the attackers for their hard work capping the CPs, we can add some time to assist them capturing the remaining ones. This example will add 10 seconds when a CP is capped.

    Add a new output for each control_point_x:

    My output named: OnCapTeam2
    Target entities named: team_round_timer
    Via this input: AddTime
    With a parameter override of: 10
    After a delay in seconds of: 0 (Click Apply)

    Note that the added time can never have the time pass the number set in Max timer length (in seconds) in the team_round_timer.


    It is nice to have some setup time for the defenders to move to their positions and have engineers built some stuff. The setup time itself, we've already added that to the team_round_timer in part 2, with the entry Setup timer length (in seconds): 10.

    Add an entity prop_dynamic. This will be our door:

    World Model: models/props_gameplay/door_slide_large_dynamic.mdl
    Name: blue_spawn_door_prop

    Create 2 walls to make sure the players won't be able to leave to spawn area before the setup time has passed. Make a brush (texture: no_draw), filling the doorway and slightly overlapping the door.

    Tie the brush to the entity func_door:

    Name: blue_spawn_door_func
    Render Mode: Don't Render
    Speed: 500
    Delay Before Reset (-1 stay): -1
    Move Direction: Up

    [​IMG]

    At the picture, the blue_spawn_door_prop is selected. You can see the blue_spawn_door_func in the doorway.

    Now we have to make sure the door is opened when the setup time has passed.

    Add a new output for the team_round_timer:

    My output named: OnSetupFinished
    Target entities named: blue_spawn_door_func
    Via this input: Open
    After a delay in seconds of: 0 (Click Apply)

    Now the blue_spawn_door_func has to really open the door:

    My output named: OnOpen
    Target entities named: blue_spawn_door_prop
    Via this input: SetAnimation
    With a parameter override of: open
    After a delay in seconds of: 0 (Click Apply)

    The door is working now, but not complete. So, for more info on doors – for instance keeping the other team out – I advice to read [TUTORIAL] A Beginner's Guide:The Spawn Room.

    Last thing to add to this map are the letters of the CPs to the Cap Layout on the HUD, so the players instantly will see which CP is being capped.
    Open the properties of the team_control_point. Scroll down and add:
    3)The team_control_point:
    Name: control_point_a
    HUD overlay neutral: icon_obj_a (Tip: filter on 'icon' in the Texture browser)
    HUD overlay RED : icon_obj_a
    HUD overlay BLUE: icon_obj_a

    This will add a small 'A' in the upper right corner of the HUD icon representating CP A. For B and C, same thing, only choose the appropriate icon of course.


    That is it for now. Should the need arise, I'll change and/or add things. For now: Happy mapping!
     
    • Thanks Thanks x 10
    Last edited: Apr 16, 2008
  3. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    It takes some time, but it is rewarding, having your own written reference. Now lets hope I finish my contest map in time :)
     
  4. Vander

    Vander L8: Fancy Shmancy Member

    Messages:
    507
    Positive Ratings:
    110
    Thanks for the tut! Gravelpit style maps are my favorite.
     
  5. Termaximus

    Termaximus L5: Dapper Member

    Messages:
    229
    Positive Ratings:
    32
    Nice tut. Will be using this for my next map once I finish my contest map of course.
     
  6. YM

    aa YM LVL100 YM

    Messages:
    7,099
    Positive Ratings:
    5,739
    *Craves some screenshots of those outputs* (don't remove the text though!)
     
  7. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    hum... they were there! My Apache seems to be down.
    I'm trying to get Subversion working on my home server and apparently it has broken Apache...

    EDIT: its working again... but found some disturbing thing in the error.log
    Code:
    [Tue Mar 11 20:18:30 2008] [notice] caught SIGTERM, shutting down
     
  8. NightHawK

    NightHawK L3: Member

    Messages:
    107
    Positive Ratings:
    38
    This helps me alot :D
     
  9. MrSinistar

    MrSinistar L2: Junior Member

    Messages:
    82
    Positive Ratings:
    6
    Thanks a million for this tutorial, man. I understand control points a lot more now. :D
     
  10. Paria

    Paria L5: Dapper Member

    Messages:
    202
    Positive Ratings:
    31
    just ran through this on a test map, very nice tutorial to follow.

    1 thing i would add to the tutorial if you are trying to acheive the A / B / C gravel pit format is to add to the

    team_control_point

    keyvalues

    HUD overlay Blue - sprites/obj_icons/icons_obj_a (b or c)
    HUD overlay Red - sprites/obj_icons/icons_obj_a (b or c)

    This will give you the letters A /B /C on the actual hud squares.
     
    Last edited: Apr 13, 2008
  11. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    Yeah, thnx! That is indeed a valuable addition. Not much, but certainly needed for the Gravel pit experience :)

    Added:

    part 3: note on maximum of 8 CPs
    part 4: HUD indicators A, B, C (thnx Paria)
     
  12. Nightshde

    Nightshde L1: Registered

    Messages:
    4
    Positive Ratings:
    0
    Good tutorial, deff helped with the issue i was having with the instant win. Though I dont really see the point of part 3 because you wanted to have only one point unlock the last one then you can just set it in the previous required point.
     
  13. ShroudedSiege

    ShroudedSiege L1: Registered

    Messages:
    27
    Positive Ratings:
    6
    Looks like a bloody long tutorial but i am new to mapping for TF2 so i want to learn all i can as it will help me in the future. Thanks for sharing! :)
     
  14. hanapa'a

    hanapa'a L1: Registered

    Messages:
    4
    Positive Ratings:
    0
    :confused:

    Having difficulty with the setup time. Not so much the timer, but it seems I can't lock my Blue spawn doors. In my many test runs, I can capture the point during the setup time. Probably not good if Red team is to mount some sort of defense.

    I tried putting the Outputs in the func_door brush, am I missing something somwhere else? (BTW I have gone through the basic spawn room tutorial already). I can make a working map except for the setup time issue. HELP!
     
  15. Nineaxis

    aa Nineaxis Quack Doctor

    Messages:
    1,767
    Positive Ratings:
    1,403
    Sounds like you might need to uncheck the "Touch Opens" flag on the flags tab.
     
  16. ChronoTriggerFan

    ChronoTriggerFan L7: Fancy Member

    Messages:
    435
    Positive Ratings:
    72
    Meh, seeing as the thread is unburied, I'd like to note that there needs to be information in the tutorial on how to lock Cap A and Cap B when they got captured. Its a simple setup by having the team_capture_point send an output:

    OnCapTeam2 | SetTeamCanCap | 2 0


    As I found with tributary, Having red recap the point is not so fun in gravelpit style.
     
  17. hanapa'a

    hanapa'a L1: Registered

    Messages:
    4
    Positive Ratings:
    0
    Setup Time Dilemma

    Nope, unchecked, I'm assuming you're talking about the func_door flags tab. I have a feeling its something regarding the func_door brush, but still can't pinpoint it. I've followed everything in the tutorial. I'm wondering if I've left something unchecked/checked besides the flags. Flags are empty BTW.

    Hmmmm...:confused:
     
  18. L. Joshua

    L. Joshua L1: Registered

    Messages:
    3
    Positive Ratings:
    0
    Very helpful tutorial I finally figured out what was going on with my CP's. Thank you sir.
     
  19. MacNetron

    MacNetron L5: Dapper Member

    Messages:
    203
    Positive Ratings:
    47
    Ahhh, my guess would be that you are using a normal door with a trigger. In that case you can indeed open the door on setup time (just like a normal door).
    Try disable the trigger at start and have it enabled with an addition OnSetupFinished output in the team_round_timer.
     
  20. mug

    mug L1: Registered

    Messages:
    23
    Positive Ratings:
    9
    Ran into a problem with GP cps after setting them up as this tut explains.
    After blu had capped B, red could not block the capture of A. This puzzled and annoyed me.
    To fix this i tried adding Red Previous Required Point 1: control_point_a to A
    This did not fix the problem
    To fix this you need to add Red Previous Required Point 1: control_point_a(itself) to A & Red Previous Required Point 1: control_point_b(itself) to B
    Strange as it is that Red Previous Required Point 1: control_point_b to B fixes A it works.
    Thought it was worth adding to this tut for anyone else having this problem
    Thanks to A Boojum Snark for helping me figure this out