Jump to content
Grumpy Old Man

[Release] GOM - Skydive from car and paraglide

Recommended Posts

GOM_fnc_skydivingCar 1.0 and GOM_fnc_paraglide 1.1


by Grumpy Old Man




Purpose of these scripts:

Enable players to parachute out of an airborne car (Island best suited for this = Isla Abramia by icebreakr),

also allow players to paraglide using a parachute backpack and a short sprint.

 

 

I made these scripts as a little side project,

some of you already know what I'm working on,

the rest of you will see it in the foreseeable future, heh.

 

Features:

GOM_fnc_skydivingCar will safely add a parachute to units leaving a vehicle mid-air, it will also eject AI units from the same group as the player, as soon as the player ejects.

GOM_fnc_paraglide will work if the unit has a parachute backpack equipped and is sprinting for a short amount of time (default 3 seconds).

When doing this on a slope you're pretty much guaranteed of getting airborne.

 

How to use this script:
At first copy the spoiler contents into 2 files and name them accordingly.

 

GOM_fnc_skydivingCar.sqf:

params ["_veh",["_boom",false]];
_veh setvariable ["GOM_fnc_skydivingCarBoom",_boom];
_veh addEventHandler ["GetOut",{

    _spawn = _this spawn {

        params ["_veh","","_unit"];
        _unit setvariable ["GOM_fnc_jumping",true];

        if !(isTouchingGround _veh) then {

            waituntil {vehicle _unit isEqualTo _unit};
            _dir = getDir _veh;
            _unit allowdamage false;
            _unit switchmove "AfalPercMstpSnonWnonDnon";
            _unit setdir _dir;
            sleep 0.3;

            if (count units group _unit > 1) then {

                {

                    _jump = _x spawn {

                        if (_this getvariable ["GOM_fnc_jumping",false] OR _this isEqualTo player) exitwith {true};

                        sleep random [0.2,0.3,0.5];
                        moveOut _this;
                        true

                    };

                } foreach (units group _unit - [_unit]);

            };

            _pos = getPosATL _unit;
            _chute = "Steerable_Parachute_F" createVehicle _pos;
            _chute setdir _dir;
            _chute setposATL _pos;
            _unit moveindriver _chute;
            _unit allowdamage true;
            if (_veh getvariable ["GOM_fnc_skydivingCarBoom",false]) then {

                waituntil {isTouchingGround _veh};
                _veh setdamage 1;
                _vel = velocity _veh;
                _vel params ["_vx","_vy","_vz"];
                _veh setvelocity [_vx,_vy,_vz + 5];

            };

        };
    true
    };

}];
true

In the editor place:

  1. Player unit
  2. Car
  3. (Optional) a Ramp
  4. In the cars init field put: nul = [this,true] execVM "GOM_fnc_skydivingcar.sqf";
  5. Drive over a ramp or anything else suitable to get the car airborne
  6. Eject mid-air

Parameters:

Vehicle

Bool for destroying the car after jumping out (true,false).

 

----------------------------------------------------------------------

 

GOM_fnc_paraglide.sqf:

params ["_unit",["_records",false]];

if !(backpack _unit isEqualTo "B_Parachute") exitWith {hint "Equip a valid backpack first";true};
waituntil {_unit isEqualTo vehicle _unit};

