Jump to content
Sign in to follow this  
addicted

how to check how many crewmen play on each side

Recommended Posts

Hello

I'm stuck. What need I to write in code to get number of players which play on crewman class on west side? "crewman class" I mean "b_crew_f".

Regards

Share this post


Link to post
Share on other sites

_crewmanCount_Blufor = {alive _x && typeOf _x == "b_crew_f"} count allUnits;
player sideChat format ["%1", _crewmanCount_Blufor];

You can do a side check too, if you've blufor units joining opfor or resistance sides for example. Else, I would expect simply checking for the blufor crewman type (above) would be enough to return the count of crewman on the blufor side.

_crewmanCount_Blufor = {alive _x && side _x == blufor && typeOf _x == "b_crew_f"} count allUnits;
player sideChat format ["%1", _crewmanCount_Blufor];

Share this post


Link to post
Share on other sites

Big thanks for so quick answear. I tried for 3hours now I will try it :)

Edit. I used it because i needed all players dead or alive

_crewmanCount_Blufor = {typeOf _x == "b_crew_f"} count allUnits;
player sideChat format ["%1", _crewmanCount_Blufor];

But if I need all players should I use this?

_crewmanCount_Blufor = {isPlayer _x && typeOf _x == "b_crew_f"} count allUnits;
player sideChat format ["%1", _crewmanCount_Blufor];

On my computer it works.

Thanks so much.

Edited by addIcted

Share this post


Link to post
Share on other sites

Ahh yes, isPlayer check is helpful for checking if units are players :). Especially if there are AI crewman on the map aswell. Else you wouldn't even need to check for players, if players only are going to be the crewman type.

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  

×