Jump to content
Sign in to follow this  
Kydoimos

Assigning Variable to Spawned Groups

Recommended Posts

Hi all - having some trouble with assigning a variable to a spawned group. Basically, here's a spawned group:

_CSAT_Group_01 = [[3398.35, 7003.95, -75.95], EAST, ["O_Officer_F","O_Soldier_PG_F","O_Soldier_PG_F","O_Soldier_PG_F","O_Soldier_PG_F","O_Soldier_PG_F","O_Soldier_PG_F","O_Soldier_PG_F"],[],["CAPTAIN","SERGEANT","CORPORAL","PRIVATE","PRIVATE","PRIVATE","PRIVATE", "PRIVATE"],[],[],[],-200] call BIS_fnc_spawnGroup;

Now, for some reason, I can't run a forEach command on this group outside of the script I've created them in.

Here's a separate script:

Sleep 6;

{
unassignVehicle _X;
_X action ["EJECT", _Kajman_01];
Sleep 2.25;
} forEach (units _CSAT_Group_01);

{
_X action ["openParachute", _X];
Sleep 0.5;
} forEach (units _CSAT_Group_01);

Sleep 20;
{
deleteVehicle _X
} forEach (units _CSAT_Group_01);

Unfortunately, it can't find _CSAT_Group_01 - the group created in the first script. If I were to run the above from the script with the spawned group function however, there's no problems. Where am I going wrong? :D A noob error, I don't doubt! Sure one of you bright sparks can help though!

Share this post


Link to post
Share on other sites

What you have there is a local variable. Having the underscore at the beginning of "_CSAT_Group_01" means that it does not exist outside of the script its defined in. Try using "CSAT_Group_01" instead.

Share this post


Link to post
Share on other sites

@Fight9 - ah, thanks mate! I understand completely now! :P

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  

×