Jump to content
Sign in to follow this  
jakeplissken

Adding new 40mm grenade ammo.

Recommended Posts

I am adding a new 40mm grenade ammo type to my mod, but this will not show up in the arsenal, and using scripting does not allow me to add this to a character either.

 

class CfgAmmo
{ // Brighter flares for 40mm, mortars and starter pistol.
    access = 1;
    class FlareCore;
    class GrenadeBase;
    class GrenadeCore;
    class FlareBase: FlareCore {
        timeToLive = 80;
        brightness = 450;
        intensity  = 1000000;
    };
    class F_40mm_White: FlareBase {
        timeToLive = 80;
        brightness = 450;
        intensity  = 1000000;
    };
    class F_40mm_Red: FlareBase {
        timeToLive = 80;
        brightness = 450;
        intensity  = 1000000;
        smokeColor[] = {0.8438,0.1383,0.1353,1};
    };
    class Flare_82mm_AMOS_White: FlareCore {
        timeToLive = 90;
        brightness = 980;
        intensity  = 1000000;
    };
	class F_Signal_Green: FlareBase
	{
		brightness = 80;
		intensity  = 1000000;
	};
    class G_40mm_HE: GrenadeBase {
        explosionForceCoef = 999; // 9
        hit = 5550; // 150
    };
    class G_40mm_HEAT: GrenadeBase {
        explosionForceCoef = 9; // 9
        hit = 350; // 350
        explosionEffects = "ExploAmmoExplosionPlaneCAS";
    };
};

class CfgMagazines {
    class Default;
    class CA_Magazine;
    class 1Rnd_HEAT_Grenade_shell : CA_Magazine {
        scope = 2;
        count = 1;
        ammo = "G_40mm_HEAT";
        descriptionShort = "Type: HEAT Grenade Round<br />Caliber: 40 mm<br />Rounds: 1<br />Used in: EGLM, 3GL";
        displayName = "40 mm HEAT Grenade Round";
        displayNameShort = "HEAT Grenade";
        author = "Corporal Kerry";
    };
};

Is there something I am missing to get this working. I just want to inherit from the main 40mm grenade type and create a new grenade type. Thanks. I have a new character in my mod, should I add the ammo to him to allow it to work?

Share this post


Link to post
Share on other sites

New magazine types need adding to the magazines[] array of the UGL muzzle used by the intended weapon e.g.

class cfgWeapons {
  class GrenadeLauncher;
  class UGL_F: GrenadeLauncher {
    magazines[] += {"1Rnd_HEAT_Grenade_shell"};
  };
};

Using the += modifier to add things to arrays can be overwritten if a subclass has its own magazines[] array though. Such as the MX's class GL_3GL_F which is a subclass of class UGL_F

So to add it to the 3GL as well as the standard UGL you'd have to also create an additional config in a subfolder, where your grenade is added to class GL_3GL_F, and have cfgPatches set up properly

Share this post


Link to post
Share on other sites

Thanks. I do not need to add it to the 3GL. This is meant as a new 40mm grenade that any standard launcher can use, but will not work as a metal storm stacked round.

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
Sign in to follow this  

×