# Custom CP Gamemode Roadblock

#### MilkMaster72

aa
I'm trying to make a custom CP game mode, where you have 20 minutes to cap 5 CP's around the entire map. It's not like five CP though, wherein this you can cap any points at any time, and the map isn't in a line proceeding point after point. I want the round to last the full 20 minutes, and then whoever has the most points wins, but I cant get this to work. If Red or Blu team caps 3 out of 5 points and the other 2 are left uncaptured or for the opposing team, the round will conclude with a stalemate. Another issue is the round instantly ends once one team caps all points. I need the round to not end when all 5 capture points are capped, and I need it to not conclude with a stalemate, but to conclude with a win to the team that has the most captures, whether or not its all the points or the majority. Any help?

#### theatreTECHIE

##### Yet another Techie for the net...
aa
To prevent a team from winning when they cap all 5 points, you need to restrict both teams from winning in the team_control_point_master.

To make sure it isn’t a stalemate, the team_round_timer needs to set off a logic arrangement that will figure out who has the most control points, and then triggers one of three game round wins - one set to red, the second to blu and the third to stalemate (for the cases where both teams control the same number of points).
The easiest way to keep track of the number of capture points each team has is to use a math_counter, where it adds 1 for each point blu has and subtracts 1 for each point red has. If the number in the counter is negative at the end of the round, red wins, if it is positive, blu wins, and if it is 0 then a stalemate occurs.
I can explain later how to set up the counter logic if you need, but I need to do some other stuff for now.

#### MilkMaster72

aa
To prevent a team from winning when they cap all 5 points, you need to restrict both teams from winning in the team_control_point_master.

To make sure it isn’t a stalemate, the team_round_timer needs to set off a logic arrangement that will figure out who has the most control points, and then triggers one of three game round wins - one set to red, the second to blu and the third to stalemate (for the cases where both teams control the same number of points).
The easiest way to keep track of the number of capture points each team has is to use a math_counter, where it adds 1 for each point blu has and subtracts 1 for each point red has. If the number in the counter is negative at the end of the round, red wins, if it is positive, blu wins, and if it is 0 then a stalemate occurs.
I can explain later how to set up the counter logic if you need, but I need to do some other stuff for now.
I think I got some of the logic done, but since not all of its done could you tell me all the logic it needs when you can?

#### theatreTECHIE

##### Yet another Techie for the net...
aa
Let’s start with the main entities you’ll need.
First, all the basics:
- tf_gamerules (call this gamerules)
- logic_auto
- team_control_point_master
- team_round_timer
- game_round_win (3 of these needed, as explained in previous post, call the red one red_win, the blu one blu_win and the stalemate one stalemate)
- filter_activator_tfteam (you’ll need one for each team - generally I just use the ones in the ABS pack)

Next we need the entities that will keep track of how many points the teams have, and will output to the required game_round_win when the timer runs out.
- math_counter (call this counter)
- logic_compare (call this compare and set Initial Value and Compare Value both to 0)

And for each point, you’ll need:
- team_control_point (call this cap_X)
- trigger_capture_area
- prop_dynamic (cap_point_base model, call it cap_X_base)
- logic_relay (you’ll need two of these, explanation will come later. Call one cap_X_relay_red and the other cap_X_relay_blu)
Note: replace X with the number of the point, and make sure each team_control_point has a different index!

Set up all the properties of the basic entities and the control point entities as you would normally, but make sure that in the team_control_point_master you restrict both teams from winning.
You’ll also want to have the logic_auto to input into the tf_gamerules all of the usual things (note that you can change the goal string for each team to describe what they need to do in order to win).

In the outputs of the team_round_timer, add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnFinished | counter |GetValue |<none> |0.00 |No

Then in the math_counter add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnGetValue | compare |SetValueCompare |<none> |0.00 |No

And in the logic_compare add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnGreaterThan | blu_win |RoundWin |<none> |0.00 |No
|OnLessThan | red_win |RoundWin |<none> |0.00 |No
|OnEqualTo | stalemate |RoundWin |<none> |0.00 |No

This should take care of the end of round conditions, now just to make sure the the math_counter gets the right value at the end of the round.

In the output tab of each trigger_capture_area add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnCapTeam1 | counter |Subtract |1 |0.00 |No
|OnCapTeam2 | counter |Add |1 |0.00 |No
|OnCapTeam1 | cap_X_relay_red |Trigger |<none> |0.00 |No
|OnCapTeam2 | cap_X_relay_blu |Trigger |<none> |0.00 |No
|OnCapTeam1 | cap_X_relay* |Enable |<none> |1.00 |Yes
|OnCapTeam2 | cap_X_relay* |Enable |<none> |1.00 |Yes
Take note of the wildcards (* ) ad the delay in the last two outputs. Having them as only once won’t make a difference in terms of logic. Also replace the X with the point number.

In the outputs of each of the cap_X_relay_red entities add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnTrigger | counter |Subtract |1 |0.00 |No

And finally in the outputs of each of the cap_X_relay_blu entities add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnTrigger | counter |Add |1 |0.00 |No

The additional adds and subtracts from the relays will only happen once the point has been capped for the first time, as after the point changes teams, not only has the capping team gained a point from capping it, the other team has lost a point from losing it.

Let me know if there’s anything that isn’t working from these entities, and good luck in setting it all up.

Last edited:

#### MilkMaster72

aa
Let’s start with the main entities you’ll need.
First, all the basics:
- tf_gamerules (call this gamerules)
- logic_auto
- team_control_point_master
- team_round_timer
- game_round_win (3 of these needed, as explained in previous post, call the red one red_win, the blu one blu_win and the stalemate one stalemate)
- filter_activator_tfteam (you’ll need one for each team)

