Jump to content
Sign in to follow this  
dachs

AI vehicle unload troops and continue route?

Recommended Posts

So I have this spawned in QRF consisting of some pickups, loaded with troops. I want the pickup to drive to WP2, unload the troops and then move on to WP3.

However, it dosen't stop to unload at WP2, but just continues straight to WP3 ??

Using just one waypoint, with "TR UNLOAD" it works fine, but I really want to get the vehicle away from there again.. I've tried a sleep 5 after WP2, but that didn't help any. When searching it seems everything pertains to Helicopters, involving LAND and Helipads, which I can't apply here, or ?

// Spawn pickup "_QRF1" at marker:
_QRF1 = [getMarkerPos "spwnQRF1", 110, "O_G_Offroad_01_F", EAST] call bis_fnc_spawnvehicle;

//Define driver in _QRF1 as group "_group_QRF1"
_group_QRF1 = _QRF1 select 2;

//Spawn infantry group for QRF1
_QRFinf1 = [getMarkerPos "spwnQRF1", EAST, ["O_G_Soldier_SL_F", "O_G_Soldier_AR_F", "O_G_Soldier_M_F", "O_G_Soldier_F", "O_G_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;

//Put infantry group in QRF1 as cargo
{ _x assignAsCargo (_QRF1 select 0); _x moveIncargo (_QRF1 select 0);} foreach units _QRFinf1;


// QRF1: Give driver a waypoint
_WP2 = _group_QRF1 addwaypoint [getMarkerPos "WP2", 0]; 
	_WP2 setWaypointType "TR UNLOAD"; 
	_WP2 setWaypointSpeed "LIMITED"; 

	
_WP3 = _group_QRF1 addwaypoint [getMarkerPos "WP3", 0]; 
	_WP2 setWaypointType "MOVE"; 
	_WP2 setWaypointSpeed "LIMITED"; 

Share this post


Link to post
Share on other sites

it was because wp3s waypoints parameters were named wp2. I tried the edit and it worked

 

 

_WP3 = _group_QRF1 addwaypoint [getMarkerPos "WP3", 0];
    _WP3 setWaypointType "MOVE";
    _WP3 setWaypointSpeed "LIMITED"; 

  • Like 1

Share this post


Link to post
Share on other sites

Argh, a stupid overlooked cut&paste typo then... :banghead:

 

Thanks a bunch for spotting it man!

I managed to use quite a bit of time on that one, sigh..

Share this post


Link to post
Share on other sites

Ok, so with that embarrassing typo above out of the way, I got something working.

 

Now the script spawns a pickup, puts a infantry group in it, drives to a waypoint and unloads them. From here the infantry group go to their own waypoint, and the vehicle to it's final waypoint. All well and good.

 

Now comes the question, is it possible to do that for three vehicles with infantry groups on board, in the same script?

 

I've tried combining it, by just copy pasting the script below, and  giving the Infantry group and vehicles different names.

This makes the vehicles follow waypoints and unload infantry just as they should.

However, it's only the infantry group last given it's waypoint in the script, that will actually go there. The other two groups just stays at the unload waypoint, as if they never received their waypoint.

 

Working script for single vehicle / infantry group

_QRF1 = [];
_QRFinf1 = [];

if (isServer) then {

// QRF 1
// Spawn pickup "_QRF1" at marker:
_QRF1 = [getMarkerPos "spwnQRF1", 110, "O_G_Offroad_01_F", EAST] call bis_fnc_spawnvehicle;

//Define driver in _QRF1 as group "_group_QRF1"
_group_QRF1 = _QRF1 select 2;

//Spawn infantry group for QRF1
_QRFinf1 = [getMarkerPos "spwnQRF1", EAST, ["O_G_Soldier_SL_F", "O_G_Soldier_AR_F", "O_G_Soldier_M_F", "O_G_Soldier_F", "O_G_medic_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;

// Waypoints for Infantry group1
_wp1a = _QRFinf1 addWaypoint [getmarkerpos "WP1", 0];
	_wp1a setWaypointType "MOVE"; 
	_wp1a setWaypointSpeed "LIMITED"; 
	_wp1a setWaypointBehaviour "AWARE";
	
//Put infantry group1 in QRF1 as cargo
{ _x assignAsCargo (_QRF1 select 0); _x moveIncargo (_QRF1 select 0);} foreach units _QRFinf1;

// QRF1: Give driver a waypoint
_WP12 = _group_QRF1 addwaypoint [getMarkerPos "WP2", 10];
	_WP12 setWaypointCompletionRadius 50;
	_WP12 setWaypointType "TR UNLOAD"; 
	_WP12 setWaypointSpeed "LIMITED"; 
	_WP12 setwaypointTimeout [10,10,10];
	
	
_WP13 = _group_QRF1 addwaypoint [getMarkerPos "WP3", 10]; 
	_WP13 setWaypointCompletionRadius 50;
	_WP13 setWaypointType "MOVE"; 
	_WP13 setWaypointSpeed "LIMITED"; 
	
	};

Share this post


Link to post
Share on other sites

lol... we all do it... sometimes helps to get a new set of eyes on it.

 

You should be able to do it the way you tried... my guess based on them not moving is the group variable wasnt correct.

 

make sure you have named each group and referenced them with their own waypoints

 

_WP13 = _group_QRF1 addwaypoint [getMarkerPos "WP3", 10];

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  

×