[TUTORIAL] KOTH as Valve does it

Discussion in 'Tutorials & Resources' started by shadowfax, Aug 14, 2009.

  1. shadowfax

    shadowfax L1: Registered

    Messages:
    28
    Positive Ratings:
    43
    This is my first tutorial. Let me know if there are any ways to improve it.

    Enities you need:
    team_control_point_master
    team_control_point
    prop_dynamic
    logic_auto
    trigger_capture_area
    tf_logic_koth

    I am going to assume you know the basics of building the level and how to set up a basic control point.

    Here we will examine how to set up the entities to create KOTH style.

    First setup the control point area. For this you need:
    team_control_point_master
    team_control_point
    prop_dynamic
    trigger_capture_area

    Place the team_control_point_master anywhere you like. Give it a name and set it as follows:
    [​IMG]
    Name: master_control_point (Or what ever you like)
    Restrict team from winning: Neither
    Switch teams on map win?: No
    Scoring style: Add team score for each round

    Place the prop_dynamic as follows
    [​IMG]
    The important things are:
    World Model: cap_point_base.mdl
    Name: prop_cap_1 (You can call this what ever you want but I will refer to it by that name)
    Skin: 0

    Place the team_control_point above the pro_dynamic as with any control point
    [​IMG]
    The important things are:
    Name: control_point_1 (You can call this what ever you want. I will refer to it by this name)
    Print Name: koth_example_cap (This is the name that is printed on the HUD when someone captures the point. Call it whatever you like)

    Then place the trigger_capture_area around the control point.
    [​IMG]
    Once again the important things here are:
    Name: capture_area_1 (You can call this what you like)
    Control Point: control_point_1 (This needs to be the same as the name for the team_control_point)
    Can RED Cap?: Yes
    Can BLUE Cap: Yes

    These can be adjusted as you see fit but for official Valve koth maps they are as follows:
    Number of RED players to cap: 2
    Number of BLUE players to cap: 2
    Red Spawn Adjust: 0
    Blue SPawn Adjust: 0
    Time to cap (sec): 6

    Now we need to set the outputs for this entity:
    [​IMG]
    First the normal outputs to set the skin of the prop_dynamic:
    Format:
    My Output named | Target Entity | Target Input | Parameter | Delay
    OnCapTeam1 | prop_cap_1 | Skin | 1 | 0.00
    OnCapTeam2 | prop_cap_1 | Skin | 2 | 0.00

    Those should seem familiar now for the koth specific ones. These will show up as broken in hammer. This is because the tf_gamerules entity will not be placed. If the tf_gamerules entity is placed it causes the game to crash.

    EDIT: People are reporting that they have been able to place the tf_gamerules entity without it causing a crash. You can place the tf_gamerules entity anywhere.
    Set its Name to tf_gamerules and this will fix the broken input/outputs in hammer. This is not necessary as it works without the tf_gamerules enity but if you prefer to not have hammer report broken place the entity. However, TF2 crashed for me when I had the tf_gamerules entity placed in the map. So if you experience a crash like I did remove the tf_gamerules entity and just let the broken I/Os remain.


    These values are how Valve maps are set. You can alter the Parameter for the RespawnWaveTime input to be what ever you like.
    Format:
    My Output named | Target Entity | Target Input | Parameter | Delay
    OnCapTeam1 | tf_gamerules | SetBlueTeamRespawnWaveTime | 4 | 0.00
    OnCapTeam1 | tf_gamerules | SetRedTeamRespawnWaveTime | 8 | 0.00
    OnCapTeam1 | tf_gamerules | SetRedKothClockActive | | 0.00
    OnCapTeam2 | tf_gamerules | SetRedTeamRespawnWaveTime | 4 | 0.00
    OnCapTeam2 | tf_gamerules | SetBlueTeamRespawnWaveTime | 8 | 0.00
    OnCapTeam2 | tf_gamerules | SetBlueKothClockActive | | 0.00

    Ok. Now the point is setup. Now place a tf_logic_koth entity anywhere in the map. Currently you can not select this entiy from the drop down box with the entity tool. Instead you must copy another point entity (for example you team_control_point_master). Then edit its properties. In the class field type "tf_logic_koth" then press enter. You should have as follows:
    [​IMG]

    You will need to add each key and value manually. Click the Add button:
    [​IMG]
    Enter the following:
    [​IMG]
    Key: targetname
    Value: tf_logic_koth
    And click OK.

    We will do the same thing for two more keys:
    [​IMG]
    Key: timer_length
    Value: 180

    The timer_length key is how long a team must hold the point (or "hill") until they win. This is in seconds so the value of 180 is 3 minuets which is Valves standard. You can change this value to whatever you see fit.

    [​IMG]
    Key: unlock_point
    Value: 30

    This is the amount of time (also in seconds). Until the point is unlocked. Valve provides 30 seconds of battle before the point becomes available to be captured. You can change this to whatever you like.

    You should now have as follows:
    [​IMG]

    Now for the last part. Setting up the logic_auto to initialize the game. This handles setting the initial spawn times and displaying the Goal strings.

    Place the logic_auto wherever you like. Leave the Class Info tab as it is and go to the Outputs tab.
    [​IMG]
    Once again these will show as broken in hammer but they need to be that way:
    Format:
    My Output named | Target Entity | Target Input | Parameter | Delay
    OnMapSpawn | tf_gamerules | SetBlueTeamGoalString | #koth_setup_goal | 0.00
    OnMapSpawn | tf_gamerules | SetRedTeamGoalString | #koth_setup_goal | 0.00
    OnMapSpawn | tf_gamerules | SetRedTeamRespawnWaveTime | 6 | 0.00
    OnMapSpawn | tf_gamerules | SetBlueTeamRespawnWaveTime | 6 | 0.00

    Thats it. You now have a working koth style map done the official way.
    [​IMG]
    Attached is the .vmf and .bsp of this example level.
     
    • Thanks Thanks x 39
    • Agree Agree x 1
    Last edited: Aug 14, 2009
  2. The Political Gamer

    aa The Political Gamer

    Messages:
    4,468
    Positive Ratings:
    1,682
    Thanks, I will use this till ABS is done updating his stuff.
     
  3. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    We now have 2 team clock :) drool.

    Thanks for the tut btw shadowfax. I haven't got a chance to work through it yet but it looks great. Nice having pics of all the entitiy set-ups.
     
  4. The_Ulf

    The_Ulf L6: Sharp Member

    Messages:
    399
    Positive Ratings:
    112
    Solid tutorial, yo!

    Hopefully Valve will actually update the SDK to expose all those entities and new values - tho I think ABS will certainly beat them to it. ;D
     
  5. Icarus

    aa Icarus

    Messages:
    2,246
    Positive Ratings:
    1,181
    Wrong
     
    • Thanks Thanks x 1
  6. Malcolm

    Malcolm L3: Member

    Messages:
    123
    Positive Ratings:
    25
    As I can see, the game mechanics are quite flexible through the entities... maybe a "king of the payload" would be nice :D
     
  7. shadowfax

    shadowfax L1: Registered

    Messages:
    28
    Positive Ratings:
    43
    Hmm. Well when I was testing this out, I originally had the tf_gamerules in the map. And it caused a crash. Someone else try it and I'll try it again later. If people can get it to work with tf_gamerules in the map I'll edit it to say so.
     
  8. Acegikmo

    aa Acegikmo

    Messages:
    555
    Positive Ratings:
    489
    I have been using a tf_gamerules entity in cp_glacier for 22 alphas, 2 betas and one release candidate.
     
    • Thanks Thanks x 1
  9. Psy

    aa Psy The Imp Queen

    Messages:
    1,705
    Positive Ratings:
    1,465
    I got mine working by simply copying and pasting all the neccesary stuff from Viaduct including the gamerules.
     
  10. shadowfax

    shadowfax L1: Registered

    Messages:
    28
    Positive Ratings:
    43
    Yeah I know it works with the other gamemodes. That is why I originally left it in. But it crashed when using it for this. So someone test it out with koth and verify. Or wait until I have a chance later. Right now I'm not in a position to have my system crash so I don't want to risk it.

    Edit:
    I updated the tutorial stating that the tf_gamerules entity may be able to be placed. I will test it again with it in to see if it caused a crash for me again. Still it is not necessary for the gamemode to work so if you add it and it causes a crash you can always remove it.
     
    Last edited: Aug 14, 2009
  11. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    I added tf_gamerules entity and named it tf_gamerules so the IO connections wouldn't be bad.

    It crashes when I suicide or explode. It also refuses to load more than 1 bot.

    I took it out and that stopped.
     
  12. Icarus

    aa Icarus

    Messages:
    2,246
    Positive Ratings:
    1,181
    koth_waste works perfectly fine, I don't know what you guys messed up
     
  13. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    Yeah, I don't either. I simply added tf_gamerules. Can't add more than one bot and suicide crashes, remove it it works fine.

    That's the only thing that changed.

    Have you tried adding bots Icarus?
     
  14. Icarus

    aa Icarus

    Messages:
    2,246
    Positive Ratings:
    1,181
    not only that I've played a full test game on the US server, fully populated
     
  15. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    hmmm.

    I'm having issues crashing still due to self rocket splash damage on displacements which is odd. Thought it was the glass tex but also happens with bricks.

    Still doesn't explain the bot issue or crashes by using explode when tf_gamerules was present.
     
  16. grazr

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
    TF2 hates displacement power 4, i hope you are not using this.
     
  17. shadowfax

    shadowfax L1: Registered

    Messages:
    28
    Positive Ratings:
    43
    I tried it again with the tf_gamerules entity and this time it worked fine. I am not sure what the problem is but for now I am going to leave the tutorial as it is (stating that you can try either way). Really it doesn't matter. You don't need it in for the map to work. Adding it only fixes hammer reporting bad I/Os. So if you add it and there are no crashes then good. If you do have a crash just remove it and the game type still works.
     
  18. Eternal

    Eternal L69: Deviant Member

    Messages:
    69
    Positive Ratings:
    10
    It does? Most of my displacements on the map I'm working on have been power 4 and while I haven't set up any gamemode type logic yet (only triggers I have so far are for 2 resupply cabinets and 3 sliding doors that I copied and modified from ABS' library) I haven't had any crashes or collision issues, the only real issues I have had so far are one spot where sometimes I get stuck and can't move (even though Display Walkable says that location is fine) and the fact some displacements have really ugly looking seams.

    Thanks for the tip though, If I start getting some crashes then I'll look into displacements as one possible reason for it.
     
  19. Sgt Frag

    Sgt Frag L14: Epic Member

    Messages:
    1,443
    Positive Ratings:
    294
    My displacements were 3 but I've never had problems with 4 either.

    But to clear the record I think I had some bad brushes off the grid that must've caused the issues of crashing. I rebuilt and made sure everything was snapped.
    Deleted the entities and re-copy/pasted from the vmf and they work fine.
     
  20. Cameron:D

    Cameron:D L6: Sharp Member

    Messages:
    363
    Positive Ratings:
    146
    Thanks.
    I'm loving the attachment too.... an 8kb BSP :)