Announcement

Collapse
No announcement yet.

Custom farps

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom farps

    a bunch of these probably exist but whatever
    had a small request for a custom farp so i whipped one up real quick
    this version is meant to be attached to a crate or something

    calling script:
    Code:
    _handle = [player, <desired farp>, ""] execVM "farp_Yink.sqf";
    the first and third values are unused for right now.
    right now its set to only RRR air vehicles.

    farp_Yink.sqf
    Code:
    /*
    
    made by: Yink
    for TG
    
    
    */
    
    _caller        = player;
    _target        = _this select 1;
    _type         =  _this select 2;
    _caller setVariable ["type", _type];
    
    
    
    _fnc_activate_Yink = {
        _caller     = _this select 0;
        _target     = _this select 1;
        _fncArr        = _this select 2;
        _reaction    = _fncArr select 4;
    
        while {alive _caller} do {
            {
                _caller removeAction _x;
            } forEach (_caller getVariable "RRR");
            hintSilent "Rearm, Repair, Refuel not Available!";
    
            objNull spawn {
                sleep 3;
                hintSilent "";
            };
    
            waitUntil {(_caller distance _target)<15};
            _fncArr call _reaction;
            hintSilent "Rearm, Repair, Refuel Available!";
    
            objNull spawn {
                sleep 3;
                hintSilent "";
            };
    
            waitUntil {(_caller distance _target)>=15};
        };
    
    
    
    };
    
    _fnc_repair_Yink = {
        _veh     = vehicle (_this select 1);
        _crate     = _this select 0;
        _hp     = damage _veh;
        _veh engineOn false;
    
        while {(((damage _veh)>0)&&((_veh distance _crate)<15)&&(!(isEngineOn _veh)))} do {
            sleep 0.5;
            _veh setDamage ((damage _veh) - 0.0125);
            _string1 = (format["Repair Status: %1",round ((1 - (damage _veh))*100)]);
            _string1 = _string1 + "%";
            hintSilent _string1;
        };
        if (!(isEngineOn _veh)) then {    
            hint "Repair Complete!";
        } else {
            hint "Repair Stopped!";
        };
    
    };
    
    
    _fnc_rearm_Yink = {
        _veh     = vehicle (_this select 1);
        _crate     = _this select 0;
        _hp     = damage _veh;
        _string    = "";
        _weapons = weapons _veh;
        _veh engineOn false;
    
        {
            for [{_i=0}, {_i < 20}, {_i = _i + 1}] do {
                if (!(isEngineOn _veh)) then {
                    sleep 0.25;
                    if (_string != ".....") then {
                        _string = _string + ".";
                    } else {
                        _string = ".";
                    };
                    hintSilent format["Rearming %1%2",_x, _string];
                } else {
                    _i = 999;
                    hint "Rearming Stopped!";
                };
            };
            if (!(isEngineOn _veh)) then {
                _veh setAmmo [_x, 9999999];
                hint "Rearm Complete!";
            };
        } forEach _weapons;
    
    
    };
    
    _fnc_refuel_Yink = {
        _veh     = vehicle (_this select 1);
        _crate     = _this select 0;
        _hp     = damage _veh;
        _veh engineOn false;
    
        while {(((fuel _veh)<1)&&((_veh distance _crate)<15)&&(!(isEngineOn _veh)))} do {
            sleep 0.5;
            _veh setFuel ((fuel _veh) + 0.0125);
            _string1 = (format["Refuel Status: %1",round (((fuel _veh))*100)]);
            _string1 = _string1 + "%";
            hintSilent _string1;
        };
    
        if ((fuel _veh)!=1) then {
            hint "Refueling Stopped!";
        } else {
            hint "Refuel Complete!";
        };
    };
    
    
    
    _fnc_Action_Yink = {
        _target     = _this select 0;
        _caller     = _this select 1;
        _reaction    = ((_this select 3) select 1) select 4;
        _tempArr     = _caller getVariable "RRR";
        _fncArr        = ((_this select 3) select 1);
        {
            _target removeAction _x;
        } forEach (_target getVariable "RRR");
    
        _handle = [_this select 0,_this select 1, _this select 2] call ((_this select 3) select 0);
    
        if ((_target distance _caller)<15) then {
            _fncArr call _reaction;
        };
    
    };
    
    
    _fnc_reaction_Yink = {
    _fnc_repair_Yink     = _this select 0;
    _fnc_refuel_Yink     = _this select 1;
    _fnc_rearm_Yink     = _this select 2;
    _fnc_Action_Yink     = _this select 3;
    _fnc_reaction_Yink    = _this select 4;
    _crate                = _this select 5;
    _caller                = _this select 6;
    _type                = _this select 7;
    _fncArr                =    [
                                _fnc_repair_Yink    ,
                                _fnc_refuel_Yink    ,
                                _fnc_rearm_Yink        ,
                                _fnc_Action_Yink    ,
                                _fnc_reaction_Yink    ,
                                _crate,
                                _caller,
                                _type
                            ];
    
        if (_caller == (driver (vehicle _caller))) then {
    
            _repair = _caller addAction [
                "<t color='#FFD700'>Repair</t>",
                _fnc_Action_Yink,
                [_fnc_repair_Yink, _fncArr],
                0,
                true,
                true,
                "",
                "((vehicle _this)!=(_this))",
                15,
                false
            ];
    
            _refuel = _caller addAction [
                "<t color='#FFD700'>Refuel</t>",
                _fnc_Action_Yink,
                [_fnc_refuel_Yink, _fncArr],
                0,
                true,
                true,
                "",
                "((vehicle _this)!=(_this))",
                15,
                false
            ];
    
            _rearm = _caller addAction [
                "<t color='#FFD700'>Rearm</t>",
                _fnc_Action_Yink,
                [_fnc_rearm_Yink, _fncArr],
                0,
                true,
                true,
                "",
                "((vehicle _this)!=(_this))",
                15,
                false
            ];
            _caller setVariable ["RRR",[_repair,_rearm,_refuel]];
        };
    };
    
    [
        _caller,
        _target,
        [
            _fnc_repair_Yink    ,
            _fnc_refuel_Yink    ,
            _fnc_rearm_Yink        ,
            _fnc_Action_Yink    ,
            _fnc_reaction_Yink    ,
            _target                ,
            _caller                ,
            _type
        ]
    ]    call _fnc_activate_Yink;
    if someone wants one that you just drive up on and get all fixed up i can whip that up too
    Last edited by Yink; 02-27-2017, 11:01 PM.
    Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team


  • #2
    I seem to be having trouble with the rearming portion of the script. I am trying to use this for a Hellcat, however, It will not rearm the helicopter. It seems to only try and rearm the "fakehorn".
    I wasn't originally going to get a brain transplant, but then I changed my mind.

    Comment


    • #3
      make sure that youre rearming a non-unarmed hellcat.
      looking at cfgVehicles at https://community.bistudio.com/wiki/...gVehicles_GUER there are two types.
      Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

      Comment

      Connect

      Collapse

      TeamSpeak 3 Server

      Collapse

      Advertisement

      Collapse

      Twitter Feed

      Collapse

      Working...
      X