[TUTORIAL] KOTH as Valve does it

shadowfax

L1: Registered
Jul 23, 2009
28
85
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:
koth_team_control_point_master.jpg

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
koth_prop_dynamic.jpg

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
koth_team_control_point.jpg

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.
koth_trigger_capture_area_1.jpg

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:
koth_trigger_capture_area_2.jpg

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:
koth_tf_logic_koth_1.jpg


You will need to add each key and value manually. Click the Add button:
koth_tf_logic_koth_2.jpg

Enter the following:
koth_tf_logic_koth_3.jpg

Key: targetname
Value: tf_logic_koth
And click OK.

We will do the same thing for two more keys:
koth_tf_logic_koth_4.jpg

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.

koth_tf_logic_koth_5.jpg

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:
koth_tf_logic_koth_6.jpg


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.
koth_logic_auto.jpg

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.
koth_shadowfax_example0001.jpg

Attached is the .vmf and .bsp of this example level.
 
Last edited:

The_Ulf

L6: Sharp Member
May 26, 2009
399
115
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
 

Malcolm

L3: Member
Jul 10, 2008
123
25
As I can see, the game mechanics are quite flexible through the entities... maybe a "king of the payload" would be nice :D
 
Jan 31, 2008
555
1,482
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.

I have been using a tf_gamerules entity in cp_glacier for 22 alphas, 2 betas and one release candidate.
 

Psy

The Imp Queen
aa
Apr 9, 2008
1,706
1,491
I got mine working by simply copying and pasting all the neccesary stuff from Viaduct including the gamerules.
 

shadowfax

L1: Registered
Jul 23, 2009
28
85
I have been using a tf_gamerules entity in cp_glacier for 22 alphas, 2 betas and one release candidate.

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:

shadowfax

L1: Registered
Jul 23, 2009
28
85
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.
 

Eternal

L69: Deviant Member
Jul 8, 2009
69
10
TF2 hates displacement power 4, i hope you are not using this.

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.