Jump to content
Sign in to follow this  
domcho

Need help with config.cpp for an addon

Recommended Posts

Hello. I've searched the forums and opened existing config.cpps but the more I read the harder it gets. Every config.cpp is different. Some have cfgSomething for example, others don't.

My current objective is: add 1 custom unit in the editor. When I open the editor I want to go to OPFOR -> My Faction -> My Men -> My Soldier

I use this as a template taken from Binkowski's sample US soldier model since it's the only config that is not as long as the bible:

#define true	1
#define false	0

class CfgPatches {
class BINK_soldier_p3d {
	units[] = {"bink_test_soldier"};
	weapons[] = {};
	requiredVersion = 1.0;
	requiredAddons[] = {};
};
};

class CfgVehicleClasses {
class BINK_Test_Soldier {
	displayName = "Test Soldier";
};
};

class CfgVehicles {
class All {};

class AllVehicles : All {};

class Land : AllVehicles {};

class Man : Land {};

class Soldier : Man {};

class Civilian : Man {};

 class USMC_Soldier_Base : Soldier {};

 class USMC_Soldier : USMC_Soldier_Base {};

 class USMC_Soldier_Light : USMC_Soldier {};

class bink_test_soldier : USMC_Soldier_Light {
	vehicleClass = "BINK_Test_Soldier";
	displayName = "Test Soldier";
	model = "\soldier_p3d\soldier";

	class Wounds {
		tex[] = {};
		mat[] = {"ca\characters\heads\male\defaulthead\data\hhl.rvmat", "ca\characters\heads\male\defaulthead\data\hhl_wounds.rvmat", "ca\characters\heads\male\defaulthead\data\hhl_wounds2.rvmat", "soldier_p3d\data\us_soldier_body.rvmat", "soldier_p3d\data\us_soldier_body_wound1.rvmat", "soldier_p3d\data\us_soldier_body_wound2.rvmat"};
	};
};
};

This creates a soldier under BLUFOR -> USMC -> Test Soldier -> Test Soldier

What do I have to change so mine looks like OPFOR -> My Faction -> My Men -> My Soldier

To start I don't even know how to change the faction. I was thinking of using cfgFactionClasses but this only added more text and thus created chaos in the config.cpp. Also what are those #define commands used for in the beggining, what is cfgPatches, what are those under cfgVehicles:

  class USMC_Soldier_Base : Soldier {};

 class USMC_Soldier : USMC_Soldier_Base {};

 class USMC_Soldier_Light : USMC_Soldier {};

The only things that I understand are the model paths.

Once again:

Side: OPFOR

Faction: My Faction

Class: My Men

Unit: My Soldier

I know I am asking simple questions, but this is completely new to me, when I did mission editing I always opened missions and learned from there, back in OFP when I wanted to do something in my mission and didn't know how I would remember on which mission in the campaigns it's done, open the campaign mission observe, study and finally do it in my mission, however it's not the same with the config.cpp, I open one and it's a wall of text I start to study it, then I open another config only to find out it's completely different wall of text with both having the same result in the editor, just different addons. Oh and everytime I do a change, pbo the folder and put it into @myaddon/addons it takes a lot of time for ArmA 2 to load to inspect something after every change (not to mention the countless errors I make inside the config.cpp making the game unable to run). Those things that I am asking are not explained in tutorials and yes I did read this https://community.bistudio.com/wiki/Mondkalb%27s_Addon_Tutorial#Config.cpp I only learned that class CfgVehicleClasses will create the name of my class which will be "My Men". Call me a retard but the information provided for cfgPatches does not help me understand what the cfgPatches command is used for except that the command should have the same name as the @myaddon folder (if I understood this correctly).

Thank you I will really appreciate it if you can break those simple things down!

Oh and mods (and other people too) please don't be mad for asking simple things, I am struggling hard but it's very confusing, none of the tutorials I read explains each line what it stands for. I can't simply copy-paste an existing cpp and expect it to work, how do I know what to change so it matches to my units.

Edited by Domcho

Share this post


Link to post
Share on other sites

Hard to explain as i´ve learned by "the school of bleeding eyes" - but take a look at the following example.

Basically, to change the west soldier to a russian one, i only changed the base class which our actual new unit is derived from:

class CfgPatches {					// pbo File header, required for all addons!
class tag_test_addon {					// unique name for your addon - always include your TAG as 1st entry - no spaces allowed
	units[] = {"tag_test_soldier"};		// all unit classnames you created in array form. (units[] = {"TAG_test_soldier","TAG_test_soldier1",etc.};)
	weapons[] = {};						// same as above, for weapons
	requiredVersion = 1.0;
	requiredAddons[] = {};
};
};

