Jump to content
lordfrith

[Release] Heli Support script

Recommended Posts

hello all,

 

LORD FRITHS CHOPPER SUPPORT SCRIPT:

 

OVERVIEW:
been trying to teach myself a bit of scripting and sate my obsession with being ferried around the map in an AI chopper. This script is adapted/took inspiration from 'kibot's' awesome DUWS and still contains some large snippets of his code (on share alike licence).

 

"rabid Chaffinch" is a support chopper called from the communications menu (0-8-1). the aim is to allow one in-game chopper to provide as much support (transport, supplies, etc) to player unit as possible, and to add a bit of character/detail to the whole process.

 

DOWNLOAD:
dropbox:

latest release 1.1


basic release (old)

INSTALL:
script packaged in a scenario file. unzip and place into your "documents/arma3/userProfile/missions" folder

 

USAGE:
        to use this support menu:

                0-8-1 brings up support menu.

                select 1-1 ("transport" - "chopper transport")

                click on map as instructed to set extract and insert points

                if you are at base close to chopper you will only need insert point, chopper will wait for you to board and move out

                if you are out on mission chopper will fly to designated extraction point, land and wait for player group to board

                once on board chopper will fly to insert point and land, kicking all player group out of chopper, then (if out in mission) will return to base and refuel.
        
                near langing/takeoff you can call a script reset in case anything gets stuck
        
                while in transit you can redirect chopper to new insert point using "landhere" addaction.

        to add/create a mission using this script:

                copy/merge init.sqf and description.ext to mission folder

                place a helo called "helitaxi", any helo can be used but MH9 animations supported

                place a helipad at your desired base location and name "helipad0"

                taxi callsign can be edited in init.sqf

                funds costing can be disabled byt setting cost = false; in init.sqf

 

in init.sqf or initPlayerLocal.sqf

 

Spoiler

/////////////USER VARIABLES//////////
// define chopper call sign
callsign = "Rabid Chaffinch";
////////////DO////////NOT////////EDIT//////BELOW//////////HERE
call compile preprocessFile "support\suptFunc.sqf";
helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
null = [] spawn LF_fnc_heliInit;


cost = true;
funds = 10000;

 

in description.ext:

 

Spoiler

class CfgCommunicationMenu
{
    class helo_taxi
    {
        text = "Support Menu"; // Text displayed in the menu and in a notification
        submenu = "#USER:MENU_SUPPORT_1";  // Submenu opened upon activation
        expression = "";
        icon = "\a3\ui_f\data\gui\cfg\hints\CallSupport_CA.paa";
        cursor = ""; // Custom cursor displayed when the item is selected
        enable = "1"; // Simple expression condition for enabling the item
        removeAfterExpressionCall = 1; // 1 to remove the item after calling
    };
     class reset_helo
    {
        text = "Reset Support Comms"; // Text displayed in the menu and in a notification
        submenu = "";  // Submenu opened upon activation
        expression = "LF_resetHelo = [helitaxi, helipad0, callsign] execVM 'support\HQ\resetCommsMenu.sqf'";
        icon = "";
        cursor = ""; // Custom cursor displayed when the item is selected
        enable = "1"; // Simple expression condition for enabling the item
        removeAfterExpressionCall = 1; // 1 to remove the item after calling
    };
};

 

"support\suptFunc.sqf"

 

Spoiler

/*
Dependent global variables:
cost = boolian;
clicked = false;
clickedPos = [x,y,z];
inVeh = boolian;
crashed = boolian;
StartMk = marker;
EndMk = marker;
helipad0 = base pad (placed in EDEN);
helipad1 = start pad (spawned);
helipad2 = end pad (spawned);
helisup = supportmenu handle

*/


////////////////////////MENU SUPPORT ITEMS

