Capture points: counting how many points a team has?

hacky

L2: Junior Member
Dec 13, 2007
83
0
I'm working on a test version of a CP map layout I'd like to implement. The basic idea is this:
- 7 control points (two default to each team, 3 neutral)
- 10 minute round timer: round ends after timer expires
- The team with the most CP's controlled after 10 minutes wins. (or takes all 7 CPs for immediate win)

Since this is far, far more complicated than the easy peasy CTF setup I used for truss (rofl), I have some questions that I wasn't able to answer on my own.

I'm thinking about using two math_counter entities for each team, starting them at 2 and incrementing/decrementing them when a team takes/loses a point. Adding a point when a team takes a point is easy, I can add 1 when OnCapTeam1/2 fires. But how do I know if that point was originally a neutral point (in which case red does not lose a point) or if red previously owned the point (in which case red loses a point).
There's an OnBreakTeam1/2 output, but I believe that's when blue walks off the CP and stops capping halfway...but I haven't tested it.

My second question relates to team scoring: I want the team's score when the round ends to reflect the number of CPs owned. For example, if after 10 minutes blue has 5 CPs and red 2 CPs, the score at the end of the round would update to be blue 5, red 2 (or perhaps even blue 6, getting an extra point for a round win). How do I manually update a team's score?
 

phatal

L6: Sharp Member
Jan 8, 2008
259
21
You could make use of:
Code:
OnOwnerChangedToTeam1 
Sent when owner is changed to RED. 
OnOwnerChangedToTeam2 
Sent when owner is changed to BLU.
 

MacBeth [O.C.Reg]

L1: Registered
Jan 13, 2008
8
2
For question 1: my soon-to-be-released map does that - amongst other things. There's a counter for each team that stores how many points they have. Inputting to the blue counter entity there's an OnCapTeam2 -> Add 1 and an OnOwnerChangedToTeam1 -> Subtract 1 for each capture point, and vice versa for the red counter entity. That should cover it.

For question 2... haven't got time to investigate it right now but I'm pretty sure it's possible. My map gives you two points a win if you have capped all the surrounding points when you cap the main central point, so you can definitely feed extra points in to the victory conditions. I'll get back to you ;-)
 

hacky

L2: Junior Member
Dec 13, 2007
83
0
Here's the problem for my first question: When BLU captures a neutral point, blue gains a point but red does not lose a point. But when BLU captures a RED point, blue gains a point and red loses a point. None of the outputs for capture area can differentiate between the two.

Now here's what I'm wondering: do OnOwnerChangedToTeam1/2 fire if a capture point was neutral? If so, I can't use it. An output that was OnOwnerChangedFromTeam1/2 would be useful but it doesn't exist.

What I did to solve the problem was create two logic_relay's for each of the CPs that start neutral, one for each team. They are initially disabled, and when triggered subtract a point from the appropriate team. On a capture, for example, BLU caps a neutral point, first blue gets +1 point, then the logic_relay for red is fired. But that relay is disabled, so it doesn't occur. Then (after a short delay), both of the relays for that point are enabled so that future captures subtract -1 point as normal.

But I still don't know how to add additional points to team score. I have it so that the current score is accurately kept and the appropriate team wins when time runs out (or stalemates if it's a tie), so it's only now a matter of figuring out what changes team score.
 

hacky

L2: Junior Member
Dec 13, 2007
83
0
Here's something really interesting I just found.

In the current version of cp_dustbowl, I noticed that the team_control_point_master entity has the following keyvalues:
play_all_rounds 1
score_style 1

I'm assuming they have something to do with the scoring update for dustbowl: play_all_rounds 1 should make a map run all rounds of a multi-round CP map before switching maps, and score_style 1 should make each CP capture give a point.

I'm going to experiment with score_style and see what else it could be set to. Sadly, it doesn't look like it will help me control a team's score directly.
 

hacky

L2: Junior Member
Dec 13, 2007
83
0
I got it working. :)

http://tf2maps.net/showthread.php?t=569

There's still a few kinks to work out in the map, so I'll continue the discussion with these problems:
- Every control point warns that it is "the final control point". I'm sure I can fix this by making a proper CP layout that includes a final control point, but is there any way to make the control point warnings make sense with the current layout? (i.e. each point is NOT the final control point, unless it actually is the last point)

- If a team wins by capturing all control points, the score is not updated immediately. The popup ("Blue/Red Team Wins!") shows the score is 1-0 but viewing the score screen actually shows the score 8-0. I want the score to be 7-0 already when the map screen comes up, so the +1 point is clearly differentiated from the 7 from owning CP's. The other possibility is to make the round not end immediately when a team captures every CP, but the team_control_point_master doesn't have a documented value that prevents this. (the keyvalue "Prevent Team From Winning" only has the values Neither, Red, and Blue... no value to stop both teams from winning)
 

MacBeth [O.C.Reg]

L1: Registered
Jan 13, 2008
8
2
Replied in your other tutorial thread too.

I'm pretty sure OnOwnerChangedToTeam1/2 doesn't fire if a capture point started neutral... did you find that it did? I have counters for each team that trigger certain events if a team captures all four points that start off neutral. I think they keep track correctly - need to check at home.
 

hacky

L2: Junior Member
Dec 13, 2007
83
0
MacBeth [O.C.Reg];4081 said:
I'm pretty sure OnOwnerChangedToTeam1/2 doesn't fire if a capture point started neutral... did you find that it did?

I actually never tried it, I tried the logic_relay enable method first and it worked, and I didn't really want to break something that already works. :)

OnOwnerChangedToTeam1/2 would be easier, yes. See if they work.
 

phatal

L6: Sharp Member
Jan 8, 2008
259
21
MacBeth [O.C.Reg];4081 said:
Replied in your other tutorial thread too.

I'm pretty sure OnOwnerChangedToTeam1/2 doesn't fire if a capture point started neutral... did you find that it did? I have counters for each team that trigger certain events if a team captures all four points that start off neutral. I think they keep track correctly - need to check at home.

I seriously doubt it would fire on a neutral to team change. There's no initial team that it changes from.