Nicholas.Bell 11 Posted June 5, 2017 I want to spawn motorized/mechanized platoons as a single group with each vehicle loaded with it's infantry compliment. I've managed to kludge this together by copying others' and a lot of trial & error - and it works. But I figure there has to be a more elegant method. What I was originally attempting was creating individual groups (which I think is cleaner) and then joining them into a single group, but the join command is for units, not groups, best I can tell. Anyway, I know there's a ton of talent around here that might provide some wisdom. Thanks. Nick _platoon1 = []; _veh1 = []; _veh2 = []; _veh3 = []; _group1 = []; _group2 = []; _group3 = []; if (isServer) then { _position = getmarkerpos "marker_0"; _platoon1 = creategroup EAST; _veh1 = [_position, 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; _position = [(_position select 0)+5, (_position select 1)+10]; _group1 = [_position, EAST, ["rhs_msv_junior_sergeant","rhs_msv_machinegunner","rhs_msv_machinegunner_assistant","rhs_msv_grenadier","rhs_msv_rifleman"]] call BIS_fnc_spawnGroup; { _x assignAsCargo (_veh1 select 0); _x moveIncargo (_veh1 select 0);} foreach units _group1; sleep 1; _position = [(_position select 0)-10, (_position select 1)-10]; _veh2 = [_position, 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; _position = [(_position select 0)+5, (_position select 1)+10]; _group2 = [_position, EAST, ["rhs_msv_junior_sergeant","rhs_msv_machinegunner","rhs_msv_machinegunner_assistant","rhs_msv_grenadier","rhs_msv_rifleman"]] call BIS_fnc_spawnGroup; { _x assignAsCargo (_veh2 select 0); _x moveIncargo (_veh2 select 0);} foreach units _group2; sleep 1; _position = [(_position select 0)-20, (_position select 1)-10]; _veh3 = [_position, 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; _position = [(_position select 0)+5, (_position select 1)+10]; _group3 = [_position, EAST, ["rhs_msv_junior_sergeant","rhs_msv_machinegunner","rhs_msv_machinegunner_assistant","rhs_msv_grenadier","rhs_msv_rifleman"]] call BIS_fnc_spawnGroup; { _x assignAsCargo (_veh3 select 0); _x moveIncargo (_veh3 select 0);} foreach units _group3; _platoon1 setSpeedMode "LIMITED"; _wp1 = _platoon1 addWaypoint [getmarkerpos "marker_3",0]; _wp1 SetWaypointFormation "COLUMN"; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointBehaviour "SAD"; _wp1 setWaypointCombatMode "RED"; }; Share this post Link to post Share on other sites
theend3r 83 Posted June 5, 2017 Well, you can at least shrink the code and make it easier to manipulate by doing something like (untested): Spoiler if (isServer) then { _platoon1 = creategroup EAST; _createVeh = { params["_position", "_platoon", "_type", "_groupDetails"]; _veh = [_position, 0, _type, _platoon] call BIS_fnc_spawnVehicle; _position = [(_position select 0)+5, (_position select 1)+10]; _group = [_position, EAST, _groupDetails] call BIS_fnc_spawnGroup; { _x assignAsCargo _veh; _x moveIncargo _veh} foreach units _group; _group }; _grpDet = ["rhs_msv_junior_sergeant","rhs_msv_machinegunner","rhs_msv_machinegunner_assistant","rhs_msv_grenadier","rhs_msv_rifleman"]; _group1 = [getmarkerpos "marker_0", _platoon1, "rhs_tigr_sts_3camo_msv", _grpDet] call _createVeh; _group2 = [(getmarkerpos "marker_0") vectorAdd [-10,-10], _platoon1, "rhs_tigr_sts_3camo_msv", _grpDet] call _createVeh; _group3 = [(getmarkerpos "marker_0") vectorAdd [-20,-10], _platoon1, "rhs_tigr_sts_3camo_msv", _grpDet] call _createVeh; _platoon1 setSpeedMode "LIMITED"; _wp1 = _platoon1 addWaypoint [getmarkerpos "marker_3",0]; _wp1 SetWaypointFormation "COLUMN"; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointBehaviour "SAD"; _wp1 setWaypointCombatMode "RED"; }; 1 hour ago, Nicholas.Bell said: What I was originally attempting was creating individual groups (which I think is cleaner) and then joining them into a single group, but the join command is for units, not groups, best I can tell. {(units _x) joinSilent _platoon1} count [_group1, _group2, _group3]; Something like this might work, too: Spoiler if (isServer) then { _platoon1 = creategroup EAST; _veh1 = [getmarkerpos "marker_0", 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; _veh2 = [(getmarkerpos "marker_0") vectorAdd [-10,-10], 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; _veh3 = [(getmarkerpos "marker_0") vectorAdd [-20,-10], 0, "rhs_tigr_sts_3camo_msv", _platoon1] call BIS_fnc_spawnVehicle; { { _unit = [_veh, [_x, "cargo",0],false,true] call BIS_fnc_initVehicleCrew; [_unit select 0] joinSilent _platoon1; } count ["rhs_msv_junior_sergeant", "rhs_msv_machinegunner", "rhs_msv_machinegunner_assistant", "rhs_msv_grenadier", "rhs_msv_rifleman"]; } count [_veh1, _veh2, _veh3]; _platoon1 setSpeedMode "LIMITED"; _wp1 = _platoon1 addWaypoint [getmarkerpos "marker_3",0]; _wp1 SetWaypointFormation "COLUMN"; _wp1 setWaypointBehaviour "AWARE"; _wp1 setWaypointBehaviour "SAD"; _wp1 setWaypointCombatMode "RED"; }; but it would probably be significantly slower than the manual solution. Share this post Link to post Share on other sites
Nicholas.Bell 11 Posted June 6, 2017 22 hours ago, theend3r said: Well, you can at least shrink the code and make it easier to manipulate by doing something like (untested): I'll give a whirl this weekend. Thanks! Nick Share this post Link to post Share on other sites