Jump to content
Sign in to follow this  

Automated AI Evacuation Chopper

Recommended Posts

Locality is killing me. I've got a script that I've written up for a task. The task involves the players meeting an enemy defector (defector47) who will join their group and follow them as they escort him to an extraction point. When they arrive at the point a friendly AI chopper should come in, land, and then once the defector is on board, (the players have to order him aboard), the defector should leave the group, the chopper should take off and then fly away.

Everything works fine when the server is hosted locally, but on a dedicated server, everything works up to the point of the chopper coming in and landing, the defector getting onboard and leaving the group, but the chopper never takes back off and just sits there with the defector on board.

//   Create Evac Chopper and fly to extraction LZ to pick up defector.

hint "Your radio crackles to life, ""This is LB-3, we are in bound to pick up the package.  Be there shortly, over.""";

// Define Local Variables
private ["_evacH","_heli","_heliCrew","_heliGroup"];

if (isServer) then{
// Spawn Evac helicopter and fly to Evacuation Point after a short delay.
_evacH = [markerPos "evacSpawn", random 360, "B_Heli_Light_01_F", west] call BIS_fnc_spawnVehicle;

// Set evacuation helicopter settings.
_heli = _evacH select 0;
_heliCrew = _evacH select 1;
_heliGroup = _evacH select 2;

_heli allowDamage false;  // Would suck to get shot down during evac after finishing the whole mission.

evacHeli = _heli;
heliGroup = _heliGroup;

// Set Evac helicopter waypoints and move to evacuation LZ.
wp0 = heliGroup addwaypoint [getMarkerPos "task_47B", 0];
wp0 setWaypointType "LOAD";
wp0 setWaypointSpeed "NORMAL";
wp0 setWaypointBehaviour "STEALTH";
wp0 setWaypointCombatMode "BLUE";
wp0 setWaypointStatements ["true","doStop evacHeli; evacHeli land 'LAND';"];

// Once chopper is down, wait for defector to get in.
waitUntil {{_x in evacHeli} count [defector47] > 0};
[defector47] joinsilent grpNull;

if(isServer) then{
// Once defector is in, fly to end mission marker/trigger and delete chopper/crew.
wp1 = heliGroup addwaypoint [getMarkerPos "endMark", 2];
wp1 setwaypointtype "MOVE";
wp1 setWaypointCombatMode "BLUE";
wp1 setWayPointStatements ["true","{deleteVehicle _x} forEach (crew evacHeli); deleteVehicle evacHeli;"];

Share this post

Link to post
Share on other sites

Just taking a wild guess here, I think your issue lies within the doStop command. You could try to use

heligroup move getMarkerPos "task_47B"

to get the heli moving after a doStop command, since it is of higher priority than the waypoint, as far as I know

maybe exchange heligroup with heli or the likes

You could also use the setCaptive command on the chopper, so hostiles won't open fire on it instead of having an invincible chopper

Share this post

Link to post
Share on other sites

Nope, no dice. Tried it by adding the heligroup move getMarkerPos "task_47B"; right above the wp1 lines. Worked fine on a locally hosted server, didn't work on dedicated.

Reason I'm using the doStop/Land combo is I've found that if I don't, often the chopper will touch down and then just fly off to the next waypoint immediately regardless of whether folks are on board or not

Share this post

Link to post
Share on other sites

Well, you asking about dostop got me thinking, so I pulled it from the wp0 statements and now it works on both locally hosted and dedicated servers with just this:

wp0 setWaypointStatements ["true","evacHeli land 'LAND';"];

Must be something with the doStop command and locality I guess. Thanks for the help!

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