Jump to content
Sign in to follow this  
Rhodesy77

Weapon Addon Help

Recommended Posts

G'day guys.

Im currently working on my first weapon addon and im running into a few issues, ive only just got them in game. now my model.cfg is wrong, the rewmovemagazine and the bolt dont work, nor do the machinegun animations. also the muzzle flash is just static with the model.

Now i suck at configs, so thought id would be worth posting up here to see where i am going wrong, if someone can just point it out would be great, cheers.

Config.cpp

class CfgPatches
{
class CTB_Weap
{
Units[] = {};
weapons[]= {"CTB_mas", "CTB_ksp90b"};
requiredVersion = 1.000000;
requiredAddons[]= {"CAWheeled2", "CACharacters2", "CAWeapons", "CAWeapons", "Extended_EventHandlers"};
};
};

/*extern*/ class Mode_SemiAuto;
/*extern*/ class Mode_Burst;
/*extern*/ class Mode_FullAuto;

class CfgWeapons {

/*extern*/ class M4a1;
class CTB_mas: M4a1 {
displayName = "ACR-L";
model = "\CTB_Weap\mas\CTB_mas.p3d";
picture = "\CTB_Weap\gui\inv\weapons\mas.paa";
modes[] = {"Single", "FullAuto"};
       scope = 2;
value = 0;
ACE_WEIGHT = 4.620000;
ACE_FlashLight = "false";


};

/*extern*/ class M249;

class CTB_ksp90b: M249 {
displayName = "KSP90B";
dexterity = 1.400000;
       ACE_bipod = 1;
model = "\CTB_Weap\lmg\CTB_KSP90B.p3d";
picture = "\CTB_Weap\gui\inv\weapons\KSP90B.paa";
       scope = 2;
value = 0;
ACE_WEIGHT = 4.920000;
ACE_FlashLight = "false";
weaponInfoType = "RscWeaponZeroing";
discreteDistance[] = {100, 200, 300, 400, 500, 600};


};

class CTB_ksp90b_aim: CTB_ksp90b {
	displayName = "KSP90B_AIM";
	model = "\CTB_Weap\lmg\CTB_ksp90b_aim";
	picture = "\CTB_Weap\gui\inv\weapons\ksp90b_3x_ca.paa";
};

/*extern*/ class m240;
class CTB_ksp58d: m240 {
scope = 2;
displayName = "KSP58D";
model = "\CTB_Weap\lmg\ctb_ksp58d";
       picture = "\CTB_Weap\gui\inv\weapons\ksp58d_ca.paa";
ACE_WEIGHT = 6.20000;
ACE_FlashLight = "false";
dexterity = 1.400000;
       ACE_bipod = 1;

};
};


class cfgVehicles
{
class ReammoBox; //Extended

class CTBWeaponBox  : ReammoBox 
{
scope = 2;
accuracy = 1000;
displayName = "CTB Weapons";
model = "\ca\weapons\AmmoBoxes\USBasicWeapons.p3d";

class TransportMagazines
{
class 30Rnd_556x45_Stanag
{
magazine = "30Rnd_556x45_Stanag";
count = 200;
};
};

class TransportWeapons
{
class CTB_mas
{
weapon = "CTB_mas";
count = 12;
    };
class CTB_ksp90b
{
weapon = "CTB_ksp90b";
count = 12;
    };
class CTB_ksp90b_aim
{
weapon = "CTB_ksp90b_aim";
count = 12;
    };
class CTB_ksp58d
{
weapon = "CTB_ksp58d";
count = 12;
    };
  };
 };
};

Model.cfg

class cfgSkeletons
{
   class Default
   {
       isDiscrete = 1;
       skeletonInherit = "";
       skeletonBones[] = {};
   };

class Rifle: Default
{
	isDiscrete = 0;
	skeletonInherit = "Default";
	skeletonBones[]=
	{
		"magazine",	"",
		"bolt", ""
	};
};