Next we need the entities that will keep track of how many points the teams have, and will output to the required game_round_win when the timer runs out.
- math_counter (call this counter)
- logic_compare (call this compare and set Initial Value and Compare Value both to 0)

And for each point, you’ll need:
- team_control_point (call this cap_X)
- trigger_capture_area
- prop_dynamic (cap_point_base model, call it cap_X_base)
- logic_auto (you’ll need two of these, explanation will come later. Call one cap_X_relay_red and the other cap_X_relay_blu)
Note: replace X with the number of the point, and make sure each team_control_point has a different index!

Set up all the properties of the basic entities and the control point entities as you would normally, but make sure that in the team_control_point_master you restrict both teams from winning.
You’ll also want to have the logic_auto to input into the tf_gamerules all of the usual things (note that you can change the goal string for each team to describe what they need to do in order to win).

In the outputs of the team_round_timer, add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnFinished | counter |GetValue |<none> |0.00 |No

Then in the math_counter add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnGetValue | compare |SetValueCompare |<none> |0.00 |No

And in the logic_compare add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnGreaterThan | blu_win |RoundWin |<none> |0.00 |No
|OnLessThan | red_win |RoundWin |<none> |0.00 |No
|OnEqualTo | stalemate |RoundWin |<none> |0.00 |No

This should take care of the end of round conditions, now just to make sure the the math_counter gets the right value at the end of the round.

In the output tab of each team_control_point add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnCapTeam1 | counter |Subtract |1 |0.00 |No
|OnCapTeam2 | counter |Add |1 |0.00 |No
|OnCapTeam1 | cap_X_relay_red |Trigger |<none> |0.00 |No
|OnCapTeam2 | cap_X_relay_blu |Trigger |<none> |0.00 |No
|OnCapTeam1 | cap_X_relay* |Enable |<none> |1.00 |Yes
|OnCapTeam2 | cap_X_relay* |Enable |<none> |1.00 |Yes
Take note of the wildcards (* ) ad the delay in the last two outputs. Having them as only once won’t make a difference in terms of logic. Also replace the X with the point number.

In the outputs of each of the cap_X_relay_red entities add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnTrigger | counter |Subtract |1 |0.00 |No

And finally in the outputs of each of the cap_X_relay_blu entities add:
| My Output | Target Entity | Target Input | Parameter | Delay | Only Once |OnTrigger | counter |Add |1 |0.00 |No

The additional adds and subtracts from the relays will only happen once the point has been capped for the first time, as after the point changes teams, not only has the capping team gained a point from capping it, the other team has lost a point from losing it.

Let me know if there’s anything that isn’t working from these entities, and good luck in setting it all up.
I am stuck at this part. - logic_auto (you’ll need two of these, explanation will come later. Call one cap_X_relay_red and the other cap_X_relay_blu)
How do I name one of these, the only tab there is is the global state to read tab?

#### theatreTECHIE

##### Yet another Techie for the net...
aa
Ah, I meant logic_relay, my bad. I edited the original post as well for future peeps.

#### MilkMaster72

aa
Ah, I meant logic_relay, my bad. I edited the original post as well for future peeps.
Im still having trouble with the control point. It always caps correctly, never locks and work fine, but at the end of the round it always ends in a stalemate. I did everything that it says on there, only changing one thing. Instead of red getting less than, blu gets less than. So its just swapped out on everything, but I would thing that wouldnt be an issue if its still set up to have red win if they have more points.

#### theatreTECHIE

##### Yet another Techie for the net...
aa
Do you have any other outputs from the team_round_timer?

#### MilkMaster72

aa
Do you have any other outputs from the team_round_timer?
Output: OnFinished
Entities: 5cp_master
Via Input: SetWinner

That's the only other output.

#### theatreTECHIE

##### Yet another Techie for the net...
aa
Delete that output, and hopefully it should work.

#### MilkMaster72

aa
Delete that output, and hopefully it should work.
I did and when the timer reached 0 it just stopped and no round end. After that I put the output back so it would work.

#### Egan

aa
Just a bit of design thought, if this is for standard gameplay you may want to set the max time to be 5-12 minutes long, since that is the standard time for a round in most maps. Going beyond that threshold starts to really grind on the players.

If you click on the map names within this site http://feedback.tf2maps.net/ and then on the map pages click this button you can see the times of the rounds for the maps.

#### theatreTECHIE

##### Yet another Techie for the net...
aa
Take a look at this vmf. I tested a bit of the logic, and all of the test cases I checked worked.
The only thing I haven't worked out is how to disable overtime from happening.

Also I definately agree with Egan. a 20 minute round does seem too long for this type of gamemode. Additionally, you may want the cap times to be fairly quick to encourage quick attacks.

#### Attachments

37.3 KB · Views: 59

#### MilkMaster72

aa
Take a look at this vmf. I tested a bit of the logic, and all of the test cases I checked worked.
The only thing I haven't worked out is how to disable overtime from happening.

Also I definately agree with Egan. a 20 minute round does seem too long for this type of gamemode. Additionally, you may want the cap times to be fairly quick to encourage quick attacks.
I think you ment to say the outputs in the team_control_point go in the trigger_capture_area, as thats what I mustve gotten wrong.

#### theatreTECHIE

##### Yet another Techie for the net...
aa
I think you ment to say the outputs in the team_control_point go in the trigger_capture_area, as thats what I mustve gotten wrong.
Yes, that was a mistake.

#### MilkMaster72

aa
Yes, that was a mistake.
Thanks for the help! If I ever post a map useing this I will credit you.