Jump to content
Sign in to follow this  
Alias001

Displaying unit count in a trigger area

Recommended Posts

Hey all

I'm working on a mission at the moment and I'm making extensive use of the probability of presence options to make the mission more replayable. Because of this, I'm a bit concerned that I might have put too many units down for the players to handle but without doing a fair bit of math, it's hard to guess roughly how many units the players are likely to be facing.

What I'd like to do is set up a simple trigger for the start of the mission that detects the presence of blufor units, counts how many blufor there are within the trigger radius then spits that out as a hint popup. I figure if I start the mission and get the numbers 20-25 times, it should give me a reasonable average.

I found several mentions of the count units command, usually in reference to checking if the number of units drops below a certain threshold. I presume this command would also be used for my situation but I can't quite figure out how to use it. Can anyone tell me what I need to do?

Cheers

Share this post


Link to post
Share on other sites

Never really used triggers but you can do that with the script

_count = 0;
{
if(side _x == blufor && ([4000,4000] distance _x < 100)) then {
	_count = _count + 1;
}
} forEach allUnits;

hint format ["_count is %1", _count];

This will count all BLUFOR units that are within 100 meters radius from [4000,4000] position.

Share this post


Link to post
Share on other sites

Thanks for the script, it looks like it nearly works but the count is definitely off, I've put down somewhere in the region of 80 blufor units on the entire map (obviously I expanded the area to count them all) & it's returning an average of more than 130. It's starting to make me paranoid there's re-enforcements I'm not expecting...

Is there any way the script could be counting everyone twice?

Share this post


Link to post
Share on other sites

try just typing {side _x == blufor} count allUnits in the debug console will let you know how many units are around in the whole map.

Share this post


Link to post
Share on other sites

Okay, that also shows the same number range. After a bit of investigation it looks like the sites aren't reporting numbers correctly, a 4 man patrol is counting as 6, a 2 truck & 4 soldier base is counting as 11...

Seems I've found the root of my problem, I might give the sites a miss for a while & just place guys manually.

Thanks

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×