From 6b12d2ade83b4ce50416ff5f59f767ba58d5ee4e Mon Sep 17 00:00:00 2001 From: Paul 'Faron' Schoenle Date: Sat, 14 Mar 2020 20:09:50 +0100 Subject: [PATCH 1/3] Update fn_weaponShopMags to get all available Ammo The current version is a hotfix I suggested a while ago. As I just realized, bohemia changed several config entries, so I came up with a way to cover all "muzzles" (all underbarrel weapons) and as using the magazineWell entries, I'm now able to adress all crossover ammo from other mods etc. I'm about to test it asap. --- .../core/shops/fn_weaponShopMags.sqf | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf index bfce38536..0768a43d1 100644 --- a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf +++ b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf @@ -9,13 +9,31 @@ disableSerialization; if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 0) then { - private _weapon = lbData[38403,lbCurSel (38403)]; - private _magArray = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazines"); + private ["_weapon","_magArray","_magWell","_subClass","_muzzles"]; + _weapon = lbData[38403,lbCurSel (38403)]; + _magArray = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazines"); + _magWell = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazineWell"); + _muzzles = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"muzzles") - ["this"]; { - if (_x in FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"muzzles")) then { - _magArray append FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazines"); - }; - } count ["EGLM", "GL_3GL_F"]; + _subClass = _x; + { + _magArray append getArray ("CfgMagazineWells" >> _subClass >> _x); + } count "true" configClasses (configFile >> "CfgMagazineWells" >> _subClass); + } count _magWell; + + //GL and stuff + if (count _muzzles > 0) then { + { + _magArray append FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazines"); + _magWell = FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazineWell"); + { + _subClass = _x; + { + _magArray append getArray("CfgMagazineWells" >> _subClass >> _x); + } count "true" configClasses (configFile >> "CfgMagazineWells" >> _subClass); + } count _magWell; + } count _muzzles; + }; uiNamespace setVariable ["Magazine_Array",_magArray]; uiNamespace setVariable ["Weapon_Magazine",1]; } else { From 0146bcf961a753479f9fd6fe4e7aa784fa8dd5d5 Mon Sep 17 00:00:00 2001 From: Paul 'Faron' Schoenle Date: Sat, 14 Mar 2020 21:54:10 +0100 Subject: [PATCH 2/3] Update fn_weaponShopMags.sqf --- .../core/shops/fn_weaponShopMags.sqf | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf index 0768a43d1..7dab324ba 100644 --- a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf +++ b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf @@ -1,7 +1,8 @@ #include "..\..\script_macros.hpp" /* File: fn_weaponShopMags.sqf - Author: Daniel Stuart + Authors: Daniel Stuart, Faron + Description: Set Weapon Shop in magazine mode @@ -11,29 +12,36 @@ disableSerialization; if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 0) then { private ["_weapon","_magArray","_magWell","_subClass","_muzzles"]; _weapon = lbData[38403,lbCurSel (38403)]; - _magArray = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazines"); - _magWell = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"magazineWell"); - _muzzles = FETCH_CONFIG2(getArray,"CfgWeapons",_weapon,"muzzles") - ["this"]; - { + _magArray = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); + _magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazineWell"); + _muzzles = (getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles")) - ["this"]; + + { _subClass = _x; { - _magArray append getArray ("CfgMagazineWells" >> _subClass >> _x); - } count "true" configClasses (configFile >> "CfgMagazineWells" >> _subClass); + _magArray append getArray (configFile >> "CfgMagazineWells" >> _subClass >> _x); + true; + } count ("true" configClasses (configFile >> "CfgMagazineWells" >> _subClass)); + true; } count _magWell; //GL and stuff if (count _muzzles > 0) then { { - _magArray append FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazines"); - _magWell = FETCH_CONFIG(getArray,"CfgWeapons",_weapon,_x,"magazineWell"); + _magArray append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); + _magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazineWell"); { _subClass = _x; { - _magArray append getArray("CfgMagazineWells" >> _subClass >> _x); - } count "true" configClasses (configFile >> "CfgMagazineWells" >> _subClass); + _magArray append getArray(configFile >>"CfgMagazineWells" >> _subClass >> _x); + true; + } count ("true" configClasses (configFile >> "CfgMagazineWells" >> _subClass)); + true; } count _magWell; + true; } count _muzzles; }; + uiNamespace setVariable ["Magazine_Array",_magArray]; uiNamespace setVariable ["Weapon_Magazine",1]; } else { From 5382a99c91dad72a428db83a6e9e64a9e91ae0ff Mon Sep 17 00:00:00 2001 From: Paul 'Faron' Schoenle Date: Sat, 14 Mar 2020 23:42:12 +0100 Subject: [PATCH 3/3] changed configClasses to configProperties bc Arma? --- .../core/shops/fn_weaponShopMags.sqf | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf index 7dab324ba..abbcb8343 100644 --- a/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf +++ b/Altis_Life.Altis/core/shops/fn_weaponShopMags.sqf @@ -10,32 +10,36 @@ disableSerialization; if ((uiNamespace getVariable ["Weapon_Magazine",0]) isEqualTo 0) then { - private ["_weapon","_magArray","_magWell","_subClass","_muzzles"]; + private ["_weapon","_magArray","_magWell","_subClass","_muzzles","_subCfgClass"]; _weapon = lbData[38403,lbCurSel (38403)]; _magArray = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines"); - _magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazineWell"); - _muzzles = (getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles")) - ["this"]; + _magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazineWell"); { _subClass = _x; + _subCfgClass = configProperties [configFile >> "CfgMagazineWells" >> _subClass]; + { - _magArray append getArray (configFile >> "CfgMagazineWells" >> _subClass >> _x); + _magArray append getArray _x; true; - } count ("true" configClasses (configFile >> "CfgMagazineWells" >> _subClass)); + } count _subCfgClass; true; } count _magWell; //GL and stuff + _muzzles = (getArray (configFile >> "CfgWeapons" >> _weapon >> "muzzles")) - ["this"]; if (count _muzzles > 0) then { { _magArray append getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazines"); _magWell = getArray (configFile >> "CfgWeapons" >> _weapon >> _x >> "magazineWell"); { - _subClass = _x; + _subClass = _x; + _subCfgClass = configProperties [configFile >> "CfgMagazineWells" >> _subClass]; + { - _magArray append getArray(configFile >>"CfgMagazineWells" >> _subClass >> _x); + _magArray append getArray _x; true; - } count ("true" configClasses (configFile >> "CfgMagazineWells" >> _subClass)); + } count _subCfgClass; true; } count _magWell; true;