MENU_SUPPORT_1 =
[
    ["Support Menu",false],
    ["Transport", [2], "#USER:MENU_TRANSPORT_1", -5, [], "1", "1"],
    ["Supplies", [3], "#USER:MENU_SUPPLY_1", -5, [], "1", "1"],
    ["Orders", [4], "#USER:MENU_ORDERS_1", -5, [], "1", "1"]
];
MENU_TRANSPORT_1 =
[
    // First array: "User menu" This will be displayed under the menu, bool value: has Input Focus or not.
    // Note that as to version Arma2 1.05, if the bool value set to false, Custom Icons will not be displayed.
    ["Transport",false],
    // Syntax and semantics for following array elements:
    // ["Title_in_menu", [assigned_key], "Submenu_name", CMD, [["expression",script-string]], "isVisible", "isActive" <, optional icon path> ]
    // Title_in_menu: string that will be displayed for the player
    // Assigned_key: 0 - no key, 1 - escape key, 2 - key-1, 3 - key-2, ... , 10 - key-9, 11 - key-0, 12 and up... the whole keyboard
    // Submenu_name: User menu name string (eg "#USER:MY_SUBMENU_NAME" ), "" for script to execute.
    // CMD: (for main menu:) CMD_SEPARATOR -1; CMD_NOTHING -2; CMD_HIDE_MENU -3; CMD_BACK -4; (for custom menu:) CMD_EXECUTE -5
    // script-string: command to be executed on activation.  (_target=CursorTarget,_pos=CursorPos)
    // isVisible - Boolean 1 or 0 for yes or no, - or optional argument string, eg: "CursorOnGround"
    // isActive - Boolean 1 or 0 for yes or no - if item is not active, it appears gray.
    // optional icon path: The path to the texture of the cursor, that should be used on this menuitem.
    ["chopper transport", [2], "", -5, [["expression", "LF_taxiScript = [helitaxi, helipad0, callsign] execVM 'support\taxi\helotaxi.sqf'"]], "1", "1"],
    ["drop off AI squad", [3], "", -5, [["expression", "hint '(planned) chopper brings a squad of AI to DZ who get out and join player group';"]], "1", "1"],
    ["engineer callout", [4], "", -5, [["expression", "hint '(planned) chopper brings a scripted engineer out to your position to fix your shit up';"]], "1", "1"]
];
MENU_SUPPLY_1 =
[
    ["Supplies",false],
    ["weapons drop", [2], "", -5, [["expression", "hint '(planned) chopper will go into cargo config and fly out with a couple of weapons crates';"]], "1", "1"],
    ["supplies drop", [3], "", -5, [["expression", "hint '(planned) chopper will go into cargo config and fly out with a sling loaded supply box';"]], "1", "1"],
    ["vehicle drop", [4], "", -5, [["expression", "hint '(planned) chopper will sling load a quad or jetski to you';"]], "1", "1"]
];
MENU_ORDERS_1 =
[
    ["Orders",false],
    ["move chopper", [2], "", -5, [["expression", "hint '(planned) chopper will move to clicked position, land and wait';"]], "1", "1"],
    ["RTB", [3], "", -5, [["expression", "hint '(planned) chopper will return to base pad';"]], "1", "1"],
    ["CAS", [4], "", -5, [["expression", "hint '(planned) chopper will go into combat config, fly to clicked position and shoot the shit out of stuff';"]], "1", "1"]
];
////////////////INIT///////////////INIT///////////////////INIT///////////////INIT///////////////////
//usually found in init.sqf or the like, included here for possible spawning from module etc
/*
cost = true;
helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
*/
///////////////////////////FUNCTIONS////////////////////////////////FUNCTIONS///////////////////////////////////////////////////
// function to open map and log click position to, creates pads and markers ,requires ref class [_helotype, 1, "LZ"] call LF_fnc_mapClick;
LF_fnc_mapClick = {
        private ["_helo"];
        _helo = _this select 0;
        _state = _this select 1;
        _mkRef = _this select 2;
        _basePos = getPos helipad0;
        _xtrct_pnt = [];
        _timer = 999;
        _max_dist = 100;

        clicked = false;

        if (_state == 3) exitWith {
                openMap [true, false];
                StartMk = format["%1%2",_mkRef,_basePos]; // Define marker name
                _StrtMk = createMarker [str(StartMk), _basePos];
                _StrtMk setMarkerShape "ICON";
                str(StartMk) setMarkerType "hd_end";
                str(StartMk) setMarkerColor "ColorGreen";
                str(StartMk) setMarkerText _mkRef;
                helipad1 = createVehicle ["Land_HelipadEmpty_F", _basePos, [], 0, "NONE"];
        };
        if (_State == 0) then {} else {
                if (_state == 1) then {openMap [true, false];};
                OnMapSingleClick "clickedPos = _pos; clicked = true;";
                while {_timer> 0} do {
                        if (clicked) then { // player has clicked the map
                                while{ count _xtrct_pnt < 1 } do {
                                        _xtrct_pnt = clickedPos findEmptyPosition[0 , _max_dist , _helo ];
                                        _max_dist = _max_dist + 50;
                                }; // find a valid pos
                                onMapSingleClick "";
                                _timer = 0;
                        };//close map and declare _pos
                };
                if (_state == 1) then {
                        StartMk = format["%1%2",_mkRef,_xtrct_pnt]; // Define marker name
                        _StrtMk = createMarker [str(StartMk), _xtrct_pnt];
                        _StrtMk setMarkerShape "ICON";
                        str(StartMk) setMarkerType "hd_end";
                        str(StartMk) setMarkerColor "ColorGreen";
                        str(StartMk) setMarkerText _mkRef;
                        helipad1 = createVehicle ["Land_HelipadEmpty_F", _xtrct_pnt, [], 0, "NONE"];
                };
                if (_State == 2) then {
                        EndMk = format["%1%2",_mkRef,_xtrct_pnt]; // Define marker name
                        _EdMk = createMarker [str(EndMk), _xtrct_pnt];
                        _EdMk setMarkerShape "ICON";
                        str(EndMk) setMarkerType "hd_end";
                        str(EndMk) setMarkerColor "ColorGreen";
                        str(EndMk) setMarkerText _mkRef;    
                        helipad2 = createVehicle ["Land_HelipadEmpty_F", _xtrct_pnt, [], 0, "NONE"];     
                        };
                sleep 2;
                if (_state == 2) then {openMap [false, false];
                };
        };
        _timer = 999;
        clicked = false;

};

//function to open and close side doors: _sideDoorClose = [vehicle, anim state]spawn LF_fnc_sideDoors;
LF_fnc_sideDoors = {
        private ["_helo", "_state"];

        _helo = _this select 0;
        _State = _this select 1;

        _helo animateDoor ['door_R', 0];
        sleep 3;
        _helo animateDoor ['door_L', 0];
};

