Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for jump out to alternate doors as well as keeping the jump out position random #1215

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cScripts/functions/mission/fn_addHaloJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@
* Arguments:
* 0: Vehicle <OBJECT>
* 1: Minimum altetude <NUMBER> (Optional) (Default; 5000)
* 4: Chute Vehicle Class <OBJECT> (Optional) (Default; "B_Parachute")
* 2: Chute Vehicle Class <OBJECT> (Optional) (Default; "B_Parachute")
* 3: Staggared Jump <BOOL> (Optional) [Default; false]
*
* Example:
* ["my_c130"] call cScripts_fnc_addHaloJump
* ["my_c130", 5000] call cScripts_fnc_addHaloJump
* ["my_c130", 5000, "B_Parachute"] call cScripts_fnc_addHaloJump
* ["my_c130", 5000, "B_Parachute", false] call cScripts_fnc_addHaloJump
*
*/

params [
["_vehicle", objNull, [objNull]],
["_minAltetude", 5000, [5000]],
["_chuteBackpackClass", "B_Parachute", ["B_Parachute"]]
["_chuteBackpackClass", "B_Parachute", ["B_Parachute"]],
["_allowStaggared", false, [false]]
];

// Check so the options arent added twice.
Expand Down Expand Up @@ -52,14 +54,14 @@ private _actionID = [
{},
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_chuteBackpackClass"];
[_caller, _target, _chuteBackpackClass] call EFUNC(para,haloJump)
_arguments params ["_chuteBackpackClass", "_allowStaggared"];
[_caller, _target, _chuteBackpackClass, _allowStaggared] call EFUNC(para,haloJump)
},
{},
[_chuteBackpackClass],
[_chuteBackpackClass, _allowStaggared],
0,
25,
false
] call BIS_fnc_holdActionAdd;

_vehicle setVariable [QEGVAR(VehicleFunc,HaloAction), [_vehicle, _actionID, _minAltetude, _chuteBackpackClass]];
_vehicle setVariable [QEGVAR(VehicleFunc,HaloAction), [_vehicle, _actionID, _minAltetude, _chuteBackpackClass, _allowStaggared]];
16 changes: 9 additions & 7 deletions cScripts/functions/mission/fn_addLineJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
* 2: Maximum altetude <NUMBER> (Optional) (Default; 350)
* 3: Maximum speed <NUMBER> (Optional) (Default; 310)
* 4: Chute Vehicle Class <OBJECT> (Optional) (Default; "rhs_d6_Parachute")
* 5: Staggared Jump <BOOL> (Optional) [Default; false]
*
* Example:
* ["my_c130"] call cScripts_fnc_addLineJump
* ["my_c130", 180] call cScripts_fnc_addLineJump
* ["my_c130", 180, 350, 300] call cScripts_fnc_addLineJump
* ["my_c130", 180, 350, 300, "rhs_d6_Parachute"] call cScripts_fnc_addLineJump
* ["my_c130", 180, 350, 310] call cScripts_fnc_addLineJump
* ["my_c130", 180, 350, 310, "rhs_d6_Parachute", false] call cScripts_fnc_addLineJump
*
*/

Expand All @@ -23,7 +24,8 @@ params [
["_minAltetude", 180, [180]],
["_maxAltetude", 350, [350]],
["_maxSpeed", 310, [310]],
["_chuteVehicleClass", "rhs_d6_Parachute", ["rhs_d6_Parachute"]]
["_chuteVehicleClass", "rhs_d6_Parachute", ["rhs_d6_Parachute"]],
["_allowStaggared", false, [false]]
];

// Check so the options arent added twice.
Expand Down Expand Up @@ -57,14 +59,14 @@ private _actionID = [
{},
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_chuteVehicleClass"];
[_caller, _target, _chuteVehicleClass] call EFUNC(para,lineJump)
_arguments params ["_chuteVehicleClass", "_allowStaggared"];
[_caller, _target, _chuteVehicleClass, _allowStaggared] call EFUNC(para,lineJump)
},
{},
[_chuteVehicleClass],
[_chuteVehicleClass, _allowStaggared],
0,
25,
false
] call BIS_fnc_holdActionAdd;

_vehicle setVariable [QEGVAR(VehicleFunc,JumpAction), [_vehicle, _actionID, _minAltetude, _maxAltetude, _maxSpeed, _chuteVehicleClass]];
_vehicle setVariable [QEGVAR(VehicleFunc,JumpAction), [_vehicle, _actionID, _minAltetude, _maxAltetude, _maxSpeed, _chuteVehicleClass, _allowStaggared]];
31 changes: 24 additions & 7 deletions cScripts/functions/systems/fn_para_haloJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,43 @@
* 0: Player <player>
* 1: Vehicle <OBJECT>
* 2: Chute Vehicle <OBJECT> (Optional) [Default; "NonSteerable_Parachute_F"]
* 3: Staggared Jump <BOOL> (Optional) [Default; false]
*
* Example:
* ["bob","my_C130"] call cScripts_fnc_para_haloJump
* ["bob","my_C130", "NonSteerable_Parachute_F"] call cScripts_fnc_para_haloJump
* ["bob","my_C130", "NonSteerable_Parachute_F", false] call cScripts_fnc_para_haloJump
*
*/

