From 34e7a70fdf30016951a034ea263be412c284f1a2 Mon Sep 17 00:00:00 2001 From: mrschick <58027418+mrschick@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:20:07 +0200 Subject: [PATCH] Fix GVAR(Guns) locality issue --- addons/scopes/functions/fnc_getCurrentZeroRange.sqf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf index 9c7e26f654..c346767fb7 100644 --- a/addons/scopes/functions/fnc_getCurrentZeroRange.sqf +++ b/addons/scopes/functions/fnc_getCurrentZeroRange.sqf @@ -35,7 +35,16 @@ private _optic = if (_unit == ACE_Player) then { private _opticConfig = if (_optic != "") then { (configFile >> "CfgWeapons" >> _optic) } else { - (configFile >> "CfgWeapons" >> (GVAR(Guns) select _weaponIndex)) + if (_unit == ACE_Player) then { + (configFile >> "CfgWeapons" >> (GVAR(Guns) select _weaponIndex)) + } else { + private _gun = switch (_weaponIndex) do { + case 1: { secondaryWeapon _unit }; + case 2: { handgunWeapon _unit }; + default { primaryWeapon _unit }; + }; + (configFile >> "CfgWeapons" >> _gun) + }; }; private _zeroRange = currentZeroing _unit;