LF_fnc_vehLoadOut = {
/*function to change the load out and functionality of MH-9 hummingbird
[_helo, _state, _lock, _load]call LF_fnc_vehLoadOut;
_helo is the mh-9 to change.
_state is 1 or 0
_outcome is which parts of script to call 1 = arming 2 = passenger/cargo 3 raise/lower benches
_loadbool is for lockCargo boolian
*/
        private ["_helo", "_state", "_outcome"];
        _helo = _this select 0;
        _State = _this select 1;
        _outcome = _this select 2;
        if (_helo isKindOf "B_Heli_Light_01_F") then {
                if (_outcome == 1) then {
                        _helo animateSource ["hiderockets",_State];
                        _helo animateSource ["hideweapons",_State];
                        _helo animateSource ["addBackseats",_State];
                        _helo animateSource ["addTread",_State];
                        _helo animateSource ["addBenches",_State];
                        if (_state == 0) then {
                                _state = 1;
                                _helo animateSource ["addgunholder",_State];  
                                _helo animateSource ["addholdingframe",_State];
                                _helo lockCargo true;
                        } else {
                                _state = 0;
                                _helo animateSource ["addgunholder",_State];  
                                _helo animateSource ["addholdingframe",_State];
                                _helo lockCargo false;
                        };
                };
                if (_outcome == 2) then {
                        _helo animateSource ["hiderockets",1];
                        _helo animateSource ["hideweapons",1];
                        _helo animateSource ["addgunholder",0];
                        _helo animateSource ["addBackseats",_State];
                        _helo animateSource ["addTread",_State];
                        _helo animateSource ["addBenches",_State];
                        if (_state == 0) then {
                                _state = 1;
                                _helo animateSource ["addholdingframe",_State];
                                _helo lockCargo true;
                        } else {
                                _state = 0;
                                _helo animateSource ["addholdingframe",_State];
                                _helo lockCargo false;
                        };
                };
                if (_outcome == 3) then {
                        _helo animateSource ["benchl_up",_state];
                        _helo animateSource ["benchr_up",_state];
                        if (_state == 0) then {
                                _helo lockCargo false;
                        } else {
                                _helo lockCargo true;
                        };
                };
        };
};
//original script by KIBOT [_helo] call LF_fnc_inVehChck; waitUntil {(inVeh)};
LF_fnc_inVehChck = {
        private ["_helo", "_pilot"];
        _helo = _this select 0;
        _pilot = driver _helo;
        _groupP = group player;
        inVeh = false;

        _inVehCheck = true;
    
        while {_inVehCheck} do {
    
        // wait until the player has gotten in
                waitUntil {(({_x in _helo} count units _groupP) == (count units _groupP))or (vehicle _pilot == _pilot or !alive _pilot)};
        
        // get out of the loop if choopa is down
                if (vehicle _pilot == _pilot or !alive _pilot) exitWith {};
    
        // check if player is inside choppa
                if (vehicle player != _helo) then {
                        hint "get back in!"
                } else {
                        _inVehCheck = false;
                        inVeh = true;
                };
        };
};

LF_fnc_deadCheck = {
// IF THE PILOT IS DEAD OR CHOPPA DOWN [_pilot] spawn LF_fnc_deadCheck;
        _pilot = _this select 0;
        
        if (vehicle _pilot == _pilot or !alive _pilot) then {
                crashed = true;
                //call LF_fnc_heloRespawn;
        } else {crashed = false;};
};

LF_fnc_deadClean = {
// clean up mission [_pilot, _plName, _callsign] spawn LF_fnc_deadClean;
        private ["_pilot", "_plName", "_callsign", "_IsIt"];
        
        _pilot = _this select 0;
        _plName = _this select 1;
        _callsign = _this select 2;
        _IsIt = _this select 3;
        if (_IsIt ==0) then {
                _deRes = [player,resetsup] call BIS_fnc_removeCommMenuItem;
        };
        terminate LF_taxiScript;
        deleteVehicle helipad1;
        deleteVehicle helipad2;
        deleteMarker StartMk;
        deleteMarker EndMk;
        _deadHint = [west, "HQ"] sideChat format["This is HQ to %1, be advised, %2 is down, repeat %2 is down",_plName, _callsign];    
};

LF_fnc_heliInit = {
        sleep 1;
        null = [helitaxi, 1, 2] spawn LF_fnc_vehLoadOut;
        null = [helitaxi, 1, 3] spawn LF_fnc_vehLoadOut;        
};

//////BIG////OLE////DIRTY/////ARRAYS//////

        LFcallsigns =
        [
                "Rabid Chaffinch"
        ];

        LFSoundAdvice =
        [
                "Don't get mauled by a rabbit",
                "Pet a snake for me",
                "Bring me back a tin of Tactical bacon",
                "If you see any women let me know, this relentless sausage fest is starting to get me down",
                "Don't go all crazy Rambo and get shot ok"
        ];
        
        LFmedicsArr = [];
        
        LFengineerArr = [];
        
        LFHeloArr = [];

 

the helitaxi script itself "support\taxi\helotaxi.sqf":

 

Spoiler

