Jump to content
Constable_

CfgAmmo - Need help with this

Recommended Posts

Hey guys;

 

First off, I'm new to the forums, so apologies if I'm in the wrong place.

 

That said, I'm having a really hard time figuring out what I'm doing wrong with this code snippet. I'm trying to define ammo types for the 30mm autocannon, but it keeps giving me an error on line 1070 when I attempt to launch the game. I can't figure out what I've done wrong - help!

 

class CfgAmmo
{
	class Grenade;
	class B_762x51_Ball;
	class CAF_B_762x51_Ball: B_762x51_Ball
	{
	};
	class B_30mm_MP_Tracer_Green;
	class autocannon_30mm_CTWS: B_30mm_MP_Tracer_Green
	{
	};
	class B_30mm_APFSDS_Tracer_Red;
	class autocannon_30mm_CTWS: B_30mm_APFSDS_Tracer_Red
	{
	};
	class BulletBase;
	class SmokeLauncherAmmo: BulletBase
	{
	};
	class 76mm_smoke: SmokeLauncherAmmo
	{
	};
	class 76mm_grenade: Grenade
	{
	};
};

 

Share this post


Link to post
Share on other sites

Stay consistent somewhere. We don't need the line number with this bit of script. On the other hand, the error message could help.

Share this post


Link to post
Share on other sites

Sure thing. The full error message is:

 

Quote

File caf_lav3\config.cpp, line 1070:

/CfgAmmo.autocannon_30mm_CTWS: Member already defined.

It doesn't generate a log file, and causes a crash during the startup process.

 

Here's my CfgMagazines, too, in case it helps.

class CfgMagazines
{
	class SmokeLauncherMag;
	class 76mm_Magazine_Smoke: SmokeLauncherMag
	{
		count=8;
		displayName="76mm Smokes";
		ammo="76mm_smoke";
		initSpeed=15;
		scope=2;
		nameSound="smokeshell";
		value=1;
		model="\A3\weapons_F\ammo\mag_univ.p3d";
		selectionFireAnim="";
		maxLeadSpeed=23;
	};
	class 76mm_Magazine_HE: 76mm_Magazine_Smoke
	{
		count=4;
		displayName="76mm HE";
		ammo="76mm_grenade";
		model="\A3\weapons_F\ammo\mini_frag.p3d";
	};
	class 220rnd_762x51_Belt;
	class CAF_LAV_220Rnd_762x51mm_C6: 220rnd_762x51_Belt
	{
		ammo="CAF_B_762x51_Ball";
		scope=2;
		displayName="C6-220Rnd-7.62mm";
		picture="\A3\weapons_f\data\UI\M_20Rnd_762x51_CA.paa";
		descriptionShort="C6-220Rnd";
	};
	class CAF_LAV_440Rnd_762x51mm_COAX: CAF_LAV_220Rnd_762x51mm_C6
	{
		count=440;
		displayName="COAX-440Rnd-7.62mm";
		picture="\A3\weapons_f\data\UI\M_20Rnd_762x51_CA.paa";
		descriptionShort="COAX-440Rnd-7.62mm";
	};
	class 140Rnd_30mm_MP_shells_Tracer_Green;
	class CAF_LAV_150Rnd_25mm_HE_M242: 140Rnd_30mm_MP_shells_Tracer_Green
	{
		scope=2;
		ammo="B_30mm_MP_Tracer_Green";
		initSpeed=950;
		count=210;
		displayName="140Rnd HEI-T";
		descriptionShort="High Explosive/Tracer";
	};
	class 60Rnd_30mm_APFSDS_shells_Tracer_Red;
	class CAF_LAV_150Rnd_25mm_APFSDS_M242: 60Rnd_30mm_APFSDS_shells_Tracer_Red
	{
		count=105;
		initSpeed=1150;
		ammo="B_30mm_APFSDS_Tracer_Red";
		displayName="60Rnd APDS-T";
		descriptionShort="Armour Piercing/Tracer";
	};
};

 

Share this post


Link to post
Share on other sites

The error message says exactly what is wrong.

class B_30mm_MP_Tracer_Green;
class autocannon_30mm_CTWS: B_30mm_MP_Tracer_Green {};
class B_30mm_APFSDS_Tracer_Red;
class autocannon_30mm_CTWS: B_30mm_APFSDS_Tracer_Red {};

You've got the "autocannon_30mm_CTWS" class defined twice. You'll need to define two versions of the 30mm_CTWS for the two parents.

Share this post


Link to post
Share on other sites

Okay, so I've corrected CfgAmmo, and the game launches now, but the gun doesn't have ammo when the vehicle is spawned. What's wrong now?

 

