Search the Community
Showing results for tags 'plus equals'.
Found 1 result
-
I read in a dev branch update that += can be used to add an entry to a CFG field without knowing it's contents. I have been trying to add a custom magazine to SPAR variants, and figured that it made most sense to modify the SPAR base class, rather than each SPAR variant individually. Thus far I have successfully created a new ammo type, and magazine containing this ammo. Currently I have the following in CfgWeapons.hpp class CfgWeapons { class GrenadeLauncher; class Rifle_Base_F; class Rifle_Long_Base_F; class Launcher_Base_F; class arifle_SPAR_01_base_F: Rifle_Base_F { magazines[] += {"law_30rnd_556x45_mss"}; }; }; However, when I examine the magazines field for arifle_SPAR_01_base_F with the mod loaded, it comes up with the default magazines but not the new magazine. This might suggest that the =+ operator does not work, however, I also attempted the following: class CfgWeapons { class GrenadeLauncher; class Rifle_Base_F; class Rifle_Long_Base_F; class Launcher_Base_F; class arifle_SPAR_01_base_F: Rifle_Base_F { magazines[] += {"law_30rnd_556x45_mss"}; }; class arifle_SPAR_01_blk_F: arifle_SPAR_01_base_F { magazines[] += {"law_30rnd_556x45_mss"}; }; }; In the above example; arifle_SPAR_01_base_F retains it's original array of vanilla magazines, with no modded mag. arifle_SPAR_01_blk_F contains no vanilla magazines, but TWO entries of law_30rnd_556x45_mss I'm not really understanding why the change is not being applied to the base class, but is being applied to it's child, or why the magazine appears twice in the child. Clearly I've not quite understood everything about CFG editing yet, and need some help figuring this (because my head hurts and I'm frustrated now). Cheers, Law