/*
heli taxi script by lordfrith, adapted and rewritten from the awesome DUWS mission support chopper by KIBOT in accordance with the licence of duws which states:
"You can remix, tweak, and build upon my work non-commercially, as long as you credit me and license your creations under these same identical terms. "
usage:
written and tested in SP only

to add the support item place this line somewhere i.e. initPlayerLocal.sqf : helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;

in init.sqf:
/////////////USER VARIABLES//////////
// define chopper call sign
callsign = "Rabid Chaffinch";
////////////DO////////NOT////////EDIT//////BELOW//////////HERE
call compile preprocessFile "support\suptFunc.sqf";
helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
null = [] spawn LF_fnc_heliInit;


cost = true;
funds = 10000;

in description.ext:
class CfgCommunicationMenu
{
    class helo_taxi
    {
        text = "Support Menu"; // Text displayed in the menu and in a notification
        submenu = "#USER:MENU_SUPPORT_1";  // Submenu opened upon activation
        expression = "";
        icon = "\a3\ui_f\data\gui\cfg\hints\CallSupport_CA.paa";
        cursor = ""; // Custom cursor displayed when the item is selected
        enable = "1"; // Simple expression condition for enabling the item
        removeAfterExpressionCall = 1; // 1 to remove the item after calling
    };
     class reset_helo
    {
        text = "Reset Support Comms"; // Text displayed in the menu and in a notification
        submenu = "";  // Submenu opened upon activation
        expression = "LF_resetHelo = [helitaxi, helipad0, callsign] execVM 'support\HQ\resetCommsMenu.sqf'";
        icon = "";
        cursor = ""; // Custom cursor displayed when the item is selected
        enable = "1"; // Simple expression condition for enabling the item
        removeAfterExpressionCall = 1; // 1 to remove the item after calling
    };
};

in eden editor: place a chopper with crew and call it "helitaxi". place a helipad where you want your base to be and call it "helipad0".
*/
//declare and get variables
        private ["_helo", "_basePad", "_callsign", "_startPos", "_pickPos", "_dropPos"];

        _helo = _this select 0;
        _basePad = _this select 1;
        _callsign = _this select 2;
        _startPos = getPos _basePad;
        _pickPos = [];
        _dropPos = [];
        _pilot = driver _helo;
// global variables
        crashed = false;
        clicked = false;
        inVeh = false;
        _deArt = [player,helisup] call BIS_fnc_removeCommMenuItem;
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {};
        _music = call compile preprocessFile "support\taxi\random_music.sqf";
        _plName = name player;//not sure if in mp this will be the player who called action or different for each player
        _helogroup = group _pilot;
        _helotype = typeOf _helo;
        _helo flyInHeight 50;
        _pilot setcaptive true;
        resetsup = [player,"reset_helo"] call BIS_fnc_addCommMenuItem;
        sleep 1;
//remove any old waypoints
        while {(count (waypoints _helogroup)) > 0} do {
                deleteWaypoint ((waypoints _helogroup) select 0);
        };
//set animations to passenger config,
        [_helo, 1, 2] call LF_fnc_vehLoadOut;
        [_helo, 1, 3] call LF_fnc_vehLoadOut;
//check if helo is on base for Extraction point
        if (_helo distance player < 500) then {
                _pilot sideChat format["This is %1 to %2, we are ready for mission", _callsign, _plName];
                sleep 2;
                
                [_helotype, 3, "LZ"] call LF_fnc_mapClick;
            } else{
                _pilot sideChat format["This is %1 to %2, Click somewhere on your map to give me Extraction Point co-ordinates", _callsign, _plName];
                sleep 2;
                
                [_helotype, 1, "LZ"] call LF_fnc_mapClick;
        };
        _pickPos = getPos helipad1;
        sleep 1;
        
//ok now get the insertion point
        _pilot sideChat format["%1 to %2, click somewhere on your map to give me the Insertion Point",_callsign, _plName];
        sleep 2;
        
        [_helotype, 2, "DZ"] call LF_fnc_mapClick;
        _dropPos = getPos helipad2;
//check if cost active and if so mworkout journey
        sleep 2;
        
        if (_pickPos distance _dropPos <1000) exitWith {
                _pilot sideChat format["%1 to %2, route denied, distances of less than one Kilometer are not authorised",_callsign, _plName];
                sleep 5;
                deleteVehicle helipad1;
                deleteVehicle helipad2;
                deleteMarker str(StartMk);
                deleteMarker str(EndMk);
                helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
                _deRes = [player,resetsup] call BIS_fnc_removeCommMenuItem;
        };
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {[_pilot, _plName, _callsign,0] call LF_fnc_deadClean;};        
        if (cost) then {
                _pilot sideChat format["%1 to %2, solid copy, please await confirmation",_callsign,_plName];
                sleep 3;
                _pickDis = _helo distance _pickPos;
                if (_pickDis < 500) Then {_pickDis = 0};
                _tripDis = _pickPos distance _dropPos;
                _totalDis = _pickDis + _tripDis;
                _tripCost = [_totalDis*0.1, 2]call BIS_fnc_cutDecimals;
                if (funds < _totalDis) exitWith {
                        [west, "HQ"] sideChat format["This is HQ to %1, route denied, we've not got enough Euros",_plName];
                        sleep 14;
                        helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
                        _deRes = [player,resetsup] call BIS_fnc_removeCommMenuItem;
                };
                funds = funds - _tripCost;
                publicVariable  "funds";
                [west, "HQ"] sideChat format["This is HQ to %1, route confirmed, %2 estimates extraction to insertion is a trip of %3 meters. Total flight distance is %4 meters which will cost %5 Euros. We have %6 Euros remaining",_plName, _callsign, _tripDis, _totalDis, _tripCost, str funds];
        };
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {[_pilot, _plName, _callsign,0] call LF_fnc_deadClean;};
// if player is right by chopper start point just wait for player to get in
        if (_helo distance _pickPos < 500) then {
                _pilot sideChat format["This is %1 to %2, i am ready to move out",_callsign, _plName];
                [_helo, 0, 3] call LF_fnc_vehLoadOut;
                [_helo] call LF_fnc_inVehChck;
                waitUntil {(inVeh)}; sleep 1;
            } else {_pilot sideChat format["This is %1 to %2, solid copy, am moving out",_callsign, _plName];};
 // add waypoints
        _wp = _helogroup addWaypoint [[_pickPos select 0, _pickPos select 1], 0];
        _wp setWaypointType "MOVE";
        [_helogroup, 1] setWaypointCombatMode "BLUE";

        waitUntil {_pickPos distance _helo < 350 or (vehicle _pilot == _pilot or !alive _pilot)}; // wait until the helo is near the lz
        _pilot setcaptive false;
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {[_pilot, _plName, _callsign,0] call LF_fnc_deadClean;};
// spawn smokeshell, or don't if you called the chopper from right beside it
        if (_helo distance _pickPos>300) then {
                _pilot sideChat format["This is %1 to %2, we're approaching your position at %3, get ready to load up",_callsign,_plName, _pickPos];
                _smokePos = [_pickPos select 0, (_pickPos select 1)+ random 5];
                _smoke = "SmokeShellGreen" createVehicle _smokePos;
                _chemlight = "Chemlight_green" createVehicle _smokePos;
        };
        _helo land "LAND";
        [_helo, 0, 3] call LF_fnc_vehLoadOut;