       class MachineGun : Default
{
	SkeletonBones[]=
	{
		"magazine","",
		"ammo_belt_cover02","magazine",
		"magazine_belt","magazine",
		"trigger","",
		"ammo_belt","",
		"ammo_belt_bottom","ammo_belt",
		"bullet010","ammo_belt",
		"bullet009","bullet010",
		"bullet008","bullet009",
		"bullet007","bullet008",
		"bullet006","bullet007",
		"bullet005","bullet006",
		"bullet004","bullet005",
		"bullet003","bullet004",
		"bullet002","bullet003",
		"bullet001","bullet002",
		"feedtray_cover","",
		"ammo_belt_cover","feedtray_cover",
		"misc_cover","feedtray_cover",
		"bolt","",
		"fake_bullet","",
		"bullet007hide","",
		"bullet_cover","",
		"optics","",
	};
};

};

class cfgModels
{
   class Default
   {
       sectionsInherit="";
       sections[] = {};
       skeletonName = "";
   };

class Rifle : Default {
       sectionsInherit="Default";
	sections[]=	{ "zasleh" };
	skeletonName="CTB_Weap";
	class Animations
	{
		class CTB_Weap_bolt_action
		{
			type="translationX";
			source="reload";
			selection="bolt";
			axis="";
			memory="false";
			animPeriod=0;
			minValue=0;
			maxValue=0.10;
		};
		class CTB_Weap_bolt_empty
		{
			type="translationx";
			source="isEmpty";
			selection="bolt";
			axis="";
			memory="false";
			animPeriod=0;
			minValue=0;
			maxValue=0.10;
		};
		class CTB_Weap_magazine_hide
		{
			type="hide";
			source="reloadMagazine";
			selection="magazine";
			minValue=0.200000;
			maxValue=0.250000;
			hideValue=0.100000;
		};
	};
};

class CTB_ksp90b : Default
{
	skeletonName="MachineGun";
	sections[]=
	{
		"zasleh",
	};
	class Animations
	{
		class magazine_hide
		{
			type="hide";
			hideValue=0.5;
			minValue=0;
			maxValue=0.4;
			minPhase=0;
			maxPhase=0.4;
			source="reloadMagazine";
			sourceAddress=2;
			selection="magazine";
		};
		class reload_ammobelt_hide
		{
			type="hide";
			hideValue=0.5;
			minValue=0;
			maxValue=0.4;
			minPhase=0;
			maxPhase=0.4;
			source="reloadMagazine";
			sourceAddress=2;
			selection="ammo_belt";
		};
		class reload_ammobelt_bottom_hide
		{
			type="hide";
			hideValue=0.5;
			minValue=0;
			maxValue=0.4;
			minPhase=0;
			maxPhase=0.4;
			source="reloadMagazine";
			sourceAddress=2;
			selection="ammo_belt_bottom";
		};
		class ammobelt_hide
		{
			type="hide";
			hideValue=1;
			minValue=0;
			maxValue=1;
			minPhase=0;
			maxPhase=1;
			source="isEmpty";
			sourceAddress=2;
			selection="ammo_belt";
		};
		class ammobelt_bottom_hide
		{
			type="hide";
			hideValue=1;
			minValue=0;
			maxValue=1;
			minPhase=0;
			maxPhase=1;
			source="isEmpty";
			sourceAddress=2;
			selection="ammo_belt_bottom";
		};
		class ammo_belt
		{
			type="rotation";
			angle0=-0.12;
			angle1=0.06;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0.3;
			maxValue=1;
			minPhase=0.3;
			maxPhase=1;
			source="reload";
			sourceAddress=0;
			selection="ammo_belt";
		};
		class ammo_belt_bottom
		{
			type="rotation";
			angle0=-0.15;
			angle1=-0.5;
			axis="feedtray_cover_axis";
			memory=1;
			minValue=0.3;
			maxValue=1;
			minPhase=0.3;
			maxPhase=1;
			source="reload";
			sourceAddress=0;
			selection="ammo_belt_bottom";
		};
		class ammo_belt_shake_01
		{
			type="translation";
			offset0=0;
			offset1=0.05;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet002";
		};
		class ammo_belt_shake_02
		{
			type="translation";
			offset0=0;
			offset1=0.05;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet003";
		};
		class ammo_belt_shake_03
		{
			type="translation";
			offset0=0;
			offset1=0.025;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet004";
		};
		class ammo_belt_shake_05
		{
			type="translation";
			offset0=0;
			offset1=-0.025;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet006";
		};
		class ammo_belt_shake_06
		{
			type="translation";
			offset0=0;
			offset1=-0.05;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet007";
		};
		class ammo_belt_shake_08
		{
			type="translation";
			offset0=0;
			offset1=-0.025;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet009";
		};
		class ammo_belt_rotation_shake_01
		{
			type="rotation";
			angle0=0;
			angle1=-0.5235988;
			axis="ammo_belt_bottom_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet001";
		};
		class ammo_belt_rotation_shake_02
		{
			type="rotation";
			angle0=0;
			angle1=0.08726646;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet002";
		};
		class ammo_belt_rotation_shake_03
		{
			type="rotation";
			angle0=0;
			angle1=0.4363323;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="bullet003";
		};
		class magazine_shake
		{
			type="rotationZ";
			angle0=-0.008726646;
			angle1=0.008726646;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="magazine";
		};
		class magazine_shake02
		{
			type="rotationX";
			angle0=0.004363323;
			angle1=-0.004363323;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.25;
			minPhase=0;
			maxPhase=0.25;
			source="reload";
			sourceAddress=2;
			selection="magazine";
		};
		class magazine_shake03
		{
			type="rotationY";
			angle0=0.005759587;
			angle1=-0.005759587;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=0.5;
			minPhase=0;
			maxPhase=0.5;
			source="reload";
			sourceAddress=2;
			selection="magazine";
		};
		class ammo_belt_rotation_shake_static_01
		{
			type="rotation";
			angle0=0;
			angle1=0.1745329;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0;
			maxValue=3;
			minPhase=0;
			maxPhase=3;
			source="time";
			sourceAddress=2;
			selection="bullet004";
		};
		class ammo_belt_rotation_shake_static_02
		{
			type="rotation";
			angle0=0;
			angle1=0.08726646;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0.1;
			maxValue=3.5;
			minPhase=0.1;
			maxPhase=3.5;
			source="time";
			sourceAddress=2;
			selection="bullet003";
		};
		class ammo_belt_rotation_shake_static_03
		{
			type="rotation";
			angle0=0;
			angle1=0.1745329;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0.2;
			maxValue=4;
			minPhase=0.2;
			maxPhase=4;
			source="time";
			sourceAddress=2;
			selection="bullet002";
		};
		class bolt_begin
		{
			type="translation";
			offset0=0;
			offset1=0.5;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0.15;
			maxValue=0.2;
			minPhase=0.15;
			maxPhase=0.2;
			source="reloadMagazine";
			sourceAddress=0;
			selection="bolt";
		};
		class bolt_end
		{
			type="translation";
			offset0=0;
			offset1=-0.5;
			axis="ammo_belt_axis";
			memory=1;
			minValue=0.8;
			maxValue=0.9;
			minPhase=0.8;
			maxPhase=0.9;
			source="reloadMagazine";
			sourceAddress=0;
			selection="bolt";
		};
		class Bullet001
		{
			type="hide";
			hideValue=0.94501;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet001";
		};
		class Bullet002
		{
			type="hide";
			hideValue=0.95001;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet002";
		};
		class Bullet003
		{
			type="hide";
			hideValue=0.95501;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet003";
		};
		class Bullet004
		{
			type="hide";
			hideValue=0.96001;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet004";
		};
		class Bullet005
		{
			type="hide";
			hideValue=0.96501;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet005";
		};
		class Bullet006
		{
			type="hide";
			hideValue=0.97001;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet006";
		};
		class Bullet007
		{
			type="hide";
			hideValue=0.97501;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet007";
		};
		class Bullet008
		{
			type="hide";
			hideValue=0.98001;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet008";
		};
		class Bullet009
		{
			type="hide";
			hideValue=0.98501;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet009";
		};
		class Bullet010
		{
			type="hide";
			hideValue=0.99001;
			minValue=-1;
			maxValue=0;
			minPhase=-1;
			maxPhase=0;
			source="revolving";
			sourceAddress=2;
			selection="bullet010";
		};
		class feedtray_cover_up
		{
			type="rotation";
			angle0=0;
			angle1=-0.7853982;
			axis="feedtray_cover_axis";
			memory=1;
			minValue=0;
			maxValue=0.1;
			minPhase=0;
			maxPhase=0.1;
			source="reloadMagazine";
			sourceAddress=0;
			selection="feedtray_cover";
		};
		class feedtray_cover_down
		{
			type="rotation";
			angle0=0;
			angle1=0.7853982;
			axis="feedtray_cover_axis";
			memory=1;
			minValue=0.95;
			maxValue=1;
			minPhase=0.95;
			maxPhase=1;
			source="reloadMagazine";
			sourceAddress=0;
			selection="feedtray_cover";
		};
	};
};

class CTB_mas : Rifle{};
class CTB_ksp90b : MachineGun{};
class CTB_ksp58d : MachineGun{};

};