params [
["_player", objNull, [objNull]],
["_vehicle", objNull, [objNull]],
["_chuteBackpackClass", "B_Parachute"]
["_chuteBackpackClass", "B_Parachute"],
["_allowStaggared", false, [false]]
];

private _offset = if (_allowStaggared) then {
if (GETVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),true)) then {
12+(random [-5,0,5]);
} else {
-12+(random [-5,0,5]);
};
} else {
random [-14,0,14];
};

if (_allowStaggared) then {
private _side = GETVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),true);
SETPVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),!_side);
};

_player allowDamage false;

private _dir = getDir _vehicle - 50;
moveOut _player;
private _pos = ([_vehicle, 14, ((getDir _vehicle) + 180 + 8)] call BIS_fnc_relPos);
_pos = [_pos select 0, _pos select 1, ((getPosATL _vehicle) select 2)];
_player setPosATL _pos;
private _dir = getDir _vehicle - 50;
moveOut _player;
private _pos = ([_vehicle, 14, ((getDir _vehicle) + 180 + _offset)] call BIS_fnc_relPos);
_pos = [_pos#0, _pos#1, ((getPosATL _vehicle)#2)];;
_player setPosATL _pos;
_player setDir _dir - 140;

sleep 1.5;
Expand Down
32 changes: 25 additions & 7 deletions cScripts/functions/systems/fn_para_lineJump.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,43 @@
* 0: Player <PLAYER>
* 1: Vehicle <OBJECT>
* 2: Chute Vehicle <OBJECT> (Optional) [Default; "NonSteerable_Parachute_F"]
* 3: Staggared Jump <BOOL> (Optional) [Default; false]
*
* Example:
* ["bob","my_C130"] call cScripts_fnc_para_lineJump
* ["bob","my_C130", "NonSteerable_Parachute_F"] call cScripts_fnc_para_lineJump
* ["bob","my_C130", "NonSteerable_Parachute_F", false] call cScripts_fnc_para_lineJump
*
*/

params [
["_player", objNull, [objNull]],
["_vehicle", objNull, [objNull]],
["_chuteVehicleClass", "NonSteerable_Parachute_F"]
["_chuteVehicleClass", "NonSteerable_Parachute_F"],
["_allowStaggared", false, [false]]
];

private _offset = if (_allowStaggared) then {
if (GETVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),true)) then {
12+(random [-5,0,5]);
} else {
-12+(random [-5,0,5]);
};
} else {
random [-14,0,14];
};

if (_allowStaggared) then {
private _side = GETVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),true);
SETPVAR(_vehicle,EGVAR(VehicleFunc,StaggaredSide),!_side);
};

_player allowDamage false;

private _dir = getDir _vehicle - 50;
moveOut _player;
private _pos = ([_vehicle, 14, ((getDir _vehicle) + 180 + 8)] call BIS_fnc_relPos);
_pos = [_pos select 0, _pos select 1, ((getPosATL _vehicle) select 2)];
_player setPosATL _pos;
private _dir = getDir _vehicle - 50;
moveOut _player;
private _pos = ([_vehicle, 14, ((getDir _vehicle) + 180 + _offset)] call BIS_fnc_relPos);
_pos = [_pos#0, _pos#1, ((getPosATL _vehicle)#2)];;
_player setPosATL _pos;
_player setDir _dir - 140;

sleep 1.5;
Expand All @@ -40,4 +57,5 @@ _chute setVelocity _velocity;
[_player] call EFUNC(para,equipment);

sleep 0.5;

_player allowDamage true;
12 changes: 6 additions & 6 deletions cScripts/functions/vehicle/fn_vehicle_addFunctions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ if (_vehicle iskindOf "Heli_Transport_02_base_F") then {
};

if (_vehicle iskindOf "RHS_C130J_Base") then {
[_vehicle] call FUNC(addLineJump);
[_vehicle] call FUNC(addHaloJump);
[_vehicle,nil,nil,true] call FUNC(addLineJump);
[_vehicle,nil,nil,nil,nil,true] call FUNC(addHaloJump);
[_vehicle] call FUNC(addEscapeWreck);
};

if (_vehicle iskindOf "USAF_C130J") then {
[_vehicle] call FUNC(addLineJump);
[_vehicle] call FUNC(addHaloJump);
[_vehicle,nil,nil,true] call FUNC(addLineJump);
[_vehicle,nil,nil,nil,nil,true] call FUNC(addHaloJump);
[_vehicle] call FUNC(addEscapeWreck);
};

if (_vehicle iskindOf "USAF_C17") then {
[_vehicle] call FUNC(addLineJump);
[_vehicle] call FUNC(addHaloJump);
[_vehicle,nil,nil,true] call FUNC(addLineJump);
[_vehicle,nil,nil,nil,nil,true] call FUNC(addHaloJump);
[_vehicle] call FUNC(addEscapeWreck);
};

Expand Down