// everything is ok, player is in choppa
        [_helo] call LF_fnc_inVehChck;
        
        waitUntil {(inVeh)or (vehicle _pilot == _pilot or !alive _pilot)};
        // IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {[_pilot, _plName, _callsign,0] call LF_fnc_deadClean;};
        playMusic [_music, 0];
        _helo vehicleChat format["hey %1 ready to roll? lets go",_plName];
        _wp = _helogroup addWaypoint [_dropPos,0];
        _wp setWaypointType "MOVE";
        [_helogroup, 1] setWaypointCombatMode "BLUE";
// wait until the helo is away from LZ add ermergency landing
        waitUntil {sleep 0.5;_helo distance _pickPos > 350  or (vehicle _pilot == _pilot or !alive _pilot)};
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {[_pilot, _plName, _callsign,0] call LF_fnc_deadClean;};
        _deRes = [player,resetsup] call BIS_fnc_removeCommMenuItem;
        sleep 0.5;
        
        _emrgncyLand = _helo addAction ["<t color='#00b7ff'>Land here</t>", "support\taxi\LandHere.sqf", [], 0, true, true, "", "true"];

        waitUntil {helipad2 distance _helo < 200  or (vehicle _pilot == _pilot or !alive _pilot)}; // wait until the helo is near the lz
        _helo vehicleChat format["wake up %1! we're approaching your location for drop off, get your shit together",_plName];
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {
                [_pilot, _plName, _callsign,1] call LF_fnc_deadClean;    
        };
//pilot commits to landing
        _helo land "LAND";
        sleep 5;
        _helo removeAction _emrgncyLand;
        resetsup = [player,"reset_helo"] call BIS_fnc_addCommMenuItem;
// time to move ppl out of the helo;
        waitUntil {(getpos _helo select 2 < 4 && _helo distance helipad2<20)  or (vehicle _pilot == _pilot or !alive _pilot)}; // wait until the helo is near the ground
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {
                [_pilot, _plName, _callsign,0] call LF_fnc_deadClean;
        };
        _phrasing = selectRandom LFSoundAdvice;
        _helo vehicleChat format["We've arrived at the LZ, good luck out there %1. %2",_plName, _phrasing];
        _helo lock false;
        {doGetOut _x; sleep 1;} forEach units group player;
        sleep 20;

        deleteVehicle helipad1;
        deleteVehicle helipad2;
        deleteMarker str(StartMk);
        deleteMarker str(EndMk);
// spawn the door opening script
        [_helo, 1, 3] call LF_fnc_vehLoadOut;
//if chopper is away from base RTB else turn everything back on
        if (_basepad distance _helo > 100) then {
                _pilot sideChat format["This is %1, we are RTB",_callsign];
                _wp = _helogroup addWaypoint [_basePad,0];   // tell the helo to RTB
                _wp setWaypointType "MOVE";

                waitUntil {_basePad distance _helo < 200  or (vehicle _pilot == _pilot or !alive _pilot)}; // wait until the helo is near the ground
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,0] call LF_fnc_deadClean;
                };
                _helo land "LAND";
                _time = time;
                
                waitUntil {(getpos _helo select 2 < 4 && _helo distance _basePad<20)  or (vehicle _pilot == _pilot or !alive _pilot) or (time > _time + 90)};
                // IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,0] call LF_fnc_deadClean;
                };
            } else {
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,0] call LF_fnc_deadClean;
                };
        };
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {
                [_pilot, _plName, _callsign,0] call LF_fnc_deadClean;
        };
        _helo land "LAND";
        [west, "HQ"] sideChat format["This is HQ to %1, %2 is back at base and ready for ops", _plName, _callsign];
        _helo setDammage 0;
        _helo Setfuel 1;
        sleep 5;
    
        helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
        _deRes = [player,resetsup] call BIS_fnc_removeCommMenuItem;

 