Also sorry if my config/model.cfg is really sucky :p

Thanks

Rhodesy

Share this post


Link to post
Share on other sites

Class MachineGun and class Rifle ?

Are these base classes already existing?

If so you shouldn't be trying to redefine (skeleton and other) it (and you probably cant, hence why its not working), you should be Inheriting it, like;

class Rifle;
class MyRifleSkeleton: Rifle
{

Same in cfgModels

Also in cfgModels, you're not inheriting correctly. Drop the brackets. Edit: think I wrong on this one

class CTB_mas : MyRifle;
class CTB_ksp90b : MyMachineGun;
class CTB_ksp58d : MyMachineGun;

Also, there a miss or two between you ACTUAL p3d file names and whats written in cfgModels.

All classes you want defined MUST match to an actual p3d filename located in the same directory as the MODEL.CFG

e.g.

You have a

model = "\CTB_Weap\lmg\CTB_ksp90b_aim";

But nowhere in cfgModel do I see a;

class CTB_ksp90b_aim : something

Edited by [APS]Gnat

Share this post


Link to post
Share on other sites

Sorry Gnat mate but your probaly going to have to walk me through the model cfg along with inheritance, its really not my thing haha.

Ive never seen a weapon model.cfg before so i dont really know what im looking at. and i suck at any kind of coding there is :o

Share this post


Link to post
Share on other sites

Inheritance is actually quite easy to understand. A class is basically a defenition of an object and since many objects share properties and only differ in small things it is useful to reuse defenitions. In Arma 2 you can call up a reference to an already defined class using:

class classname;

that will make an instance of that class you can derive from. In your example, because class rifle has already been defined by Arma 2 you do not need to redefine it so you dont need:

class Rifle:Default
{
  bla bla;
};

you can simply do

class Rifle;

The simplest example of inheritance would be:

class myrifle : Rifle {};

this would mean that myrifle inherits all its properties from Rifle and for all intents and purposes is exactly the same. In terms of Arma 2 model.cfg this would mean that the models have same selectionnames, animations and sections as all other BIS rifles to work properly. A more useful inheritance example would be:

class myrifle : Rifle
{
  property1 = 2;
};

this means that myrifle inherits every value from Rifle and changes the value of property1.

To get more information on inheritance please visit:

http://www.armastack.info/index.php/297

and also read the comments below by kju.

Share this post


Link to post
Share on other sites

The Config.cpp looks fine.

For model.cfg get the a1 sample models. They have model.cfg files for every class/unit/object type.

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  

×