From 7aa11df3a0ff175e9a0df6ab35fadb3a389bfbd1 Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Sat, 26 Oct 2024 18:03:23 +0200 Subject: [PATCH 1/4] Added auto eject function --- cScripts/CfgFunctions.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/cScripts/CfgFunctions.hpp b/cScripts/CfgFunctions.hpp index a4b146b0b..281b14db1 100644 --- a/cScripts/CfgFunctions.hpp +++ b/cScripts/CfgFunctions.hpp @@ -199,6 +199,7 @@ class cScripts { // Other class vehicle_reset {}; class vehicle_addFlagAction {}; + class vehicle_planeAutoEject {}; }; class civ { file = "cScripts\functions\civ"; From 919902efdab7fa2658ac0cbd73b6b1a655aada9a Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Sat, 26 Oct 2024 18:05:01 +0200 Subject: [PATCH 2/4] Added the eject function --- .../vehicle/fn_vehicle_planeAutoEject.sqf | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf diff --git a/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf new file mode 100644 index 000000000..3d5ec3433 --- /dev/null +++ b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf @@ -0,0 +1,26 @@ +#include "..\script_component.hpp"; +/* + * Author: CPL.Brostrom.A, Elemtael + * This function adds a auto ejection system to a vehicle + * + * Arguments: + * 0: Vehicle + * + * Example: + * ["my_jetFighter"] call cScripts_fnc_addLineJump + * + */ + +params [["_vehicle", objNull, [objNull]]]; + +// Check so the options arent added twice. +if (!isNil {_vehicle GETVAR(QEGVAR(VehicleFunc,AutoEject),nil)}) exitWith {SHOW_WARNING_1("AutoEject", "Aircraft AutoEject already applied for %1.", _vehicle)}; + +_vehicle addEventHandler ["Hit", { + params ["_vehicle"]; + if (damage _unit > 0.95) exitWith { + [driver _vehicle, _vehicle] call EFUNC(para,haloJump); + }; +}]; + +_vehicle SETVAR(QEGVAR(VehicleFunc,AutoEject),true); From 01a396799f90e044cf4afb14a49fe67c1bc83502 Mon Sep 17 00:00:00 2001 From: AndreasBrostrom Date: Sat, 26 Oct 2024 18:29:53 +0200 Subject: [PATCH 3/4] Fixed header --- cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf index 3d5ec3433..43b3e6efe 100644 --- a/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf @@ -1,13 +1,13 @@ #include "..\script_component.hpp"; /* - * Author: CPL.Brostrom.A, Elemtael + * Author: CPL.Brostrom.A * This function adds a auto ejection system to a vehicle * * Arguments: * 0: Vehicle * * Example: - * ["my_jetFighter"] call cScripts_fnc_addLineJump + * ["my_jetFighter"] call cScripts_fnc_vehicle_planeAutoEject * */ From 3467ed64998e838e3ac96bf048ea5225e9d3c2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brostr=C3=B6m=2EA=20=7C=20Evul?= Date: Sat, 16 Nov 2024 18:57:52 +0100 Subject: [PATCH 4/4] Update fn_vehicle_planeAutoEject.sqf --- cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf index 43b3e6efe..4e5517bc9 100644 --- a/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf +++ b/cScripts/functions/vehicle/fn_vehicle_planeAutoEject.sqf @@ -18,7 +18,7 @@ if (!isNil {_vehicle GETVAR(QEGVAR(VehicleFunc,AutoEject),nil)}) exitWith {SHOW_ _vehicle addEventHandler ["Hit", { params ["_vehicle"]; - if (damage _unit > 0.95) exitWith { + if (damage _vehicle > 0.95) exitWith { [driver _vehicle, _vehicle] call EFUNC(para,haloJump); }; }];