class CfgVehicleClasses {

class tag_test_vehicle_class {
	displayName = "Test Veh Class";
};
};

class CfgFactionClasses {

class tag_test_faction_class {
	displayName = "Test Fac Class";
	priority = 4;
	side = 0;  									// 0 = east, 1 = west, 2 = resistance
};
};

class CfgVehicles {

class RU_Soldier_Base;							// need to call baseclass once before inheriting

class tag_test_soldier : RU_Soldier_Base {		// inheriting all attributes from RU_Soldier_Base
	faction = "tag_test_faction_class";			
	vehicleClass = "tag_test_vehicle_class";	
	displayName = "Test Soldier";
	model = "\tag_pbo_filename\soldier.p3d";
};
};

The magic happens right there:

class RU_Soldier_Base;	
class tag_test_soldier : RU_Soldier_Base

In this little step, our new unit inherited all attributes from RU_Soldier_Base, another class present in the games configs.

Here´s the contents of said class (courtesy of AllInOne.cpp´s):

class RU_Soldier_Base: SoldierEB

{

scope = 1;

side = 0;

vehicleClass = "Men";

faction = "RU";

genericNames = "RussianMen";

cost = 80000;

accuracy = 1.5;

camouflage = 1.8;

identityTypes[] = {"Head_RU","RU_Glasses"};

faceType = "Man";

portrait = "\Ca\characters\data\portraits\comBarHead_ru_soldier_ca";

model = "\ca\characters2\Rus\Soldier";

picture = "\Ca\characters\data\Ico\i_null_CA.paa";

icon = "\Ca\characters2\data\icon\i_soldier_CA.paa";

weapons[] = {"AK_107_kobra","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};

magazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East","HandGrenade_East"};

respawnWeapons[] = {"AK_107_kobra","Throw","Put","ItemMap","ItemCompass","ItemWatch","ItemRadio"};

respawnMagazines[] = {"30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","30Rnd_545x39_AK","HandGrenade_East"};

class HitPoints: HitPoints

{

class HitHead: HitHead

{

armor = 0.85;

};

class HitBody: HitBody

{

armor = 1;

passThrough = 0.8;

};

};

class Wounds

{

tex[] = {};

mat[] = {"ca\characters2\Rus\DATA\soldier_flora_vsr_vest.RVmat","ca\characters2\Rus\DATA\soldier_flora_vsr_vest_w1.RVmat","ca\characters2\Rus\DATA\soldier_flora_vsr_vest_w2.RVmat","ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest.RVmat","ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest_w1.RVmat","ca\characters2\Rus\DATA\soldier_co_flora_vsr_vest_w2.RVmat","ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest.RVmat","ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest_w1.RVmat","ca\characters2\Rus\DATA\soldier_mg_flora_vsr_vest_w2.RVmat","ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest.RVmat","ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest_w1.RVmat","ca\characters2\Rus\DATA\soldier_at_flora_VSR_vest_w2.RVmat","ca\characters2\Rus\DATA\soldier_pilot_flora_vsr.RVmat","ca\characters2\Rus\DATA\soldier_pilot_flora_vsr_w1.RVmat","ca\characters2\Rus\DATA\soldier_pilot_flora_vsr_w2.RVmat","ca\characters2\Rus\DATA\soldier_crew_flora_vsr.RVmat","ca\characters2\Rus\DATA\soldier_crew_flora_vsr_w1.RVmat","ca\characters2\Rus\DATA\soldier_crew_flora_vsr_w2.RVmat","ca\characters2\Rus\DATA\Commander.rvmat","ca\characters2\Rus\DATA\W1_Commander.rvmat","ca\characters2\Rus\DATA\W2_Commander.rvmat"};

};

class TalkTopics: TalkTopics

{

core_ru = "Core_Full";

};

languages[] = {"RU"};

};

You might have noticed by now, clever inheriting will spare you shitloads of excess code :D

Share this post


Link to post
Share on other sites
What? You just made a post asking for help but you made a tutorial post when you dont know what youre doing?

http://forums.bistudio.com/showthread.php?190861-ARMA-2-OA-Config-Some-Input-after-End-of-File

Hehe, I do know what I'm doing, buddy. Just because I made a tutorial doesn't mean I can't ask for some help!

Cheers!

Edited by Yazp

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  

×