Casio91Fin 31 Posted September 16, 2019 Is it possible to add new groups here, which then the script always selects a new team for the area? [] spawn { if (isServer) then { waitUntil {player == player}; while {true} do { _eastunits = east countSide allUnits; playerarray = []; { playerarray = playerarray + [_x]; } forEach playableunits+switchableunits; _randomplayer = playerarray call BIS_fnc_selectRandom; _randomplayerpos = (getPos _randomplayer); if (_eastunits < 50) then { _safePosition = [ _randomplayerpos, 700, 1000, 10, 0, 20, 0] call BIS_fnc_findSafePos; _position = [_randomplayerpos, 100, 250, 10, 0, 20, 0] call BIS_fnc_findSafePos; _attackgroup = [_safePosition, EAST, [ "O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F", "O_soldier_M_F", "O_Soldier_AT_F", "O_Soldier_AAT_F", "O_Soldier_A_F", "O_medic_F" ]] call BIS_fnc_spawnGroup; _wp1 = _attackgroup addWaypoint [ _position, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointCompletionRadius 100; _wp1 setWaypointBehaviour "aware"; _wp1 setWaypointFormation "LINE"; _wp2 = _attackgroup addWaypoint [ _safePosition,0]; _wp2 setWaypointType "CYCLE"; _wp2 setWaypointSpeed "NORMAL"; _wp2 setWaypointCompletionRadius 100; _wp2 setWaypointBehaviour "COMBAT"; _wp2 setWaypointFormation "NO CHANGE"; }; sleep 120; }; }; }; Share this post Link to post Share on other sites
RCA3 586 Posted September 16, 2019 Define your teams after waitUntil {player == player}; One array per team, as many units and teams you want: _allTeams = [["O_Soldier_SL_F", "O_Soldier_AR_F"], ["O_Soldier_AAT_F","O_Soldier_A_F","O_medic_F"], ["O_soldier_M_F","O_Soldier_AT_F"]]; //Here are just 3 teams with 2 and 3 men each. Put this before _attackgroup: _randomTeam = selectRandom _allTeams; Replace: ["O_Soldier_SL_F", "O_Soldier_AR_F","O_Soldier_GL_F","O_soldier_M_F","O_Soldier_AT_F","O_Soldier_AAT_F","O_Soldier_A_F","O_medic_F" ] With: _randomTeam PS: 1 hour ago, Casio91Fin said: Is it possible to add new groups here, which then the script always selects a new team for the area? Is not always a new team but random each spawn. Share this post Link to post Share on other sites
Casio91Fin 31 Posted September 16, 2019 @RCA3 thanks but now it gives an error message and no troops spawn in the world. I don't know if I did everything right [] spawn { if (isServer) then { waitUntil {player == player}; while {true} do { _eastunits = east countSide allUnits; playerarray = []; { playerarray = playerarray + [_x]; } forEach playableunits + switchableunits; _randomplayer = playerarray call BIS_fnc_selectRandom; _randomplayerpos = (getPos _randomplayer); if (_eastunits < 50) then { _safePosition = [ _randomplayerpos, 700, 1000, 10, 0, 20, 0] call BIS_fnc_findSafePos; _position = [_randomplayerpos, 100, 250, 10, 0, 20, 0] call BIS_fnc_findSafePos; _allTeams = [["O_Soldier_SL_F", "O_Soldier_AR_F"], ["O_Soldier_AAT_F","O_Soldier_A_F","O_medic_F"], ["O_soldier_M_F","O_Soldier_AT_F"]]; _randomTeam = selectRandom _allTeams; _attackgroup = [_safePosition, EAST, _allTeams] call BIS_fnc_spawnGroup; _wp1 = _attackgroup addWaypoint [ _position, 0]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointCompletionRadius 100; _wp1 setWaypointBehaviour "aware"; _wp1 setWaypointFormation "LINE"; _wp2 = _attackgroup addWaypoint [ _safePosition,0]; _wp2 setWaypointType "CYCLE"; _wp2 setWaypointSpeed "NORMAL"; _wp2 setWaypointCompletionRadius 100; _wp2 setWaypointBehaviour "COMBAT"; _wp2 setWaypointFormation "NO CHANGE"; }; sleep 10; }; }; }; Share this post Link to post Share on other sites
RCA3 586 Posted September 16, 2019 You just copy/pasted same thing again... I can't see what you changed. Oh no, you just placed some things on the wrong place. Well, _allteams you should add before the while loop because you don't need to keep redefining it. Second, you need to define each team inside _allteams as you see fit, that's just one example. You can add units from here: https://community.bistudio.com/wiki/Arma_3_CfgVehicles_EAST Third, you did this wrong: _attackgroup = [_safePosition, EAST, _allTeams] call BIS_fnc_spawnGroup; Should be _attackgroup = [_safePosition, EAST, _randomteam] call BIS_fnc_spawnGroup; Share this post Link to post Share on other sites
Casio91Fin 31 Posted September 16, 2019 I did according to your instructions and and still giving the error message "line 23: missing ;" even though there is that sign. Share this post Link to post Share on other sites
RCA3 586 Posted September 16, 2019 (edited) Try deleting and rewriting line 23. Post the code again. Edited September 17, 2019 by RCA3 Share this post Link to post Share on other sites
Larrow 2815 Posted September 17, 2019 Spoiler [] spawn { if (isServer) then { waitUntil{ time > 0 }; //Fill with random groups makeups _randomGroups = [ [ "O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F", "O_soldier_M_F", "O_Soldier_AT_F", "O_Soldier_AAT_F", "O_Soldier_A_F""O_Soldier_SL_F" ], [ "O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F" ], [ "O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F", "O_soldier_M_F", "O_Soldier_AT_F" ], [ "O_Soldier_SL_F", "O_Soldier_SL_F", "O_Soldier_AR_F", "O_Soldier_GL_F" ] ]; while {true} do { //Does this var need to be global? playerArray = playableUnits + switchableUnits; _randomplayerpos = getPos selectRandom playerArray; if ( east countSide allUnits < 50 ) then { _safePosition = [ _randomplayerpos, 700, 1000, 10, 0, 20, 0] call BIS_fnc_findSafePos; _position = [_randomplayerpos, 100, 250, 10, 0, 20, 0] call BIS_fnc_findSafePos; _attackgroup = [_safePosition, EAST, selectRandom _randomGroups ] call BIS_fnc_spawnGroup; _attackgroup deleteGroupWhenEmpty true; //Send to players _wp1 = _attackgroup addWaypoint[ _position, 0 ]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointSpeed "FULL"; _wp1 setWaypointCompletionRadius 100; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointFormation "LINE"; //Search area _wp2 = _attackgroup addWaypoint[ _position, 0 ]; _wp2 setWaypointType "SAD"; _wp2 setWaypointSpeed "FULL"; _wp2 setWaypointCompletionRadius 100; _wp2 setWaypointBehaviour "AWARE"; _wp2 setWaypointFormation "LINE"; //Send back and cycle at safePos _wp3 = _attackgroup addWaypoint[ _safePosition, 0 ]; _wp3 setWaypointType "CYCLE"; _wp3 setWaypointSpeed "NORMAL"; _wp3 setWaypointCompletionRadius 100; _wp3 setWaypointBehaviour "COMBAT"; _wp3 setWaypointFormation "NO CHANGE"; }; sleep 120; }; }; }; Share this post Link to post Share on other sites