Search the Community
Showing results for tags 'demomission'.
Found 1 result
-
Generate convoy for 3D positioning - Script
Coladebote posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi guys: With this script I have managed to form a convoy of 6 vehicles. if (!isServer) exitWith {}; // CONVOY // _markerstr = createMarker ["convoy_1",[4480.02,14026.1]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_1"; _convoy_1 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_APC_Wheeled_02_rcws_v2_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_1; _leader = leader _convoy_1; [_leader,"convoy_1"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_1", _leader, true]; _wp1 = _convoy_1 addWaypoint [getmarkerpos "wp_1A", 1]; _wp1 setWaypointTimeout [12, 12, 12]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_1 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_1 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; sleep 2; _markerstr = createMarker ["convoy_2",[4465.62,14018.3]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_2"; _convoy_2 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_Truck_02_Ammo_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_2; _leader = leader _convoy_2; [_leader,"convoy_2"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_2", _leader, true]; _wp1 = _convoy_2 addWaypoint [getmarkerpos "wp_1B", 1]; _wp1 setWaypointTimeout [14, 14, 14]; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_2 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_2 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; sleep 2; _markerstr = createMarker ["convoy_3",[4453.86,14011.6]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_3"; _convoy_3 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_Truck_02_Ammo_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_3; _leader = leader _convoy_3; [_leader,"convoy_3"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_3", _leader, true]; _wp1 = _convoy_3 addWaypoint [getmarkerpos "wp_1C", 1]; _wp1 setWaypointTimeout [16, 16, 16]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_3 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_3 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; sleep 2; _markerstr = createMarker ["convoy_4",[4441.19,14004.9]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_4"; _convoy_4 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_Truck_02_Ammo_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_4; _leader = leader _convoy_4; [_leader,"convoy_4"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_4", _leader, true]; _wp1 = _convoy_4 addWaypoint [getmarkerpos "wp_1D", 1]; _wp1 setWaypointTimeout [21, 21, 21]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_4 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_4 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; sleep 2; _markerstr = createMarker ["convoy_5",[4428.7,13998.4]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_5"; _convoy_5 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_Truck_02_Ammo_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_5; _leader = leader _convoy_5; [_leader,"convoy_5"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_5", _leader, true]; _wp1 = _convoy_5 addWaypoint [getmarkerpos "wp_1E", 1]; _wp1 setWaypointTimeout [24 , 24, 24]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_5 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_5 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; sleep 2; _markerstr = createMarker ["convoy_6",[4418.13,13992.8]]; _markerstr setMarkerShape "ICON"; _height = 0; _pos = getMarkerPos "convoy_6"; _convoy_6 = [ [_pos select 0, _pos select 1, _height], EAST, ["O_APC_Wheeled_02_rcws_v2_F"],[],[],[],[],[],60] call BIS_fnc_spawnGroup; {_x forceSpeed 4; _x forceFollowRoad true; _x setConvoySeparation 10; _x setDriveOnPath [getMarkerPos "wp2", getMarkerPos "wp3"]; _x setBehaviour "CARELESS"; _x setCombatMode "GREEN"} forEach units _convoy_6; _leader = leader _convoy_6; [_leader,"convoy_6"] remoteExecCall ["setVehicleVarName",0,true]; missionNameSpace setVariable ["convoy_6", _leader, true]; _wp1 = _convoy_6 addWaypoint [getmarkerpos "wp_1F", 1]; _wp1 setWaypointTimeout [32, 32, 32]; _wp1 setWaypointType "MOVE"; _wp1 setWaypointBehaviour "CARELESS"; _wp2 = _convoy_6 addWaypoint [getmarkerpos "wp_2", 2]; _wp2 setWaypointType "MOVE"; _wp2 setWaypointBehaviour "CARELESS"; _wp3 = _convoy_6 addWaypoint [getmarkerpos "wp_3", 3]; _wp3 setWaypointType "MOVE"; _wp3 setWaypointBehaviour "CARELESS"; private _myArray = ["_convoy_1", "_convoy_2", "_convoy_3", "_convoy_4", "_convoy_5", "_convoy_6"]; private _myNewArray = _myArray; _myArray set [1, "_convoy_6"]; _myNewArray select 1; Units 1 and 6: armored vehicles. units 2, 3, 4 and 5: ammunition trucks. The convoy is approximately 150 meters long. The script works perfectly. Although it could be debugged using a WP block for all vehicles and reduce the length of the convoy, shortening the distance between vehicles. I have used "forceSpeed" because limitSpeed "does not respond. I pass a link with the image of the convoy underway and another with the demo mission. LINK: PHOTO CONVOY IN TRAINING https://drive.google.com/open?id=1P4Sb3s6H_tMFQismtDGaIzW0IW7BQ7CY LINK: DEMO MISSION (RAR FILE) https://drive.google.com/open?id=1tD3ckxt-7Ekj8PuopLD-qSN9uabmzjwW Clarification: I have made several convoys in the editor, placing the vehicles on the map. But generating the units by script no. I am sure it can be improved. Thanks.