PDA

View Full Version : Playercounter


bobop
02-03-2009, 07:50 AM
I am not having any trouble with anything this is just to help people with creating a counter for players which can be filtered as well.

You need these entities and this amount
1 game_zone
1 trigger_multiple
1 math_count
1 other entitie

First you need to make a brush with the texture trigger
2nd you need to make the brush into a entitie (ctrl + t) called game_zone (name it as well) (or something like that)
3rd make a trigger brush entitie called trigger_multiple
4th make a output to the game_zone from the trigger_multiple (onstarttouch)
5th Make a math_counter for the player amount you want if you want it to count more then one count for players make another math_count
6th make a output from the game_zone to the math_count (playercounted (or something like that))
7th make a output from the math_count to the finnal thing you want done.


Here is the example: http://files.filefront.com/filter+playercounter+casesvmf/;13190611;/fileinfo.html

Jonny
02-03-2009, 08:40 AM
OK, and how do you differ humans & zombies?

bobop
02-03-2009, 08:59 AM
OK, and how do you differ humans & zombies?

with team filter you want the trigger_multiple to have the filter because thats what counts the players.

Jonny
02-03-2009, 09:55 AM
Something is wrong in your script construction. There is no "game_zone" entity in HL2. I think you mean the "game_zone_player".

And as it is at the moment, you can't filter out the zombie player. Because if a zombie player is inside the game_zone_player brush and a human player is "OnStartTouch" the trigger_multiple, the game_zone_player entity will count "2 player" inside his brush.

bobop
02-03-2009, 11:31 AM
Something is wrong in your script construction. There is no "game_zone" entity in HL2. I think you mean the "game_zone_player".

And as it is at the moment, you can't filter out the zombie player. Because if a zombie player is inside the game_zone_player brush and a human player is "OnStartTouch" the trigger_multiple, the game_zone_player entity will count "2 player" inside his brush.

I said something like that and you can filter zombies out. You do not have anyone inside the the game_zone_player you want it where players can not get to because thats what the trigger_multiple is for if you have it count players in side the game_zone_player.

I am making a example now it will be done in like a few min.

Jonny
02-03-2009, 12:21 PM
Hmmm ... I'm totaly confused. :huh:

When no one can stand inside the "game_zone_player", for what do you need that entity? In this case the trigger_mutiple should directly add his information to the math_counter. The result should be the same.

bobop
02-03-2009, 12:31 PM
Hmmm ... I'm totaly confused. :huh:

When no one can stand inside the "game_zone_player", for what do you need that entity? In this case the trigger_mutiple should directly add his information to the math_counter. The result should be the same.

Eh I guess u do not need it but you can use it I use it. I think it adds a better result though not sure but yeah.

Jonny
02-03-2009, 12:55 PM
Narrrffff :mad: ... can't download the file. Evil filefront.com and my browser don't harmonize. :dry:

But the point of all my posts is: I think, that this kind of counter will not work exactly. When several player run around and touch, do not touch and touch again, the counter will output incorrect results. (Thats my experience.)

Wazanator
02-03-2009, 01:05 PM
Thanks bobop been trying to figure this out :)

zerotonothing
02-03-2009, 01:13 PM
Mine is less complicated, but doesn't give as many features. Although it does achieve outputs based on how many player have spawned, which is all I really want for gun spawning system.

My way is having trigger_onces's under each human spawn which add 1 point to a counter so:

OnTrigger > Counter > Add > 1

Then say I wanted to do something special once there are 10 players (delete or spawn guns maybe?). Have the "Maximum Legal Value" on the counter set to 10 and:

OnHitMax > Gun_teleportor > Teleport

This is all off the top of my head, but shouldn’t that make half a gun spawning system which can’t be screwed with by re-touching the triggers (as they are all trigger_onces)??

If you wanted to delete maybe some powerful guns once there are over 20 players, add another counter WITH the same name and set it's "Maximum Legal Value" to 20 and:

