Xtri 10 Posted May 27, 2012 Hello, like I'm having difficulties with a code for groups. if (isPlayer (leader _x)) then I'm trying to find out how to get all players in a group instead of just the leader, do you have any tips? I'm kind of new to scripting. Share this post Link to post Share on other sites
Rydygier 1317 Posted May 27, 2012 You can try: _players = []; { if (isPlayer _x) then {_players set [(count _players),_x]} } foreach (units _x); or: _players = []; { if (isPlayer _x) then {_players = _players + [_x]} } foreach (units _x); so you got, what you want - all players in "_x" group contained inside _players variable. Now you can make such condition: if ((count _players) > 0) then But if it is only about condition, if in group is at least one player, or not, then better will be: _playersCount = {isPlayer _x} count (units _x); if ((count _playersCount) > 0) then //something In turn, if you want to do something with each unit, that is a player in that group, then use: { if (isPlayer _x) then {}//do something to him inside this brackets } foreach (units _x); Share this post Link to post Share on other sites