From 2cd4218ecc19aaeaa2da4c9b065af4db0bc5063f Mon Sep 17 00:00:00 2001 From: Sotirios Pupakis Date: Fri, 31 May 2024 04:18:03 +0200 Subject: [PATCH] Different trigger height for laser guided --- addons/m119/functions/fnc_fired.sqf | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/addons/m119/functions/fnc_fired.sqf b/addons/m119/functions/fnc_fired.sqf index 96fdca8..4ae1f10 100644 --- a/addons/m119/functions/fnc_fired.sqf +++ b/addons/m119/functions/fnc_fired.sqf @@ -45,31 +45,35 @@ _arty animateSource ["magazine_load_source", 0, true]; if (!isServer) exitWith {}; // "Temp" fix for cluster and laser guided because BI? -if (_ammo in ["tbd_mortars_105mm_shell_ammo_dpicm" /*"tbd_mortars_105mm_shell_ammo_laser"*/]) then { +if (_ammo in ["tbd_mortars_105mm_shell_ammo_dpicm", "tbd_mortars_105mm_shell_ammo_laser"]) then { + private _alt = [200, 600] select (_ammo isEqualTo "tbd_mortars_105mm_shell_ammo_laser"); + systemChat format ["%1", _alt]; // wait 5 seconds to let the ammo get high enough [{ - params ["_projectile"]; + params ["_projectile", "_alt"]; if (isNull _projectile) exitWith {}; // Check the height of the projectile private _pos = getPosATL _projectile; - if (_pos select 2 < 200) exitWith {}; + if (_pos select 2 < _alt) exitWith {}; // Start a PFH that will [{ - params ["_projectile", "_handle"]; + params ["_args", "_handle"]; + _args params ["_projectile", "_alt"]; if (isNull _projectile) exitWith { [_handle] call CBA_fnc_removePerFrameHandler; }; // Check the height of the projectile private _pos = getPosATL _projectile; - if (_pos select 2 < 200) exitWith { + systemChat format ["%1", _pos select 2]; + if (_pos select 2 < _alt) exitWith { // Trigger the ammo triggerAmmo _projectile; [_handle] call CBA_fnc_removePerFrameHandler; }; }, 0, - _projectile] call CBA_fnc_addPerFrameHandler; - }, [_projectile], 5] call CBA_fnc_waitAndExecute; + [_projectile, _alt]] call CBA_fnc_addPerFrameHandler; + }, [_projectile, _alt], 5] call CBA_fnc_waitAndExecute; };