Jump to content
Sign in to follow this  
kocrachon

Can't Identify Group

Recommended Posts

I am having an issue using the = group command when hosting an online environment with no AI. Particularly, I have a squad of 10 people, named soldier1 - 10. Soldier1 is the squad leader, so normally in my script, I would put .

squad1 = group soldier1

However, I run into the issue, if no one selects that guy, say because we only have 5 players, and they select soldiers 3-8, then squad1 is not identified, and anything that functions based off of that won't activate. So how do I identify the squad identity so that it is not dependent on any one specific guy?

Share this post


Link to post
Share on other sites

Try this in init.sqf

GROUP1 = [];

{
if (alive _x) then {
	GROUP1 = GROUP1 + [_x];
};

} forEach [sOLDIER1,SOLDIER2,SOLDIER3...];

If using this you may have to slightly modify how you refer to them, because this method puts them into an array rather than a group. So for example if you wanted to kill them all, instead of saying {_x setDamage 1} foreach units Group1; , you would say {_x setDamage 1} foreach Group1;

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites

Here is my init

sleep 0.3;

execVM "gear.sqf";


squad1 = grpNull;

{
if (alive _x) then {
	squad1 = group _x;
};

} forEach [man1, man2, man3, man4, man5];

Here are the two methods I have tried activating a trigger based on the squad not being in the helicopter.

{_X in crew helo1} count squad1 == 0

{_X in crew helo1} count (units squad1) == 0

And here is a trigger for when people get into the helicopter that also isnt working with it

({ (not (_x in helo2)) and (alive _x) } count (units (squad1))) == 0;

({ (not (_x in helo2)) and (alive _x) } count  squad1) == 0;

Share this post


Link to post
Share on other sites

Never mind, issue resolved. It had the squad1 being defined in the editor elsewhere still.

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  

×