Jump to content
D1SC0RD

Adding new magazines to vanilla weapons

Recommended Posts

Hi everybody,
I'm currently working on an addon that adds new magazines for vanilla weapons. What I am having trouble with is configuring the weapons to accept them.
I'm trying to add the magazines to the magazines array without overwriting the default one for compatibility with other addons.
I've taken a look into one of toadie2k's NIArms compatibility patches for CUP and he uses something like this:

class Gun1_base : Rifle_Base_F
{
    magazines[] += {"Mag1", "Mag2"};
};

I tried using the same method, but nothing seems to work.
Here's something from my config:
 

class Rifle_Base_F;
class arifle_Katiba_Base_F : Rifle_Base_F
{
    magazines[] += {"30Rnd_65x39_caseless_yellow_mag_Tracer", "30Rnd_65x39_caseless_red_mag_Tracer" };
};

Am I missing something? Might I have written something wrong?
I even checked in the config viewer and the new magazines DO exist, but they don't appear in the magazines array of CfgWeapons.

Share this post


Link to post
Share on other sites

You need to correctly setup the 'class cfgPatches' section at the very beginning of your config.cpp

Something like this:

class CfgPatches
{
	class YOURTAG_MyMagazineMod
	{
		ammo[] = {};
		units[] = {};
		weapons[] = {};
		vehicles[] = {};
		requiredVersion = 1.1;
		requiredAddons[] = {"A3_Weapons_F","A3_Weapons_F_Acc","A3_Weapons_F_beta"};
	};
};

The important field is the 'requiredAddons' field which determines load-order etc.

  • Like 1

Share this post


Link to post
Share on other sites

Wow thanks, can't believe I actually missed something this basic.
Gotta be more careful the future.

  • Like 1

Share this post


Link to post
Share on other sites

23rd of may, 2016 that's not THAT long ago now is it?
I'm trying to do the exact same thing but with grenade launchers and RHS

 

class CfgPatches {
    class ante_762x51_m16 {
        units[] = {};
        weapons[] = {"ante_weap_m15","ante_weap_m15_m203"};
		ammo[]={};
        requiredVersion = 1.52.132676;
        requiredAddons[] = {"rhsusf_c_weapons", "rhsusf_c_heavyweapons", "A3_Anims_F", "A3_Weapons_F_Acc", "A3_Functions_F_Bootcamp", "A3_Weapons_F", "A3_Weapons_F_Explosives", "A3_Weapons_F_Ammoboxes", "A3_Weapons_F_beta", "A3_Weapons_F_EBR", "A3_Weapons_F_Machineguns_M200"};
        version = 1.0.1;
        versionStr = "1.0.1";
        versionAr[] = {1,0,1};
        author[] = {"Ante"};
        authorUrl = "";
    };
};



class CfgMagazines{
	class 30Rnd_556x45_Stanag; //relevant to a omitted thing
	class 1Rnd_Smoke_Grenade_shell;
	
	class ante_1Rnd_InstantSmoke_shell: 1Rnd_Smoke_Grenade_shell
	{
		author="Ante";
		displayName="1Rnd 40mm instant smoke (White)";
		picture="\A3\Weapons_f\Data\UI\gear_UGL_Smokeshell_white_CA.paa";
		ammo="rhs_g_gdm40";
		descriptionShort="Type: Fast Action Smoke Round <br/> Used in M203/M320";
		displayNameShort="Fast smoke";
	};
};

class CfgWeapons {

	//don't delete these now
	class EGLM{
		magazines[] += {"ante_1Rnd_InstantSmoke_shell"};
	};
	class GL_3GL_F{
		magazines[] += {"ante_1Rnd_InstantSmoke_shell"};
	};
	class M203_GL{
		magazines[] += {"ante_1Rnd_InstantSmoke_shell"};
	};
	class M320_GL{
		magazines[] += {"ante_1Rnd_InstantSmoke_shell"};
	};
	//seriously you'll come back to this later
};

 

Share this post


Link to post
Share on other sites

23rd of may, 2016 that's STILL not that long ago now is it?

It's funny how often people circle back to this.

This time I'm having trouble figuring out how to add magazines to a weapon where the UGL is not defined as it's own weapon*.

I can successfully add magazines to the vanilla MX3GL, where UGL_F is it's own class under CFG weapons, which in turn inherits from grenadeLauncher.

However, the rifle I am attempting to add magazines to has a GL which i cannot find listed under CFG weapons.

 

However, the GL can be found in the CFG viewer under the following:

 

class rifleName 
{
	class uglName
    {

    };

};

 

I have not thus far worked out how to add magazines in this case.

 

Help would be much obliged.

 

Cheers,

Law

__________________________________________
*(There's probably a CFG related name for this but I have a terrible headache now and can't think of it)

 

 

 

Share this post


Link to post
Share on other sites

Depends on where the UGL subclass comes from. If it was first defined in the weapons class then

 

class rifle_parent;
class rifle : rifle_parent {
    class ugl {
        magazines[] += {"stuff"};
    };
};

If it was defined in the rifle_parent or higher then you need to

class rifle_parent : rifle_parent_parent {
    class ugl;
};
class rifle : rifle_parent {
    class ugl : ugl {
        magazines[] += {"stuff"};
    };
};

You might need to leave away the ": ugl" in the rifle class. Not sure about that.

 

Share this post


Link to post
Share on other sites

After finding a missing semi-colon and adjusting the requiredAddons field, the mod is now working.

 

Many thanks for your help, Dedmen.

Hopefully this can also be used for future reference with others that have struggled with this.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×