the "landhere" action "support\taxi\LandHere.sqf":

 

Spoiler

//_emrgncyLand = _helo addAction ["<t color='#00b7ff'>Land here</t>", "support\taxi\LandHere.sqf", [], 0, true, true, "", "true"];
//requires helotaxi.sqf to have started, moves end point to new location
        private ["_helo", "_caller","_landHere", "_helotype", "_plName", "_pilot", "_helogroup", "_currentPos", "_dropPos", "_oldDZ"];
        _helo = _this select 0;
        _caller = _this select 1;
        _landHere = _this select 2;
        _helotype = typeOf _helo;
        _plName = name _caller;
        _pilot = driver _helo;
        _helogroup = group _pilot;
        _currentPos = getPos _helo;
        _dropPos = [];
        _oldDZ = getPos helipad2;
//delete old waypoint and objects
        while {(count (waypoints _helogroup)) > 0} do
        {
            deleteWaypoint ((waypoints _helogroup) select 0);
        };
        deleteVehicle helipad2;
        deleteMarker str (EndMk);
 //open map to click new Dz
        _helo VehicleChat format["OK %1, click somewhere on your map to give me your new DZ", _plName];
        openMap [true, false];
        [_helotype, 2, "DZ"] call LF_fnc_mapClick;
        _dropPos = getPos helipad2;
        if (cost) then {
                _helo VehicleChat format["OK %1, we'll just run through the numbers and work that route cost out for you...", _plName];
                sleep 3;
    
                _cancelDis = _currentPos distance _oldDZ;
                _tripDis = _currentPos distance _dropPos;
                _refund = [_cancelDis*0.1, 2]call BIS_fnc_cutDecimals;
                _tripCost = [_TripDis*0.1, 2]call BIS_fnc_cutDecimals;
                funds = funds + _refund;
                funds = funds - _tripCost;
                if (funds < 0) Then {funds = 0;};
                publicVariable  "funds";
                [west, "HQ"] sideChat format["HQ to %1, change of route confirmed, new Insertion Point found. We've been refunded %2 Euro's and charged %3 Euro's for the new route of %4 meters. we have %5 Euro's remaining", _plName, _refund, _tripCost, _tripDis, str funds];
        };
        _wp = _helogroup addWaypoint [_dropPos,0];
        _wp setWaypointType "MOVE";
        [_helogroup, 1] setWaypointCombatMode "BLUE";

resetCommsMenu.sqf

 

Spoiler

/*
if shit gets weird you can use this command to try and reset the support menu. It terminates support script removes all objects/markers and tries to return helo to base
call with resetsup = [player,"reset_helo"] call BIS_fnc_addCommMenuItem;
*/
//declare and get variables
        private ["_helo", "_plName"];

        _helo = _this select 0;
        _basepad = _this select 1;
        _callsign = _this select 2;
        _pilot = driver _helo;
        _helogroup = group _helo;
        _plName = name player;//not sure if in mp this will be the player who called action or different for each player
        crashed = false;
        
        hint "WIP";
// kill support script        
        terminate LF_taxiScript;
        player sideChat format["This is %1 to HQ, somethings gone FUBAR with the comms support system, please advise",_plName];
        sleep 2;

        [west, "HQ"] sideChat format["This is HQ to %1, message confirmed, please hold, we're going to try turning it off and on again",_plName];
        sleep 2;
//clean out heli waypoints, actions and nav objects
        while {(count (waypoints _helogroup)) > 0} do
                {deleteWaypoint ((waypoints _helogroup) select 0);};
        //delete all the objects
        deleteVehicle helipad1;
        deleteVehicle helipad2;
        deleteMarker str(StartMk);
        deleteMarker str(EndMk);
// tell the helo to RTB
        if (_basepad distance _helo > 100) then {
                [west, "HQ"] sideChat format["This is HQ, we are calling %1 to RTB",_callsign];
                sleep 2;
    
                _helo vehicleChat format["This is %1, roger that, we are RTB",_callsign];    
                _wp = _helogroup addWaypoint [_basePad,0];   
                _wp setWaypointType "MOVE";
                waitUntil {_basePad distance _helo < 200  or (vehicle _pilot == _pilot or !alive _pilot)}; // wait until the helo is near the ground
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,1] call LF_fnc_deadClean;
                };
                _helo land "LAND";
                _time = Time;
                waitUntil {(getpos _helo select 2 < 4 && _helo distance _basePad<20)  or (vehicle _pilot == _pilot or !alive _pilot) or (Time > _time + 60)};
                [west, "HQ"] sideChat format["This is HQ to %1, %2 is back at base and ready for ops", _plName, _callsign];
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,1] call LF_fnc_deadClean;
                };
            } else {
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
                [_pilot] call LF_fnc_deadCheck;
                if (crashed) Exitwith {
                        [_pilot, _plName, _callsign,1] call LF_fnc_deadClean;
                };
                _helo land "LAND";
        };
// IF THE PILOT IS DEAD OR CHOPPA DOWN  **************
        [_pilot] call LF_fnc_deadCheck;
        if (crashed) Exitwith {
                [_pilot, _plName, _callsign,1] call LF_fnc_deadClean;
        };
