Jump to content
Sign in to follow this  
BennySouthSt

Custom M16 Error

Recommended Posts

I've gotten back into learning how to mod OFP/CWA, and its interesting yet infuriating at the same time.

 

I've been messing around trying to create a custom M16 with some custom mags. I've fixed some of the problems I had on my own, but i've hit a brick wall. Whenever I try to add my weapon to a unit with this in the init field:

this addweapon "23RD_M16A4"

however, it comes up with the error:

noentry 'CONFIG.cpp/cfgweapons.23RD_M16A4'.

Again, this is my first attempt at getting a weapon and mags in game, but i'm okay with units and i'm pretty sure i've defined what I need. Here's some elements from the config.

class CfgPatches
	{

	class 23rd_Blufor_Weapons
		{

			units[]=
			{
			};
			
			weapons[]=
			{
			"23RD_M16A4",
			"556W_GTRACE_30RD_SB",
			"556W_RTRACE_30RD_SB",
			"556W_BTRACE_30RD_SB",
			"556W_BALL_30RD_SB"
			};
			requiredAddons[]= {"BIS_Resistance","BIS_WeaponPack","LaserGuided","6G30","Kozlice","G36A","MM1","Steyr","Bizon","XMS"};
			requiredVersion=1.85;
		};
	};

class CfgWeapon
{
	class Default {};
	class MGun: Default {};
	class Riffle: MGun {};
	class M16: Riffle {};
	class 556W_BALL_30RD_SB: M16
	{
        //Mag is defined in here, i'm pretty sure its fine and it shouldn't have any bearing as far as I know, unless the mag has to          // be defined with the weapon - but then how does JAM work? 
        };

	class 23RD_M16A4 : M16 
	{
		opticsZoomMin=0.30;
		opticsZoomMax=0.30;
		optics = true;
		model="m16_proxy"; //Using the default model and such until I get it in game.
		modelOptics="optika_m16";
		displayname = "M16A4 (Black, Covers)";
		drySound[]={"weapons\M16dry",db-40,1};
		magazines[] = {"556W_BALL_30RD_SB","556W_RTRACE_30RD_SB","556W_GTRACE_30RD_SB","556W_BTRACE_30RD_SB"};
	};
	
};

Here's a link to the full thing: http://pastebin.com/TEdA9mzr

 

Like I said, whenever I try to spawn the "23RD_M16A4" into the editor, it gives the error I posted. I've been working on this for a while and had a load of bugs that i've figured out and worked around, and I wouldn't come here unless I was out of ideas - you guys are always really helpful :)

 

I'd massively appreciate it if you could let me know what i've fucked up, although (unless its massive) don't bother spending time correcting any other mistakes and such - I wanna try figure them out myself, it's the way i've learned up to this point.

 

Thanks!

Share this post


Link to post
Share on other sites

If you want to find out for yourself what went wrong just download the pbo at the bottom, compare it to your own version and see what you forgot to add and some other things that can be optimized.

 

--------------------------------------------------------

What I did:

 

I personally always define weapon(s) and then the magazine(s). The config is larger than it needs to be. Instead of defining all weapons/magazines from M16 you should define them from the previous entry and only put in things that need to be different (for firemodes this won't work for some reason so you need to have everything in it everytime). The same goes for ammo which can also be simpler. I didn't look at the tracers so I don't know if those work.

 

You need separate CfgPatches and CfgModels sections like this instead of combining it in CfgPatches:

 

CfgPatches should look like this:

class CfgPatches
{ 
	class 23RD_M16A4 
	{ 
	units[] = {  }; 
	weapons[] = { 23RD_M16A4, 556W_GTRACE_30RD_SB, 556W_RTRACE_30RD_SB, 556W_BTRACE_30RD_SB, 556W_BALL_30RD_SB,  }; 
	requiredVersion = 1.96; 
	};
};

These are the names of the actual classnames in the config.

class CfgModels
{ 
	class Default {};
	class Weapon: Default {}; 
	class m16_proxy: Weapon{};
};

This/These should be named the same as the p3d file(s), but without the extension.

 

http://ofp.gamepark.cz/_hosted/digitalwarfarestudios/download/23RD_M16A4.pbo

Share this post


Link to post
Share on other sites

Thanks man, ill take a proper look when I get home. I know about the over-complicated weapon, I put a load of the stuff already defined in M16 so I could mess around and see what effect changing those things have. I completely forgot about cfgModels though :-S.

I appreciate the help, ill let you know how it goes when I get home.

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  

×