Counting people in an area

DeOntwerper

L1: Registered
Nov 20, 2013
46
1
Heya there,

I am just wondering if it would be possible to count the number of people in an area and to determine which team they are on.

Is this possible at all with brushes?
 

Egan

aa
Feb 14, 2010
1,375
1,720
Yeah this is possible with brushes using a trigger_multiple, also using a math_counter and filter entities for both teams (filter_activator_tfteam).

You can use a team-filtered trigger_multiple to:
OnStartTouch - blue_math_counter - Add - 1
OnEndTouch - blue_math_counter - Subtract - 1

This alone would allow you to track the two team's players in each trigger with a math_counter. If you want to activate things on certain numbers of players you can do so with a logic_case:

From the math_counter:
OutValue - logic_case - InValue - (no parameter override)

In a logic_case you would set up the case values to represent scenarios of values that you would pass into it. For instance you may want something to happen at zero, or at 5, or at 10, or anything in between:

H0oqnbl.png


From the outputs of the logic_case then you could do whatever you need to do, like change the message keyvalue of a game_text and then display it on-screen for each case, etc. If you reach the end of a logic_case's 16 cases you can use multiple logic_cases with the same name and then continue the numbers off on the others (like one LC holds the first 16, and a second LC with the same name* holds 17-32).