Jump to content
Sign in to follow this  
1para{god-father}

Convoy help Just 2 vehicles

Recommended Posts

Hi I am just trying to get 2 vehicles to follow  3-4 way points  that I am placing down via map clicks but they seem to drive everywhere but where they should - I am sure it can be done better so can anyone please advise me on how to get theses 2 vehicles to follow the WP

 

*  Also when they get to the last WP how can i delete all to start again.

*  Is there a way that if i shoot near the vehicles it will stop and eject the Driver ?

 

Many thanks !

 


private ["_convoy_wp1","_point1","_convoy_wp2","_point2","_convoy_wp3","_point3","_convoy_wp4","_point4","_convoy_wp5","_point5"];


		deletemarkerlocal "marker1";	//delete old markers if needed
		deletemarkerlocal "marker2";
		deletemarkerlocal "marker3";
		deletemarkerlocal "marker4";
		deletemarkerlocal "marker5";

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>Left click on the map to set start position for the convoy</t><br/>
					<t color='#33CC00'>Waypoints done: 0</t><br/>
					<t color='#FF0000'>Waypoints to go: 5</t><br/>--------------------------<br/>"];

		click = false;
		onMapSingleClick "point1 = _pos;
		click = true;
		onMapSingleClick """";" ;

		waitUntil {(click)};
		click = false;
		_convoy_wp1 = createMarkerLocal ["marker1",point1];
		_convoy_wp1 setMarkerTypeLocal "mil_dot";
		_convoy_wp1 setMarkerSizeLocal [0.5, 0.5];
		_convoy_wp1 setMarkertextLocal "Start";

		_convoy_wp1 setMarkerColorLocal "ColorRed";
		_point1 =getmarkerpos "marker1";
		sleep 0.5;

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>Left click on the map to set the 1st waypoint for the convoy</t><br/>
					<t color='#33CC00'>Waypoints done: 1</t><br/>
					<t color='#FF0000'>Waypoints to go: 4</t><br/>--------------------------<br/>"];



		onMapSingleClick "point2 = _pos;
		click = true;
		onMapSingleClick """";" ;

		waitUntil {(click)};
		click = false;
		_convoy_wp2 = createMarkerLocal ["marker2",point2];
		_convoy_wp2 setMarkerTypeLocal "mil_dot";
		_convoy_wp2 setMarkerSizeLocal [0.5, 0.5];
		_convoy_wp2 setMarkertextLocal "1";

		_convoy_wp2 setMarkerColorLocal "ColorRed";
		_point2 =getmarkerpos "marker2";
		sleep 0.5;

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>Left click on the map to set the 2nd waypoint for the convoy</t><br/>
					<t color='#33CC00'>Waypoints done: 2</t><br/>
					<t color='#FF0000'>Waypoints to go: 3</t><br/>--------------------------<br/>"];



		onMapSingleClick "point3 = _pos;
		click = true;
		onMapSingleClick """";" ;

		waitUntil {(click)};
		click = false;
		_convoy_wp3 = createMarkerLocal ["marker3",point3];
		_convoy_wp3 setMarkerTypeLocal "mil_dot";
		_convoy_wp3 setMarkerSizeLocal [0.5, 0.5];
		_convoy_wp3 setMarkertextLocal "2";

		_convoy_wp3 setMarkerColorLocal "ColorRed";
		_point3 =getmarkerpos "marker3";
		sleep 0.5;

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>Left click on the map to set the 3rd waypoint for the convoy</t><br/>
					<t color='#33CC00'>Waypoints done: 3</t><br/>
					<t color='#FF0000'>Waypoints to go: 2</t><br/>--------------------------<br/>"];


		onMapSingleClick "point4 = _pos;
		click = true;
		onMapSingleClick """";" ;

		waitUntil {(click)};
		click = false;
		_convoy_wp4 = createMarkerLocal ["marker4",point4];
		_convoy_wp4 setMarkerTypeLocal "mil_dot";
		_convoy_wp4 setMarkerSizeLocal [0.5, 0.5];
		_convoy_wp4 setMarkertextLocal "3";

		_convoy_wp4 setMarkerColorLocal "ColorRed";
		_point4 =getmarkerpos "marker4";
		sleep 0.5;

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>Left click on the map to set the last waypoint for the convoy</t><br/>
					<t color='#33CC00'>Waypoints done: 4</t><br/>
					<t color='#FF0000'>Waypoints to go: 1</t><br/>--------------------------<br/>"];


		onMapSingleClick "point5 = _pos;
		click = true;
		onMapSingleClick """";" ;

		waitUntil {(click)};
		click = false;
		_convoy_wp5 = createMarkerLocal ["marker5",point5];
		_convoy_wp5 setMarkerTypeLocal "mil_dot";
		_convoy_wp5 setMarkerSizeLocal [0.5, 0.5];
		_convoy_wp5 setMarkertextLocal "End";

		_convoy_wp5 setMarkerColorLocal "ColorRed";
		_point5 =getmarkerpos "marker5";
		sleep 0.5;

		hint parseText format["Add waypoints for convoy:<br/>--------------------------<br/>
					<t color='#00CCFF'>All waypoint for the convoy have been set</t><br/>
					<t color='#33CC00'>Waypoints done: 5</t><br/>
					<t color='#FF0000'>Waypoints to go: 0</t><br/>--------------------------<br/>"];

			hint "Convoy Ready to Spawn";

_carlist = [
"C_Van_01_box_F",
"C_Van_01_transport_F",
"C_Hatchback_01_F",
"C_Van_01_fuel_F",
"C_Offroad_01_F",
"C_Quadbike_01_F",
"C_SUV_01_F"
];

_civlist = [
"C_man_p_beggar_F",
"C_man_1",
"C_man_polo_1_F",
"C_man_polo_2_F",
"C_man_polo_3_F",
"C_man_polo_4_F",
"C_man_polo_5_F",
"C_man_polo_6_F",
"C_man_shorts_1_F",
"C_man_1_1_F",
"C_man_1_2_F",
"C_man_1_3_F",
"C_man_p_fugitive_F",
"C_man_p_shorts_1_F",
"C_man_hunter_1_F",
"C_man_shorts_2_F",
"C_man_shorts_3_F",
"C_man_shorts_4_F"
];


Event_Convoy_ConvoyVehicles =  														
[
	"B_Truck_01_medical_F",
	"I_Truck_02_covered_F",
	"I_Truck_02_ammo_F",
	"I_Truck_02_medical_F"
];

Event_Convoy_EscortVehicleLead = "I_Truck_02_covered_F"; 						// Escort vehicle that leads the convoy
///Markers to place down
Event_Convoy_MarkerType = "c_car"; 								
Event_Convoy_MarkerText = "Supply Convoy";

_convoyVehicleArray = Event_Convoy_ConvoyVehicles;
_convoyVehicle = selectRandom _convoyVehicleArray;

_eastCenter = createCenter east;
_group = createGroup east;
_group allowFleeing 0;
_group setCombatMode "RED";

_group1 = createGroup east;
_group1 allowFleeing 0;
_group1 setCombatMode "RED";

_spawnPos = _point1;

_escort = createvehicle ["I_Truck_02_covered_F",_point1,[],10,"NONE"];
_escort setVariable ["ExileIsPersistent", false];
_escort setDir _unitDirection;
_escort addEventHandler ["GetOut",{_this call god_bomber;}];

_escortDriver = _group createUnit ["I_G_Soldier_F",_point1,[],0,"NONE"];
_escortDriver moveInDriver _escort;
_escortDriver setCaptive true;

_vehicleLead = createvehicle [_convoyVehicle,_point1,[],20,"NONE"];
_vehicleLead setVariable ["ExileIsPersistent", false];
_vehicleLead setDir _unitDirection;
_vehicleLead addEventHandler ["GetOut",{_this call god_bomber;}];

_driver = _group createUnit ["I_G_Soldier_F",_point1,[],0,"NONE"];
_driver moveInDriver _vehicleLead;

sleep 1;

_wayPointOne   = _point2;					
_wayPointTwo   = _point3;					
_wayPointThree = _point4;				

_wp1 = _group addWaypoint [_wayPointOne, 0];
_wp1 setWaypointType "MOVE";
_wp1 setWaypointBehaviour "CARELESS";

_wp2 = _group addWaypoint [_wayPointTwo, 0];
_wp2 setWaypointType "MOVE";
_wp2 setWaypointBehaviour "CARELESS";

_wp3 = _group addWaypoint [_wayPointThree, 0];
_wp3 setWaypointType "CYCLE";
_wp3 setWaypointBehaviour "CARELESS";

_vehicleLead forceSpeed 5;
_escort forceSpeed 5;

_marker1 = createMarker ["Convoy",position _vehicleLead];
_marker1 setMarkerType Event_Convoy_MarkerType;
_marker1 setMarkerText Event_Convoy_MarkerText;

Add Marker to Vehicle to track

[_marker1,_vehicleLead] spawn
{
	private ["_marker","_vehicle","_regulatingV1"];

	_marker = _this select 0;
	_vehicle = _this select 1;

	while {true} do
	{
		_marker setmarkerPos position _vehicle;
		sleep 1; ///  change to 60sec later
	};

};

/// when they get to last waypoint Delete all///
////???????????????

 

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  

×