Kolmain 6 Posted June 6, 2013 itt_fnc_setupBattleGroups = { _squadLeader = _this select 0; if (itt_debug) then { systemChat "ITT DEBUG :: FORMING BATTLE GROUPS..."; }; _FT1count = 0; _FT2count = 0; _SQDcount = 1; _FT1array = []; _FT2array = []; _SQDarray = [_squadLeader]; _squadmates = units group _squadLeader; _squadmates = _squadmates - [_squadleader]; //for "_i" from 0 to (count _squadmates) do { { _unit = _x; if (itt_debug) then { systemChat "ITT DEBUG :: ASSIGNGING UNIT..."; }; if ((FT1count >= 4) && (FT2count >=4)) then { _SQDarray = _SQDarray + [_unit]; _SQDcount = _SQDcount + 1; if (itt_debug) then { systemChat "ITT DEBUG :: UNIT ADDED TO SQD..."; }; } else { if (FT1count >= FT2count) then { _FT2array = _FT2array + [_unit]; _FT2count = _FT2count + 1; if (itt_debug) then { systemChat "ITT DEBUG :: UNIT ADDED TO FT2..."; }; } else { _FT1array = _FT1array + [_unit]; _FT1count = _FT1count + 1; if (itt_debug) then { systemChat "ITT DEBUG :: UNIT ADDED TO FT1..."; }; }; }; } forEach units group _squadLeader; /*_FT1hasMG = true; _FT2hasMG = true; if ((_FT1hasMG && _FT2hasMG) || (!_FT1hasMG && !_FT2hasMG)) then { _MGFT = [_FT1array, _FT2array] call BIS_fnc_selectRandom; } else { if (_FT1hasMG) then { _MGFT = _FT1array; _MFT = _FT2array; } else { _MGFT = _FT2array; _MFT = _FT1array; }; }; */ _MGFT = _FT1array; _MFT = _FT2array; { _x setVariable ["itt_battleGroup", 1, true]; } forEach _MGFT; if (itt_debug) then { systemChat "ITT DEBUG :: MGFT FORMED..."; }; { _x setVariable ["itt_battleGroup", 2, true]; } forEach _MFT; if (itt_debug) then { systemChat "ITT DEBUG :: MFT FORMED..."; }; if (itt_debug) then { systemChat "ITT DEBUG :: BATTLEGROUPS ASSIGNED..."; }; }; itt_fnc_battleGroups = { _squadLeader = _this select 0; if (itt_debug) then { systemChat "ITT DEBUG :: FORMING BATTLE GROUPS..."; }; _SQD = group _squadLeader; _MGFT = createGroup (side _squadLeader); _MFT = createGroup (side _squadLeader); { _team = _x getVariable "itt_battleGroup"; switch _team do { case 1: { [_x] join _MGFT; _x groupChat "Formed up!"; if (itt_debug) then { systemChat "ITT DEBUG :: UNIT JOINED MGFT..."; }; }; case 2: { [_x] join _MFT; _x groupChat "Formed up!"; if (itt_debug) then { systemChat "ITT DEBUG :: UNIT JOINED MFT..."; }; }; }; } forEach units group _squadLeader; if (itt_debug) then { systemChat "ITT DEBUG :: BATTLE GROUPS FORMED..."; }; [_SQD, _MGFT, _MFT] spawn itt_fnc_engagedLoop; }; The above two functions should split a squad into 2 fireteams, and a support element, but the loop never shows "ITT DEBUG :: ASSIGNGING UNIT..." for debug... any idea whats wrong with the loop? Share this post Link to post Share on other sites
Larrow 2823 Posted June 6, 2013 Maybe if (FT1count >= FT2count) then { and if ((FT1count >= 4) && (FT2count >=4)) then { Should be local variables if (_FT1count >= _FT2count) then { and if ((_FT1count >= 4) && (_FT2count >=4)) then { Maybe causing the script to stop due to these being undefined? Share this post Link to post Share on other sites
Kolmain 6 Posted June 6, 2013 Doh! :butbut: I'll try when I get home from work thanks! Share this post Link to post Share on other sites
LoonyWarrior 10 Posted June 6, 2013 //for "_i" from 0 to (count _squadmates) do { your for loop is commented out Share this post Link to post Share on other sites