while {_unit isEqualTo vehicle _unit} do {

    waituntil {speed _unit > 20};

    sleep 3;

    if (speed _unit > 20 AND isTouchingGround _unit) then {

        _pos = getPosASL _unit; _pos set [2,(_pos select 2) + 4];
         _chute = "Steerable_Parachute_F" createVehicle [0,0,500];
        _chute setdir getdir _unit;
        _unit allowdamage false;
        _chute setposASL _pos;
        _chute setvelocity velocity player;
        _unit moveindriver _chute;
        _unit allowdamage true;

        if (_records) then {

            _stats = [_unit] spawn {

                params ["_unit"];
                _flighttime = 0;
                _distance = 0;
                _displayflightTime = "";
                _pos = getposASL vehicle _unit;
                _startTime = time;
                _distance = 0;

                while {alive _unit AND !(_unit isEqualTo vehicle _unit)} do {

                uiSleep 0.01;
                _flighttime = time - _startTime;
                _displayflightTime = [(_flighttime / 3600),"HH:MM:SS"] call BIS_fnc_timetostring;
                _distance = _distance + (_pos distance (getposASL vehicle _unit));
                _pos = getPosASL vehicle _unit;
                _windspeed = vectorMagnitude wind * 3.6;
                hintsilent format ["Windspeed: %1km/h.\nDirection: %2°.\n\nTime airborne: %3.\nDistance traveled: %4m.",round _windspeed,round winddir,_displayflightTime,round _distance];
                };


                _oldRecord = profileNamespace getVariable ["GOM_fnc_paraglideRecord",[]];

                if (_oldRecord isEqualTo []) then {

                    systemchat format ["%1 finished his first paraglide! Flight time: %2! Distance: %3 meters! Congratulations!",name _unit,_displayflightTime,round _distance];
                    profileNamespace setVariable ["GOM_fnc_paraglideRecord",[_flightTime,_distance]];
                    player setVariable ["GOM_fnc_paraglideRecord",[_flightTime,_distance]];

                } else {

                    _oldRecord = profileNamespace getVariable ["GOM_fnc_paraglideRecord",[0,0]];
                    _oldRecord params ["_oldFlightTime","_oldDistance"];
                    _text1 = "";
                    _text2 = "";
                    _setTime = _oldFlightTime;
                    _setdistance = _oldDistance;
                    _displayflightTime = [(_flighttime / 3600),"HH:MM:SS"] call BIS_fnc_timetostring;
                    _displayOldflightTime = [(_oldFlightTime / 3600),"HH:MM:SS"] call BIS_fnc_timetostring;

                    if (_oldFlightTime > _flighttime) then {_text1 = format ["Unfortunately he couldn't beat his old flight time record which still stands at %1!",_displayOldflightTime]} else {_text1 = format ["He beat his old flight time record of %1, the new one stands at %2!",_displayOldflightTime,_displayflightTime];_setTime = _flighttime;};

                    if (_oldDistance > _distance) then {_text2 = format ["His old distance record remains to be beaten, which is a whopping %1 meters!",round _oldDistance]} else {_text2 = format ["His old distance record of %1 meters has been beaten, the new one is a whopping %2 meters!",round _oldDistance,round _distance];_setdistance = _distance;};

                    profileNamespace setVariable ["GOM_fnc_paraglideRecord",[_setTime,_setdistance]];
                    player setVariable ["GOM_fnc_paraglideRecord",[_setTime,_setdistance]];
                    systemchat format ["%1 finished a new paraglide flight!",name player];
                    systemchat _text1;
                    systemchat _text2;

                };

            true
            };

        };

    };

};

true

In the editor place:

  1. Player unit
  2. In the players init field put: nul = [this] execVM "GOM_fnc_paraglide.sqf";
  3. Run downhill on a slight downward slope without a weapon (be above 20km/h for the parachute to open)
  4. (Optional) Use second parameter to enable record tracking (longest distance, longest duration airborne)

 

Update 1.1:

Added display of wind speed, wind direction, time airborne and distance travelled during flight to GOM_fnc_paraglide.

 

Thanks:

Wanted to thank icebreakr for constantly releasing awesome and inspiring maps for free, his most recent release of Isla Abramia inspired me to work on these 2 small scripts.

Same goes to LordJarhead who is constantly updating and maintaining one hell of a mod.

 

A lot of people would have long stopped playing arma if it were not for those 2 guys, thanks for all your effort.

 

Enjoy!

  • Like 9

Share this post


Link to post
Share on other sites

Updated GOM_fnc_paraglide.

Could expand it for serverwide flight comparison if there's interest.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Hey GOM, great work with this script...I'm already thinking a SP mission to take advantage of it.

Just one question:

There's any way to have AI teammates to follow you in paragliding?

Example scenario: you and your AI team achieve your objectives on top of high mountain and "exfil" AO by paragliding  to extraction area. Possible?

Share this post


Link to post
Share on other sites

AI in parachutes are usually trouble, most of the time they slam into the ground, killing themselves.

On top of that they can't keep formation when in a parachute. Maybe there's a solution forcing them to stay in formation with setvelocity, but that sure would look wonky as heck.

If I find a solution I'll post it here.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

AI in parachutes are usually trouble, most of the time they slam into the ground, killing themselves......

 

Cheers

If I may, maybe you could give them a "allowDamage false" while they are on the air until they touch the ground...like some HALO mods do?

Share this post


Link to post
Share on other sites

I usually solve this with an eventhandler, check if the unit is inside a parachute vehicle and the damage being inflicted by the unit itself.

This way you can still have hostile units take out troops in parachutes.

    _noCollisionEH = _unit addEventHandler ["HandleDamage",{
    params["_unit","_selection","_damage","_damageCause"];
    _return = _damage;
    if (vehicle _unit isEqualTo vehicle _damageCause) then {_return = 0};
    _return
    }];

This still won't resolve the AI pathfinding though, when in parachutes they seem to aim straight to the ground, ignoring all waypoints/move orders.

 

Cheers

  • Like 1

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

×