Steerable parachutes?

lazyink

Valued Member!
Staff member
I have been looking into how I can swap out all parachutes for steerable ones, but have been running into some problems.

I have tried the following:

Created a steerable.sqf in my mission.pbo which is called from init.sqf under if (!isDedicated).

steerable.sqf

Code:
private ["_old","_new"];
 
while {player alive} do {
    if ((typeOf (vehicle player)) in ["ParachuteWest"]) then
    {   
        _old = vehicle player;
        deleteVehicle _old;
        _new = createVehicle ["BIS_Steerable_Parachute", position player,[],0,"FLY"];
        waitUntil {not (isNil "_new")};
        _new setPos (position player);
        _new setDir (direction player);
        player moveInGunner _new;
        player switchMove "para_pilot";
        [_new, player] execVM "fixes\parachute.sqf";
        sleep 0.001;
        _new lock true;
        sleep 1;
    };
}

This then calls parachute.sqf

parachute.sqf

Code:
_para_unit = _this select 1;
hintsilent "";
 
f_steerChute = {
 
_camera = "camera" camcreate [6000,6000,0];
_camera camcommand "manual on";
_camera camcommand "inertia off";
_turn = 0;
_decend = -2;
_setTurn = 0;
_currentTurn = 0;
_speed = 5;
 
while {(alive _para_unit) && (position _para_unit select 2 >= 1)} do {
 
_oldDir = (getDir _chute);
_camPosOld = position _camera;
_camera camSetDir _oldDir;
_camera camcommit 0;
sleep 0.001;
_x = ((position _camera) select 0) - (_camPosOld select 0);
_y = ((position _camera) select 1) - (_camPosOld select 1);
 
   if ((abs _x) > 0.01) then {
if ((abs (_turn + _x)) < 8) then {
_turn = _turn + _x;
};
};
 
 
if ((abs _y) > 0.01) then {
if (((_speed + _y) < 15) && ((_speed +_y) > 0)) then {
_speed = _speed + _y;
_decend = -(2 + (_speed / 6));
};
};
 
if ((abs _turn) < 0.1) then {
_turn = 0;
_setTurn = 0;
} else {
_turn = 0.90 * _turn;
_setTurn = _turn * 10;
};
 
_newDir = (_oldDir + _turn);
 
if (_setTurn != _currentTurn) then {
_currentTurn = _currentTurn  + (_setTurn - _currentTurn) * 0.1;
};
 
_nDs = sin _newDir; _nDc = cos _newDir;
_nTs = sin _currentTurn; _nTc = cos _currentTurn;
(vehicle _para_unit) setVectorDirAndUp [[_nDs,_nDc, 0],[_nDc * _nTs,-_nDs * _nTs,_nTc]];
 
_chute setVelocity [_speed * _nDs, _speed * _nDc, _decend];
 
if ( position _para_unit select 2 <= 2 ) then
{
            _para_unit allowDamage false;
_para_unit action [ "eject", _chute];
            _chute animate [ "hide_chute", 1 ];
deleteVehicle _chute;
_para_unit setdammage 0;
_para_unit setvelocity [0, 0, 0];  
_para_unit setpos [ getpos _para_unit select 0, getpos _para_unit select 1, 0];   
            "RadialBlur" ppEffectAdjust [0.0, 0.0, 0.0, 0.0]; "RadialBlur" ppEffectCommit 1.0; "RadialBlur" ppEffectEnable false;      
titleCut ["", "BLACK FADED", 100];
            sleep 2.0;
            titleCut ["", "BLACK IN", 2];
   _para_unit allowDamage true;
};
 
 
if ( ! alive _para_unit ) then
   {
       _chute animate [ "hide_chute", 1 ];
            _para_unit action [ "getout", _chute];
            deleteVehicle _chute;
   };
 
 
 
};
};
 
f_main = {
 
private ["_camera"];
_chute = vehicle _para_unit;
 
[] call f_steerChute;
 
if (! alive _para_unit) then {sleep 10;};
 
if ((typeOf _camera) == "camera") then {
_camera camcommand "manual off";
_camera camcommand "inertia on";
camdestroy _camera;
};
};
 
if ((_this select 0) == vehicle _para_unit)then {[] call f_main};

Am I on the right track?





 
Code:
 _old = vehicle player;
shouldn't _old = ParachuteWest;
Otherwise you are deleting the player
 
Back
Top