//final reset if choppa ain't dead
        _helo land "LAND";
        _helo setDammage 0;
        _helo Setfuel 1;
        sleep 5;
        
        helisup = [player,"helo_taxi"] call BIS_fnc_addCommMenuItem;
        sleep 2;

        [west, "HQ"] sideChat format["HQ to %1, erm... did that fix the problem?",_plName];

 

KNOWN ISSUES:

        not tested in MP at all. i have no idea how chat/tasks/functions will be passed between server/client. again feedback appreciated.

        very occasionally chopper will not take off, still not managed to replicate this precisely so feedback appreciated

        my military radio protocal/terminology is... a little amatuer, input appreciated :D

        no chopper respawn, once its dead its gone!

 

TO DO:

        add functions for created submenu items (currently most menu options are just placeholder hints)

        start porting mission for MP

        add support for factions/different chopper animationSource

LICENCE:

        "You can remix, tweak, and build upon my work non-commercially, as long as you credit me and license your creations under these same identical terms."

CREDITS:
        kibot for original support scripts which have guided and inspired this one, still contains many snippets from his DUWS mission.
        The .sqf gurus of BIforums.
        PWNR: Adam mission editor, awesome tool and also comes with good helitaxi (learnt about "onSingleMapClick" from that)
        Lordfrith

 

CHANGELOG:
        1.1 update

                added submenu's
                added init option to change chopper name
                added chopper config functions
                added reset support item

                added support for funds. set cost = false; to disable

                reworked "LF_fnc_inVehChck" so it checks if whole player group is in vehicle
                reworked script flow so script can close if chopper is killed/gets stuck
                reworked dialogue with capitals and punctuation like i went to school.

                removed debug hints

                tried to tidy up the script a little
                did a bunch of other stuff i forgot as i was drunk.
                hopefully didn't break anything as i was drunk

        1.0 initial release

 

enjoy :D

Edited by lordfrith
update 1.1
  • Thanks 3

Share this post


Link to post
Share on other sites

Tried it out...AWESOME script. If I may suggest, would be cool if chopper wait for AI teammates to board before leaving, and when you click the map for DZ there's a hint that pop up which state that the click map function is executed (you probably forget to take it out after testing) or is intentional?)

Thank you for your work!!

  • Thanks 1

Share this post


Link to post
Share on other sites
7 hours ago, zagor64bz said:

If I may suggest, would be cool if chopper wait for AI teammates to board before leaving

 

i'm looking at that as the 'check if unit is in chopper' function (LF_fnc_inVehChck) doesn't always work as intended. any ideas on conditions to check would be good. note that if helo lifts off before everyones in it can usually be forced to land with an AI 'get in' command.

 

7 hours ago, zagor64bz said:

is intentional?

nope :D i accidentally left a bunch of debug hints in, will remove them in update

 

thanks for the feedback!

  • Thanks 1

Share this post


Link to post
Share on other sites
On 17/01/2018 at 4:40 AM, lordfrith said:

totally master and become recognized world expert in MP scripting

 

Looking forward to this !

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

ok so... first update

 

Updated download in OP.

 

the in vehicle check now waits till all player group is in chopper.

 

added the ability to reset the support menu if something breaks.

 

did a whole bunch of testing to try to make sure things don't break in the first place.

 

also you can now define your own helo callsign in init.sqf in case for some reason you aren't as amused by "rabid chaffinch" as i am????

 

Made some good progress figuring out communicationmenu submenus so theres a whole bunch of new empty options that trigger placeholder hints, its going to be kind of annoying until i can add more features in so bear with me.

 

EDIT: oops i forgot!

Added support for journeys to cost money, will work out journey cost and then adjust as route is changed. money is stored in global variable "funds". can be disabled by setting "cost = false;" in init.sqf in case you like a free ride ;)

 

Also figured out finding and setting animation sources so its possible to add/ remove seats/benches as required and even turn the humble MH9 into a gunship! raises possiilty of using same MH9 for CAS missions!

 

 

 

Spoiler

helitaxi animateSource ["hiderockets",0];
helitaxi animateSource ["hideweapons",0];
helitaxi animateSource ["addgunholder",1];
helitaxi animateSource ["addholdingframe",1];
helitaxi animateSource ["addBackseats",0];
helitaxi animateSource ["addTread",0];
helitaxi animateSource ["addBenches",0];
helitaxi lockCargo true;

 

hope it works ok! as always thanks for using, any feedback greatly appreciated :D

 

1.1 update

                added submenu's
                added init option to change chopper name
                added chopper config functions
                added reset support item

                added support for funds. set cost = false; to disable

                reworked "LF_fnc_inVehChck" so it checks if whole player group is in vehicle
                reworked script flow so script can close if chopper is killed/gets stuck
                reworked dialogue with capitals and punctuation like i went to school.

                removed debug hints

                tried to tidy up the script a little
                did a bunch of other stuff i forgot as i was drunk.
                hopefully didn't break anything as i was drunk

Edited by lordfrith
murp, i forgot...
  • Thanks 1

Share this post


Link to post
Share on other sites

Good news man....but..... sorry to be the one bro...you sure links is correct?

I get the "404"  error...!

  • Like 1

Share this post


Link to post
Share on other sites

i think you got this before OP was updated so it'll still be trying to grab the original DL, try again?

  • Thanks 1

Share this post


Link to post
Share on other sites

I'd like feedback on adding new features and any thoughts on the submenu options and how they should work/ what they should do etc...

 

but i also want the script to be available without a bunch of WIP stuff so here:

 

