Skip to content

Instantly share code, notes, and snippets.

@psykzz
Created September 25, 2012 23:45
Show Gist options
  • Save psykzz/3785140 to your computer and use it in GitHub Desktop.
Save psykzz/3785140 to your computer and use it in GitHub Desktop.
//Configurational Defines.
#define EVAC_HELI "Mi17_Civilian"
_wait = 2;
// Functions
FNC_moveToAndLand = {
private ["_heli","_dest"];
_heli = _this select 0;
_evacHeli = _this select 1;
_dest = _this select 2;
_heli move _dest;
sleep 3;
while { ( (alive _evacHeli) && !(unitReady _heli) ) } do {
sleep 1;
hint "waiting to land...";
};
if (alive _evacHeli) then {
_evacHeli land "LAND";
hint "Landing...";
};
};
//Initialize
_wSideHQ = createCenter west;
_eSideHQ = createCenter east;
player globalChat "Spawning evac heli...";
player addmagazine "SmokeShellRed"; sleep 0.5;
player selectWeapon "SmokeShellRed"; sleep 0.5;
_evacGroup = createGroup west;
//_evacHeliSpawnMarkers = ["evacSpawn_1","evacSpawn_2","evacSpawn_3"];
_evacHeliSpawn = getMarkerPos "evacSpawn_1";
//Spawn Helo
_evacHeli = createVehicle [EVAC_HELI, _evacHeliSpawn, [], 0, "NONE"];
// Spawn Crew
_pilot = _evacGroup createUnit ["USMC_Soldier_Pilot", _evacHeliSpawn, [], 0, "NONE"];
[_pilot] join _evacGroup;
_pilot assignAsDriver _evacHeli;
_pilot moveInDriver _evacHeli;
//init
_radius = 1500;
_found = FALSE;
//loop check
while {(alive _evacHeli)} do {
_smokearray = (position player) nearObjects ["SmokeShellRed",_radius];
_qty = count _smokearray;
if (_qty > 0) then {
//Smoke has been dropped
_smoke = _smokearray select 0;
_smokepos = position _smoke;
hint format ["Found: %1",_found];
_found = TRUE;
_pilot doMove _smokepos;
sleep _wait;
while { ( (alive _pilot) && !(unitReady _pilot) ) } do
{
sleep _wait;
player globalChat "waiting to land...";
};
if (alive _pilot) then
{
_pilot land "GETIN";
_evacHeli land "GETIN";
_evacGroup land "GETIN";
player globalChat "landing...";
};
};
sleep _wait;
if (_found) exitWith {};
};
player globalChat "ended...";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment