player count in area

Pacifist

L1: Registered
May 28, 2010
12
0
Hi Guys. I have a problem I am trying to work through.

I have a map, in a area of the map I want to allow only a certain amount of player from a team. Extra players will trigger a hurt that will last till the numbers go down.

lets say. 3 players

In this area, 1, 2, and 3 players will be fine.

if the number goes to 4 or higher, every in that area takes damage until someone dies to reduce it 3 or lower, or leaves the area.

Can you guys help me out.

*S*
 

Bermuda Cake

L9: Fashionable Member
Feb 20, 2009
679
480
I think I know how you can count up to four people, but killing only one person might be harder...

The way I would do it, would be to have a trigger_multiple in your room, as well as a math_counter. You're gonna want to double click on the math_counter, give it a name like player_counter, and then define Case01 as 4.
Then, go to each trigger_multiple, and have an ouput, OnStartTouchAll, player_counter, Add.

That'll add one to the counter each time someone stands in it (but it does mean people will be able to trip it more than once if they leave and re-enter). Then, double click on the math_counter, and have an output, OnCase01, and that's where this falls down. There's no way to only kill some people and keep others alive, unfortunately.

There are work arounds that don't need to kill people, though. You could spawn three people only in the room, and then disable the spawn points after they've spawned, or have a door into the room that only opens three times. People usually find a way around that sort of thing though...
 

Pacifist

L1: Registered
May 28, 2010
12
0
Never mind I figured it out.

Trigger_multiple with filter for red team.
on start touch math counter add 1
on end touch math counter subract 1

math counter
outvalue to logic-case invalue

logic case on 0 set hurt damage value 0
on case on 1 same thing
on case on 2 same thing
on case of 3 same
on case 4 set hurt value to 10

as soon as one dies the math counter re triggers and resets the case for the logic to turn off the hurt.

The reason I need this is I am making a map that will allow people to spectate in the "bleachers" while a certain number of players on each team battle in the main area.

If someone tries to sneak onto the court, the team with the extra player takes damage until one dies or they get the noob off the court.

LOL i love it.
 
Last edited:

Dr Forrester

L2: Junior Member
Aug 15, 2008
60
23
ah... was wondering what you were going for there...

was going to suggest the exact same solution you came up with yourself, but got stuck doing server admin stuff.

Hmmm.... I might just use this for something else...:lol:
 

Pacifist

L1: Registered
May 28, 2010
12
0
hmmm you know a trigger multiple can be confused. say you get many people at the same time in there, or before it can re trigger. Is there another trigger that can be used that can thse jsut set the value to the math counter instead of add subtract.
 
Mar 23, 2010
1,872
1,696
that would make a cool special infected in L4D2 to get you to spread out......
 

Pacifist

L1: Registered
May 28, 2010
12
0
well I am going to stick with trigger_mutiple, though I do not like only add , subtract, instead of keeping an accurate account. I was hoping capture area might work, but Its a bit complicated for that.
 

Pacifist

L1: Registered
May 28, 2010
12
0
thanks guys. The problem with game zone player, is it counts the dead players as well. I can't have corpses being counted, it would slow the flow of people getting on the court. As for trigger multiple, it has a problem with teleporting off, it does not count you as leaving. I found a way to correct that. Kill and respawn the math counter on resets.

But the problem is fully solved. Thanks for the help. :)