basic single menu setup that will just do helo transport

  • Like 1

Share this post


Link to post
Share on other sites

Awesome script so far.

Would you contemplate making MP or dedicated compatible?

 

A few suggestions.

 

Anyway to add support for Duda's rappelling script for players and AI? Especially when the using as transport and "drop off an AI squad"

https://github.com/sethduda/AdvancedRappelling

 

Under support, instead of just a jet ski or atv, have the player be able to pick from multiple assets depending on the size of the chopper. It would be nice to have a prowler or cheetah, etc as an option to be dropped.

 

Having the ability to have multiple aircraft with different calls signs utilize this script at the same time would be cool. 

Example, I have one helo as transport and 2 AH-9 as escort and they CAS the area as we land near it.

 

I really like all of the "planned" things you have for this script.

 

Thank you for your very hard work so far and I cant wait tit rack your progress.

 

Reed

 

 

  • Like 1

Share this post


Link to post
Share on other sites

@Jnr4817

 

On 1/19/2018 at 9:34 PM, Jnr4817 said:

Would you contemplate making MP or dedicated compatible?

well i had my first chance to test in MP over the weekend and... can confirm it totally does not work in MP! the state changes/chat etc don't pass at all which kinda breaks it. After doing some .sqf homework on  remoExec and functions i'm rewriting the whole thing from the ground up :D  hopefully this should make it optimized and MP ready...

 

On 1/19/2018 at 9:34 PM, Jnr4817 said:

Under support, instead of just a jet ski or atv, have the player be able to pick from multiple assets depending on the size of the chopper.

just started looking into slingloading but i think it would be possible to have a 'Move this object' option which would find the nearest 'crate' or 'car' to user mapclick and then try to lift that. then mapclick again for drop off point.
 

On 1/19/2018 at 9:34 PM, Jnr4817 said:

Anyway to add support for Duda's rappelling script for players and AI? Especially when the using as transport and "drop off an AI squad

hmm not added the AI drop off yet but would be cool to them rappalling down to join you, also easy enough i think to add a 'disembark by rappelling' option for player once in chopper

 

 

On 1/19/2018 at 9:34 PM, Jnr4817 said:

Having the ability to have multiple aircraft with different calls signs utilize this script at the same time would be cool. 

Example, I have one helo as transport and 2 AH-9 as escort and they CAS the area as we land near it.

i'm looking into callsigns right now, i'd like to set up custom radio channels the custom callsigns show up properly on sidechat.

 

re the escort: i suppose i could also add an option to define escort choppers also, then if they are present give them corresponding orders as the script plays through.

 

With the prospect of adding all these fun options i'm wondering how to do it without having endless support menus within menus.

 

some good feedback there thanks man , a lot to think about!

  • Like 3

Share this post


Link to post
Share on other sites

Realy cool! But not work in multy player. I cry!

 

Tank's for this work

  • Thanks 1

Share this post


Link to post
Share on other sites

 

When will you come out with the next update? Your script is just beautiful !!!  :f:

Share this post


Link to post
Share on other sites
On 7/3/2018 at 8:21 PM, Danidan said:

Realy cool! But not work in multy player

 

1 hour ago, Sayker said:

Your script is just beautiful !!! 

 

thanks for checking out the script folks, glad you liked it :D

 

I've done quite a lot more on this but never really got it back to something release ready; i rewrote the whole thing into nice sexy functions, i'm trying to streamline the pilot chat a little and i got it working in Multi player.

 

I'll see if i can find the test mission and polish it up for an update sometime in the vaguely near/middle future.

  • Thanks 2

Share this post


Link to post
Share on other sites

This needs to run on server because of client disconnect possibility.

Do i have an permission to rewrite this to server side for my proposes?

Share this post


Link to post
Share on other sites
9 hours ago, davidoss said:

Do i have an permission to rewrite this to server side for my proposes?

yeah sure...

 

i got it working by running it serverside but for clients to be able to order heli about properly i had to temporarily transfer group ownership to the client machine. i think that was it anyway, i'm not home just now so i can't check.  good luck :D

Share this post


Link to post
Share on other sites

on my dedicated server, the chopper stay at 30 feet meter above the point.... do you have any idea ? :///

Share this post


Link to post
Share on other sites
1 hour ago, Sayker said:

on my dedicated server, the chopper stay at 30 feet meter above the point.... do you have any idea ?

 

i think that'll be the problem i mentioned to davidoss above, the dedicated server will be the group owner so for any client to use the support menu group ownership of the 'helitaxi' needs to be switched to the client or the pilots don't obey the script commands properly, annoyingly especially landing.

 

something like this needs to happen when somebody calls the support menu :

 

Quote

if (isServer) then {vehOwner = 2;} else {vehOwner = clientOwner;};
        PublicVariableServer "vehOwner";

 

then use setGroupOwner

 

Quote

        _heloGrp setGroupOwner _vehOwner;

 

If you've ever used the awesome ADAM mission maker this was how they did it in the built in helitaxi script, i'd post my whole solution but i'm checking out the script just now and its tangled up with a bunch of other stuff i was testing, i'm having to extract the heli script from the mission and start again :(

Share this post


Link to post
Share on other sites

yeah it's really strange because on solo there is no problem... :/

Share this post


Link to post
Share on other sites

Actually, everyone can give DZ, but when Chopper at above this point he stays at 30feet meter.. 

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

×