OnHitMax > PowerfulGuns > Kill

edit:

I just realized that for every spawn point which does not spawn a human, will leave its trigger_once still active for a player to accidentally stumble into. For this, make a timer which kills every trigger_once after say 30 seconds...

bobop
02-03-2009, 04:18 PM
Mine is less complicated, but doesn't give as many features. Although it does achieve outputs based on how many player have spawned, which is all I really want for gun spawning system.

My way is having trigger_onces's under each human spawn which add 1 point to a counter so:

OnTrigger > Counter > Add > 1

Then say I wanted to do something special once there are 10 players (delete or spawn guns maybe?). Have the "Maximum Legal Value" on the counter set to 10 and:

OnHitMax > Gun_teleportor > Teleport

This is all off the top of my head, but shouldn’t that make half a gun spawning system which can’t be screwed with by re-touching the triggers (as they are all trigger_onces)??

If you wanted to delete maybe some powerful guns once there are over 20 players, add another counter WITH the same name and set it's "Maximum Legal Value" to 20 and:

OnHitMax > PowerfulGuns > Kill

edit:

I just realized that for every spawn point which does not spawn a human, will leave its trigger_once still active for a player to accidentally stumble into. For this, make a timer which kills every trigger_once after say 30 seconds...
this would not work past one player because only one player can touche it.

bobop
02-03-2009, 04:19 PM
Narrrffff :mad: ... can't download the file. Evil filefront.com and my browser don't harmonize. :dry:

But the point of all my posts is: I think, that this kind of counter will not work exactly. When several player run around and touch, do not touch and touch again, the counter will output incorrect results. (Thats my experience.)

Um this does not happen I already have it in one of my maps and we have tested it all the way through and if you cover the hole playing area with the trigger_multiple it will work correctly if you did do it the way I told you I am not sure about the way you said.

Also if you set it up right where the counter stops counting for a time between the time the first person joins and goes human ( putting a trigger_once that activates the trigger_multiple) it should work correctly and then about 45 seconds later you will want the counting to stop but the touching of players should not effect it at all.

zerotonothing
02-03-2009, 08:53 PM
this would not work past one player because only one player can touche it.

You have one trigger for every spawn, so every player is counted...

bobop
02-04-2009, 07:37 AM
You have one trigger for every spawn, so every player is counted...

That could work but there is a problem with people spawning at the same spawn.

zerotonothing
02-04-2009, 11:24 AM
Oh I thought each spawn was only used once?

How about in the lobby room you have 20 or so trigger_once's, which cover the whole room and are all disabled except one. They are named trigger1, trigger2, etc...

The outputs on that one which is enabled is:

OnTrigger > trigger2 > enable
OnTrigger > counter > Add > 1

Then for trigger2 you have:

OnTrigger > trigger3 > enable
OnTrigger > counter > Add > 1

And so on...

Would that work?

bobop
02-06-2009, 09:09 AM
Oh I thought each spawn was only used once?

How about in the lobby room you have 20 or so trigger_once's, which cover the whole room and are all disabled except one. They are named trigger1, trigger2, etc...

The outputs on that one which is enabled is:

OnTrigger > trigger2 > enable
OnTrigger > counter > Add > 1

Then for trigger2 you have:

OnTrigger > trigger3 > enable
OnTrigger > counter > Add > 1

And so on...

Would that work?

Yeah you just to have to state that the player counter will only count up to 20 people which could still be used because most servers are about 20 . So yeah that should work. if the commons are registered as players.

bobop
02-12-2009, 09:21 AM
Eh found another way in doing this have a spawn zone where all the players spawn in black boxes and put thosse black boxes out side the playing area then have each black box a teleport to a spawn then put a trigger push in them make about 30 black boxes 30 teleport destinations and 30 teleports.

Have the player counter count all the players while they are in the black boxes have the zombies not spawn in black boxes because it is pointless counting the zombies unless you want a zombie counter which then you would want a seprate player counter for them.