class CfgAmmo
{
	class Grenade;
	class B_762x51_Ball;
	class CAF_B_762x51_Ball: B_762x51_Ball
	{
	};
	class BulletBase;
	class SmokeLauncherAmmo: BulletBase
	{
	};
	class 76mm_smoke: SmokeLauncherAmmo
	{
	};
	class 76mm_grenade: Grenade
	{
	};
	class B_30mm_APFSDS_Tracer_Red;
	class CAF_LAV_B_25mm_APFSDS_M242: B_30mm_APFSDS_Tracer_Red
	{
	};
	class B_30mm_MP_Tracer_Green;
	class CAF_LAV_B_25mm_HE_M242: B_30mm_MP_Tracer_Green
	{
	};
};
class CfgMagazines
{
	class SmokeLauncherMag;
	class 76mm_Magazine_Smoke: SmokeLauncherMag
	{
		count=8;
		displayName="76mm Smokes";
		ammo="76mm_smoke";
		initSpeed=15;
		scope=2;
		nameSound="smokeshell";
		value=1;
		model="\A3\weapons_F\ammo\mag_univ.p3d";
		selectionFireAnim="";
		maxLeadSpeed=23;
	};
	class 76mm_Magazine_HE: 76mm_Magazine_Smoke
	{
		count=4;
		displayName="76mm HE";
		ammo="76mm_grenade";
		model="\A3\weapons_F\ammo\mini_frag.p3d";
	};
	class 220rnd_762x51_Belt;
	class CAF_LAV_220Rnd_762x51mm_C6: 220rnd_762x51_Belt
	{
		ammo="CAF_B_762x51_Ball";
		scope=2;
		displayName="C6-220Rnd-7.62mm";
		picture="\A3\weapons_f\data\UI\M_20Rnd_762x51_CA.paa";
		descriptionShort="C6-220Rnd";
	};
	class CAF_LAV_440Rnd_762x51mm_COAX: CAF_LAV_220Rnd_762x51mm_C6
	{
		count=440;
		displayName="COAX-440Rnd-7.62mm";
		picture="\A3\weapons_f\data\UI\M_20Rnd_762x51_CA.paa";
		descriptionShort="COAX-440Rnd-7.62mm";
	};
	class 140Rnd_30mm_MP_shells_Tracer_Green;
	class CAF_LAV_150Rnd_25mm_HE_M242: 140Rnd_30mm_MP_shells_Tracer_Green
	{
		scope=2;
		ammo="CAF_LAV_B_25mm_HE_M242";
		initSpeed=950;
		count=210;
		displayName="210Rnd HEI-T";
		descriptionShort="High Explosive/Tracer";
	};
	class 60Rnd_30mm_APFSDS_shells_Tracer_Red;
	class CAF_LAV_150Rnd_25mm_APFSDS_M242: 60Rnd_30mm_APFSDS_shells_Tracer_Red
	{
		count=105;
		initSpeed=1150;
		ammo="CAF_LAV_B_25mm_APFSDS_M242";
		displayName="105Rnd APDS-T";
		descriptionShort="Armour Piercing/Tracer";
	};
};
class cfgWeapons
{
	class SmokeLauncher;
	class 76wegman: SmokeLauncher
	{
		scope=2;
		displayName="76MM CM/HE";
		magazines[]=
		{
			"76MM_Magazine_Smoke",
			"76MM_Magazine_HE"
		};
	};
	class 76wegman2: SmokeLauncher
	{
		scope=2;
		displayName="76MM Grenades";
		magazines[]=
		{
			"76MM_Magazine_HE"
		};
	};
	class caf_c6gpmg;
	class MGun;
	class LAVIII_C6: caf_c6gpmg
	{
		scope=2;
		magazines[]=
		{
			"CAF_LAV_220Rnd_762x51mm_C6"
		};
		class GunParticles
		{
			class Effect
			{
				effectName="MachineGun1";
				positionName="Konec hlavne3";
				directionName="Usti hlavne3";
			};
			class effect1
			{
				positionName="machinegun_eject_pos";
				directionName="machinegun_eject_dir";
				effectName="MachineGunCartridge";
			};
		};
	};
	class LAVIII_COAX: LAVIII_C6
	{
		displayName="C6 GPMG COAX";
		magazines[]=
		{
			"CAF_LAV_440Rnd_762x51mm_COAX"
		};
		selectionFireAnim="coaxend";
		shotFromTurret=1;
		class GunParticles
		{
			class Effect
			{
				effectName="MachineGun1";
				positionName="Konec hlavne2";
				directionName="Usti hlavne2";
			};
		};
	};
	class autocannon_30mm_CTWS;
	class M242_Primary: autocannon_30mm_CTWS
	{
		scope=2;
		displayName="M242 Primary";
		magazines[]=
		{
			"CAF_LAV_150Rnd_25mm_HE_M242",
			"CAF_LAV_150Rnd_25mm_APFSDS_M242",
		};
		modes[]=
		{
			"HighROF",
			"Single"
		};
		nameSound="cannon";
		class HighROF: Mode_SemiAuto
		{
			displayName="Auto";
			sound[]=
			{
				"CAF_LAV3\Sounds\M242_s",
				1,
				1,
				1000
			};
			weaponSoundEffect="DefaultRifle";
			soundContinuous=0;
			reloadTime=0.28999999;
			flash="gunfire";
			flashSize=0.001;
			maxLeadSpeed=600;
			autoFire=1;
			aiDispersionCoefX=2;
			ffMagnitude=0.2;
			ffFrequency=2;
			ffCount=1;
			dispersion=0.001;
			minRange=1;
			minRangeProbab=0.1;
			midRange=1200;
			midRangeProbab=0.69999999;
			maxRange=3000;
			maxRangeProbab=0.039999999;
		};
		class Single: HighROF
		{
			displayName="Single";
			burst=1;
			multiplier=1;
			reloadTime=0.16;
			autoFire=0;
			aiRateOfFire=0.25;
		};
		class GunParticles
		{
			class Effect
			{
				effectName="AutoCannonFired";
				positionName="Konec hlavne";
				directionName="Usti hlavne";
			};
		};
	};
};

 

Share this post


Link to post
Share on other sites

How do I do that, exactly?

 

Sorry, I'm very new to this.

 

EDIT: Figured it out, and it works! Thanks, jAMDup!

Edited by Constable_

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

×