Tracking Control Point Ownership

Asimuth

L1: Registered
Mar 23, 2023
1
0
Hello!
I have a map in which there are 7 control points (all neutral by default), and it's supposed to work in a way that when a team captures all 7, the other team's base barrier is lowered. Tracking which teams owns the control points is a bit tricky. My first naive implementation was having a math_counter, for both teams that tracked the amount of cps they owned. Removing one point from the other team's math_counter and adding another to their own. Now this system breaks the moment the second capture point is acquired by a team, because let's say Blu owns a control point, their math_counter is at 1. Red captures a neutral point and now it's back to zero. Other idea was okay not removing any points, but making a capture raise your own team's barrier.- this resulted in barriers being always down after 7 total captures somehow, now admittedly it's a very real possibility i just messed something up and one of these should work somehow, but i felt it's time to ask for some help.

Sorry if i left any important thing out!
 

Tiftid

the Embodiment of Scarlet Devil
aa
Sep 10, 2016
602
465
What you could do is have a math_counter for each point that stores the numerical value of its owner - 0 for nobody, 1 for red, 2 for blu.
This could be achieved with a simple "OnCapTeam 1 SetValue 1" and "OnCapTeam2 SetValue 2" set of outputs from the associated control point.

Each of those math_counters has an OnGetValue output that fires Add (with no parameter override; it will use the value of the counter if you don't override it) to an 8th math_counter.
Each trigger_capture has an OnCapture output that fires GetValue to the 7 math_counters.
It also fires GetValue to the 8th math_counter after a slight delay.

The 8th math_counter has an OnGetValue output to SetValueCompare to a logic_compare.
This logic_compare has a compare value of 7.
It has an OnEqualTo output that lowers the blu base gate.
It has OnLessThan and OnGreater than outputs that fire SetValueCompare to a 2nd logic_compare.

The 2nd logic compare has a compare value of 14.
It has an OnEqualTo output that lowers the red base gate.

If you want the gates to raise again when a team captures a control point, you could give the 1st logic_compare OnLessThan and OnGreaterThan outputs to raise the blu base gate, and the 2nd logic_compare OnLessThan and OnGreaterThan outputs to raise the red base gate.

There's probably a more efficient way to do this.
 
Last edited: