Jump to content
road runner

Multiple variants from the same weapon model question

Recommended Posts

Happy New year.

 

A couple of questions for the weapons config guru's, I have a single weapon, broken down into "camo", "camo1","camo2","camo3" in the selections part.

 

These selections are added to the model.cfg

 

My question is, I normally make a single weapon, with no need for "hidden selection textures", how do I actually make this work?

 

I know you have to make a base which doesn't include the textures or models (?)  I used Rob Hammers MK18 mod as an example as I know that uses the same weapon, and through hidden selections, creates other weapons from the same model, although I never seem to see any actual model cfg files when unpacking to change textures etc, are they "hidden" like the hidden textures? :D 

 

Basically I want to create 3 versions, a clean version (factory finish type), and 2 desert variants, of which the textures are already named.

 

Any pointers would be greatly appreciated.

Share this post


Link to post
Share on other sites

OK, so to start you off you'll need to define "camo", "camo1", camo2" and "camo3" in the model.cfg (I know you said you'd already done it, but I'm writing this as a full guide for anyone else seeking the same information), as well as any other parts that require animation, such as the trigger, bolt, magazine etc. This is very specific to the model itself, but here is a rough example of a Skeleton define that should work:

class CfgSkeletons
{
	class YOUR_RIFLE_SKELETON
	{
		isDiscrete=1;
		skeletonInherit="";
		skeletonBones[]=
		{
			"zbran", "",
			"zasleh", "",
			"magazine", "",
			"bolt", "",
			"boltrelease", "",
			"trigger", "",
			"carrying_handle", "",
			"selector_switch", "",
			"camo", "",
			"camo1", "",
			"camo2", "",
			"camo3", ""
		};
	};
};

I added in the extras, but you can remove any that don't apply (as well as add in any that aren't included).

 

EDIT: To clarify, for this to work properly, each selection ("camo", "camo1", "camo2" and "camo3" much each use only one texture each, per selection. e.g. "camo" must contain all parts of texture1 that you want to change, "camo1" must only contain texture 2 etc.)

 

Now that the cfgSkeletons is setup, you need to define your new model in cfgModels. Again, this is VERY specific to your weapon, as you need the relevant animations to be setup, as well as the rotation axis etc setup in the model's Memory lod. For the example I'll simply define the trigger (for when the weapon is fired) and the magazine reload. The important part is the skeletonName parameter. This MUST match the name you defined in cfgSkeletons (in my example its YOUR_RIFLE_SKELETON).

class CfgModels
{
	class YOUR_MODEL_NAME
	{
		skeletonName="YOUR_RIFLE_SKELETON";
		class Animations
		{
			class trigger
			{
				type = "rotation";
				source = "reload";
				sourceAddress = "clamp";
				selection = "trigger";
				axis = "trigger_axis";
				minValue = 0;
				maxValue = "1";
				angle0 = "0";
				angle1 = "rad 18"; // was rad -30
			};

			class magazine_hide
			{
				type="hide";
				source="reloadMagazine";
				selection="magazine";
				minValue=0.000000;
				maxValue=1.00000;
				hideValue=0.188;
				unhideValue = 0.700; // was 0.550
			};

			class no_magazine
			{
				type="hide";
				source="hasMagazine";
				selection="magazine";
				minValue=0.000000;
				maxValue=1.00000;
				hideValue=0.5;
				unhideValue = -1.0;
			};

			class magazine_reload_move_1
			{
				type = "translation";
				source = "reloadMagazine";
				selection = "magazine";
				axis = "magazine_axis";
				minValue = 0.145;
				maxValue = 0.170;
				offset0 = 0.0;
				offset1 = 0.5;
			};

			class magazine_reload_move_2: magazine_reload_move_1
			{
				minValue = 0.573;
				maxValue = 0.602;
				offset0 = 0.0;
				offset1 = -0.5;
			};
		};
		sections[]={"zasleh"};
		sectionsInherit="";
	};
};

Now, for the config work. This you can do one of two ways. I'll show you the way I'd personally do it, which involves the model being setup to use the "plain" textures, hence no mention of hiddenselections in the "plain" class.

class CfgPatches
{
	class MY_NEW_RIFLE_PACK
	{
		ammo[] = {};
		units[] = {};
		weapons[] = {"MY_NEW_RIFLE_PLAIN","MY_NEW_RIFLE_CAMO1","MY_NEW_RIFLE_CAMO2"};
		vehicles[] = {};
		requiredVersion = 1.1;
		requiredAddons[] = {"A3_Weapons_F","A3_Weapons_F_Acc","A3_Weapons_F_beta"};
		author = "S Squadron";
	};
};

class CfgWeapons
{
	class mk20_base_F;
	class MY_NEW_RIFLE_PLAIN: mk20_base_F
	{
		scope=2;
		author = "YOUR NAME";
		model = "\YOUR_PBO\YOUR_MODEL_NAME.p3d";
		displayName = "MY RIFLE (PLAIN)";
		descriptionShort = "A plain rifle without any camo";
		
		//ADD IN WHATEVER EXTRA STUFF YOU WANT HERE (Recoil used, sound config etc. - use the games base files for what you want)
	};

	class MY_NEW_RIFLE_CAMO1: MY_NEW_RIFLE_PLAIN
	{
		author = "YOUR NAME"; // I left this in, as it doesn't seem to inherit form the parent-class
		displayName = "MY RIFLE (CAMO1)";
		descriptionShort = "A rifle with camo pattern 1";

		hiddenSelections[] = {"camo","camo1","camo2","camo3"};
		hiddenSelectionsTextures[] = {"\YOUR_PBO\CAMO_SELECTION_CAMO1_co.paa","\YOUR_PBO\CAMO1_SELECTION_CAMO1_co.paa","\YOUR_PBO\CAMO2_SELECTION_CAMO1_co.paa","\YOUR_PBO\CAMO3_SELECTION_CAMO1_co.paa"};
		
		//NO NEED TO ADD IN EXTRA GUFF (unless required) EVERYTHING WILL BE INHERITED FROM MY_NEW_RIFLE_PLAIN
	};

	class MY_NEW_RIFLE_CAMO2: MY_NEW_RIFLE_PLAIN
	{
		author = "YOUR NAME"; // I left this in, as it doesn't seem to inherit form the parent-class
		displayName = "MY RIFLE (CAMO2)";
		descriptionShort = "A rifle with camo pattern 2";

		hiddenSelections[] = {"camo","camo1","camo2","camo3"};
		hiddenSelectionsTextures[] = {"\YOUR_PBO\CAMO_SELECTION_CAMO2_co.paa","\YOUR_PBO\CAMO1_SELECTION_CAMO2_co.paa","\YOUR_PBO\CAMO2_SELECTION_CAMO2_co.paa","\YOUR_PBO\CAMO3_SELECTION_CAMO2_co.paa"};
		
		//NO NEED TO ADD IN EXTRA GUFF (unless required) EVERYTHING WILL BE INHERITED FROM MY_NEW_RIFLE_PLAIN
	};
};

Its a very simplified config, but should serve your purpose, at least to get it ingame.

  • Like 2

Share this post


Link to post
Share on other sites

Jackal, you are a fucking star and a gentleman many many thanks, I shall give this a bash, but it looks exactly what I'm looking for.

 

The worst thing is, I've done this with headgear in A2 before, I had a brain fart and couldn't see the woods for the trees.

 

 

Can you just confirm that the model.cfg doesn't inherit anything, only reason I ask, is that I basically use Zach Gibsons tutorials, and his model.cfg loks like this

  • Like 1

Share this post


Link to post
Share on other sites
class CfgSkeletons
{
	class Default
	{
		isDiscrete=1;
		skeletonInherit="";
		skeletonBones[]={};
	};
	class tb_arifle_m16a4_base: Default
	{
		skeletonBones[]=
		{
			"magazine",
			"",
			"bolt",
			""
		};
	};

};
class CfgModels
{
	class Default
	{
		sectionsInherit="";
		sections[]={};
		skeletonName="";
	};
	class tb_arifle_m16a4_base: Default
	{
		sections[]=
		{
			"magazine",
			"bolt"
		};
		skeletonName="tb_arifle_m16a4_base";
		class Animations
		{
		};
	};
	class hkump45: tb_arifle_m16a4_base   (This is where I was putting my weapon name in)
	{
		class Animations
		{
			class magazine_reload_move_1
			{
				type="translation";
				source="reloadMagazine";
				selection="magazine";
				axis="magazine_axis";
				minValue=0.145;
				maxValue=0.2;
				offset0=0;
				offset1=0.40000001;
			};
			class magazine_hide
			{
				type="hide";
				source="reloadMagazine";
				selection="magazine";
				minValue= 0;
				maxValue=1;
				minPhase= 0;
				maxPhase=1;
				hideValue=1;
				sourceAddress="mirror";
			};
			class bolt_empty
			{
				type="translation";
				source="isempty";
				selection="bolt";
				memory=1;
				sourceAddress="clamp";
				minValue=0;
				maxValue=1;
				begin="bolt_start";
				end="bolt_end";
				offset0=0;
				offset1=1;
			};
			class bolt_empty_1
			{
				type="translation";
				source="reloadMagazine";
				selection="bolt";
				memory=1;
				sourceAddress="clamp";
				minValue=0;
				maxValue=1;
				begin="bolt_start";
				end="bolt_end";
				offset0=0;
				offset1=1;
			};
		};
	};
};

as you can see, he was referencing it to some tb_arifle_M16A4_base, I'm guessing there's no need for that at all, and that is probably a cause for errors to happen?

Share this post


Link to post
Share on other sites

The only reason I don't tend to inherit in model.cfgs is due to the newer versions of Mikero's tools throwing a shit-fit and not liking to Binarize correctly (in some instances) because of it (despite Addon Builder etc packing it fine). As to whether the example you posted could cause errors, that would depend on what tools you use to pack the addon and how....sensitive the tool is to issues. As you can see, the only thing inherited from the parent class is the sections and skeletonName parameters, so inheritance in this case is kind of redundant. I'd only ever use it for 2 very similar models that would likely use many of the same animations (magazine reload, bolt mechanisms when firing, iron-sight ranging etc) but where one (or more) use additional animations

e.g. define all the base stuff for a rifle, and then inherit everything for the UGL and add in the UGL-specific animations just for that particular model.

Share this post


Link to post
Share on other sites

Thanks mate, that makes sense, I am using the tools from A2 still to make the pbo's (BinPBO personal issue)

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

×