6thSense.eu/CG: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - " ( *class [a-zA-Z0-9_]+): +" to " $1 : ")
 
(10 intermediate revisions by 4 users not shown)
Line 2: Line 2:
by [[6thSense.eu]]
by [[6thSense.eu]]


A view on Configs, by [http://community.bistudio.com/wiki/User:Sickboy Sickboy] <br />
A view on Configs, by [[User:Sickboy|Sickboy]] <br>
'''under construction'''
'''under construction'''
<br /><br />
<br><br>
= Basics =
= Basics =
A config decides parameters and properties of most aspects of the gameworld and it's contents. <br />
A config decides parameters and properties of most aspects of the gameworld and it is contents. <br>
A config is used for defining, inheriting and overwriting classes. <br />
A config is used for defining, inheriting and overwriting classes. <br>
<br /><br />
<br><br>
== Available Root Classes ==
== Available Root Classes ==
* CfgPatches
* CfgPatches
Line 21: Line 21:
* CfgWorlds (Islands)
* CfgWorlds (Islands)
TODO: Complete it
TODO: Complete it
<br /><br />
<br><br>
== Inheritance ==
== Inheritance ==
If you create a custom addon, and you want to base your thing on something that already exists and does not need to be redefined, you can use the following example:
If you create a custom addon, and you want to base your thing on something that already exists and does not need to be redefined, you can use the following example:
(test2 will be equal to test1 in this example)
(test2 will be equal to test1 in this example)
<code><nowiki>
<code style="display: block"><nowiki>
class test1;
class test1;
class test2: test1 {};
class test2 : test1 {};
</nowiki></code>
</nowiki></code>


You can inherit from other classes, e.g in this example, class test2 is equal to test1:
You can inherit from other classes, e.g in this example, class test2 is equal to test1:
<code><nowiki>
<code style="display: block"><nowiki>
class test1
class test1
{
{
Line 39: Line 39:
};
};


class test2: test1 {};
class test2 : test1 {};
</nowiki></code>
</nowiki></code>


in this example, test2 inherits all variables and values of test1, but changes val2 and adds a val4:
in this example, test2 inherits all variables and values of test1, but changes val2 and adds a val4:
<code><nowiki>
<code style="display: block"><nowiki>
class test1
class test1
{
{
Line 51: Line 51:
};
};


class test2: test1
class test2 : test1
{
{
   val2 = 3;
   val2 = 3;
Line 57: Line 57:
};
};
</nowiki></code>
</nowiki></code>
<br /><br />
<br><br>
== Overwriting ==
== Overwriting ==
You can overwrite or override specific sections of other configs (Default ArmA, or addon configs etc) <br />
You can overwrite or override specific sections of other configs (Default ArmA, or addon configs etc) <br>
Important is that you specify the addon which you overwrite/override, aswell as the addons it needs loaded, in the requiredAddons list within cfgPatches
Important is that you specify the addon which you overwrite/override, aswell as the addons it needs loaded, in the requiredAddons list within cfgPatches
<br /><br />
<br><br>
=== Examples ===
=== Examples ===


<br /><br />
<br><br>
= Config Examples =
= Config Examples =
== Weapon Sound Override Config ==
== Weapon Sound Override Config ==
This example shows you how to use RobertHammer's M4/M16 sounds
This example shows how to use override M4/M16 sounds by RobertHammer's
<code><nowiki>
<pre>
// Replaces M4/M16 Sounds by RobertHammer's M4/M16 Sounds
// Replaces M4/M16 Sounds by RobertHammer's M4/M16 Sounds
class CfgPatches
class CfgPatches
Line 89: Line 89:
{
{
class Rifle; // We do not need to define the class rifle here, only inherit
class Rifle; // We do not need to define the class rifle here, only inherit
class M4: Rifle // We redefine the M4 class here because want to override certain properties
class M4 : Rifle // We redefine the M4 class here because want to override certain properties
{
{
reloadMagazineSound[] = {"\RH_m4\sound\M4_Reload.ogg", 0.001, 1};
reloadMagazineSound[] = {"\RH_m4\sound\M4_Reload.ogg", 0.001, 1};
class Single: Mode_SemiAuto
class Single : Mode_SemiAuto
{
{
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
};
};
class Burst: Mode_Burst
class Burst : Mode_Burst
{
{
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
};
};
class FullAuto: Mode_FullAuto
class FullAuto : Mode_FullAuto
{
{
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
Line 106: Line 106:
};
};


class M4A1SD: M4AIM
class M4A1SD : M4AIM
{
{
class Single: Mode_SemiAuto
class Single : Mode_SemiAuto
{
{
sound[] = {"\RH_m4\sound\m4sd.ogg", 0.01, 1};
sound[] = {"\RH_m4\sound\m4sd.ogg", 0.01, 1};
};
};
class FullAuto: Mode_FullAuto
class FullAuto : Mode_FullAuto
{
{
sound[] = {"\RH_m4\sound\m4sd.ogg", 0.014125, 1};
sound[] = {"\RH_m4\sound\m4sd.ogg", 0.014125, 1};
Line 118: Line 118:
};
};


class M16A2: Rifle
class M16A2 : Rifle
{
{
class Single: Mode_SemiAuto
class Single : Mode_SemiAuto
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
};
};
class Burst: Mode_Burst
class Burst : Mode_Burst
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
Line 130: Line 130:
};
};
class m16a4: M16A2
class m16a4 : M16A2
{
{
class Single: Mode_SemiAuto
class Single : Mode_SemiAuto
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
};
};
class Burst: Mode_Burst
class Burst : Mode_Burst
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
};
};
};
};
class m16a4_acg: M16A2
class m16a4_acg : M16A2
{
{
class Single: Mode_SemiAuto
class Single : Mode_SemiAuto
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
};
};
class Burst: Mode_Burst
class Burst : Mode_Burst
{
{
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
};
};
};
};
</pre>
<br><br>
== Weapon Model and Picture Override ==
This example shows how models and some pictures are replaced by some of the best custom weapons out there <br>
<pre>
// Replaces Many Models by some of the best custom weapons out there
class CfgPatches
{
class SIX_Repl_WeaponModels
{
units[] = {};
weapons[] = {};
requiredVersion = 1.060000;
requiredAddons[] = {"CAData","CAWeapons","CAWeapons3","RH_M4","vilas_mod_models","RHS_Weap","Ska_Racs_Wp"}; // CAWeapons/Weapons3 because we override them, RH_M4, Vilas_mod_models, RHS_Weap and Ska_Racs_Wp because we use the models/pics from them
};
};
 
class cfgWeapons
{
// Base Classes
class Rifle;
 
// BI Class overwrites
class AK74 : Rifle
{
model = "\RHS_Weap\RHS_AK74";
picture = "\RHS_Weap\Ed\AK74pic.paa";
};
class aks74pso : AK74
{
model = "\RHS_Weap\RHS_AKS74PSO1";
picture = "\RHS_Weap\Ed\AKS74PSO1pic.paa";
};
 
class AKS74U : AK74
{
model = "\vilas_mod_models\AKs74u";
};
 
class AKS74UN : AKS74U
{
model = "\RHS_Weap\RHS_AKS74PBS3";
picture = "\RHS_Weap\Ed\AKS74PBS3pic.paa";
};
 
class AK74GL : AK74
{
model = "\RHS_Weap\RHS_AK74GP30";
picture = "\RHS_Weap\Ed\AK74GP30pic.paa";
};
 
class G36a : Rifle
{
model = "\vilas_mod_models\G36";
};
class G36C : G36a
{
model = "\vilas_mod_models\G36C";
};
class G36K : G36a
{
model = "\vilas_mod_models\G36_K";
};
 
class M4 : Rifle
{
model = "\RH_m4\RH_m4.p3d";
picture = "\RH_m4\inv\m4a1.paa";
};
 
class M4AIM : M4
{
model = "\RH_m4\RH_m4aim.p3d";
picture = "\RH_m4\inv\m4a1aim.paa";
};
class M4GL : M4
{
model = "\RH_m4\RH_m4glacog.p3d";
picture = "\RH_m4\inv\m4a1gl.paa";
};
 
class M4A1SD : M4AIM
{
model = "\RH_m4\RH_m4sd.p3d";
picture = "\RH_m4\inv\m4a1sd.paa";
};
 
class M16A2 : Rifle
{
model = "\RH_m4\RH_m16a2.p3d";
picture = "\RH_m4\inv\m16a2.paa";
};
 
class M16A2GL : M16A2
{
model = "\RH_m4\RH_m16a2gl.p3d";
picture = "\RH_m4\inv\m16a2gl.paa";
};
 
class m16a4 : M16A2
{
model = "\RH_m4\RH_m16a4.p3d";
picture = "\RH_m4\inv\m16a4.paa";
};
class M16A4_GL : M16A4
{
model = "\RH_m4\RH_m16a4gl.p3d";
picture = "\RH_m4\inv\m16a4gl.paa";
};
 
class m16a4_acg : M16A2
{
model = "\RH_m4\RH_m16a4acog.p3d";
picture = "\RH_m4\inv\m16a4acog.paa";
};
 
class M16A4_ACG_GL : M16A4_GL
{
model = "\RH_m4\RH_m16a4glacog.p3d";
picture = "\RH_m4\inv\m16a4glacog.paa";
};
class PK : Rifle
{
model = "\vilas_mod_models\PK_MG_proxy";
};
 
class M249 : Rifle
{
model = "\Ska_Racs_Wp\Ska_M249";
picture = "\Ska_Racs_Wp\Editor\M249pic.paa";
};
};
};
};
</nowiki></code>
</pre>
<br /><br />
<br><br>
= Interesting Links =
= Interesting Links =
* [http://community.bistudio.com/wiki/Category:ArmA:_Addon_Configuration ArmA Addon Configuration]
* {{GameCategory|arma1|Addon_Configuration}}
<br /><br />
<br><br>
You can find some more info in my answers here:<br />
You can find some more info in my answers here:<br>
 
[[Category:6thSense.eu]]

Latest revision as of 11:04, 6 December 2023

by 6thSense.eu

A view on Configs, by Sickboy
under construction

Basics

A config decides parameters and properties of most aspects of the gameworld and it is contents.
A config is used for defining, inheriting and overwriting classes.


Available Root Classes

  • CfgPatches
  • CfgModels
  • CfgSkeletons
  • CfgAmmo
  • CfgWeapons
  • CfgMagazines
  • CfgVehicles
  • CfgMaterials
  • CfgTextureToMaterial
  • CfgWorlds (Islands)

TODO: Complete it

Inheritance

If you create a custom addon, and you want to base your thing on something that already exists and does not need to be redefined, you can use the following example: (test2 will be equal to test1 in this example) class test1; class test2 : test1 {};

You can inherit from other classes, e.g in this example, class test2 is equal to test1: class test1 { val1 = 1; val2 = 2; val3 = 0; }; class test2 : test1 {};

in this example, test2 inherits all variables and values of test1, but changes val2 and adds a val4: class test1 { val1 = 1; val2 = 2; val3 = 0; }; class test2 : test1 { val2 = 3; val4 = 1; };

Overwriting

You can overwrite or override specific sections of other configs (Default ArmA, or addon configs etc)
Important is that you specify the addon which you overwrite/override, aswell as the addons it needs loaded, in the requiredAddons list within cfgPatches

Examples



Config Examples

Weapon Sound Override Config

This example shows how to use override M4/M16 sounds by RobertHammer's

// Replaces M4/M16 Sounds by RobertHammer's M4/M16 Sounds
class CfgPatches
{
	class SIX_rh_m4_soundpack
	{
		units[] = {};
		weapons[] = {};
		requiredVersion = 1.00;
		requiredAddons[] = {"CAWeapons","CAWeapons3","RH_M4"}; // CAWeapons/CAWeapons3 because those are the ones we override.  RH_M4 because thats the addon the sounds are used from
	};
};

// Inheriting the different firemode classes, so we can use them later on
class Mode_SemiAuto;
class Mode_Burst;
class Mode_FullAuto;

class CfgWeapons
{
	class Rifle; // We do not need to define the class rifle here, only inherit
	class M4 : Rifle // We redefine the M4 class here because want to override certain properties
	{
		reloadMagazineSound[] = {"\RH_m4\sound\M4_Reload.ogg", 0.001, 1};
		class Single : Mode_SemiAuto
		{
			sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
		};
		class Burst : Mode_Burst
		{
			sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
		};
		class FullAuto : Mode_FullAuto
		{
			sound[] = {"\RH_m4\sound\m4s.ogg", 5.62341, 1};
		};
	};

	class M4A1SD : M4AIM
	{
		class Single : Mode_SemiAuto
		{
			sound[] = {"\RH_m4\sound\m4sd.ogg", 0.01, 1};
		};
		class FullAuto : Mode_FullAuto
		{
			sound[] = {"\RH_m4\sound\m4sd.ogg", 0.014125, 1};
		};
	};

	class M16A2 : Rifle
	{
		class Single : Mode_SemiAuto
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
		class Burst : Mode_Burst
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
	};
	
	class m16a4 : M16A2
	{
		class Single : Mode_SemiAuto
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
		class Burst : Mode_Burst
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
	};
	
	class m16a4_acg : M16A2
	{
		class Single : Mode_SemiAuto
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
		class Burst : Mode_Burst
		{
			sound[] = {"\RH_m4\sound\m16s.ogg", 5.62341, 1};
		};
	};
};



Weapon Model and Picture Override

This example shows how models and some pictures are replaced by some of the best custom weapons out there

// Replaces Many Models by some of the best custom weapons out there
class CfgPatches
{
	class SIX_Repl_WeaponModels
	{
		units[] = {};
		weapons[] = {};
		requiredVersion = 1.060000;
		requiredAddons[] = {"CAData","CAWeapons","CAWeapons3","RH_M4","vilas_mod_models","RHS_Weap","Ska_Racs_Wp"}; // CAWeapons/Weapons3 because we override them, RH_M4, Vilas_mod_models, RHS_Weap and Ska_Racs_Wp because we use the models/pics from them
	};
};

class cfgWeapons
{	
	// Base Classes
	class Rifle;

	// BI Class overwrites
	class AK74 : Rifle
	{
		model = "\RHS_Weap\RHS_AK74";
		picture = "\RHS_Weap\Ed\AK74pic.paa";
	};
	
	class aks74pso : AK74
	{
		model = "\RHS_Weap\RHS_AKS74PSO1";
		picture = "\RHS_Weap\Ed\AKS74PSO1pic.paa";
	};

	class AKS74U : AK74
	{
		model = "\vilas_mod_models\AKs74u";
	};

	class AKS74UN : AKS74U
	{
		model = "\RHS_Weap\RHS_AKS74PBS3";
		picture = "\RHS_Weap\Ed\AKS74PBS3pic.paa";
	};

	class AK74GL : AK74
	{
		model = "\RHS_Weap\RHS_AK74GP30";
		picture = "\RHS_Weap\Ed\AK74GP30pic.paa";
	};

	class G36a : Rifle
	{
		model = "\vilas_mod_models\G36";
	};
	
	class G36C : G36a
	{
		model = "\vilas_mod_models\G36C";
	};
	
	class G36K : G36a
	{
		model = "\vilas_mod_models\G36_K";
	};

	class M4 : Rifle
	{
		model = "\RH_m4\RH_m4.p3d";
		picture = "\RH_m4\inv\m4a1.paa";
	};

	class M4AIM : M4
	{
		model = "\RH_m4\RH_m4aim.p3d";
		picture = "\RH_m4\inv\m4a1aim.paa";
	};
	
	class M4GL : M4
	{
		model = "\RH_m4\RH_m4glacog.p3d";
		picture = "\RH_m4\inv\m4a1gl.paa";
	};

	class M4A1SD : M4AIM
	{
		model = "\RH_m4\RH_m4sd.p3d";
		picture = "\RH_m4\inv\m4a1sd.paa";
	};

	class M16A2 : Rifle
	{
		model = "\RH_m4\RH_m16a2.p3d";
		picture = "\RH_m4\inv\m16a2.paa";
	};

	class M16A2GL : M16A2
	{
		model = "\RH_m4\RH_m16a2gl.p3d";
		picture = "\RH_m4\inv\m16a2gl.paa";
	};

	class m16a4 : M16A2
	{
		model = "\RH_m4\RH_m16a4.p3d";
		picture = "\RH_m4\inv\m16a4.paa";
	};
	
	class M16A4_GL : M16A4
	{
		model = "\RH_m4\RH_m16a4gl.p3d";
		picture = "\RH_m4\inv\m16a4gl.paa";
	};

	class m16a4_acg : M16A2
	{
		model = "\RH_m4\RH_m16a4acog.p3d";
		picture = "\RH_m4\inv\m16a4acog.paa";
	};

	class M16A4_ACG_GL : M16A4_GL
	{
		model = "\RH_m4\RH_m16a4glacog.p3d";
		picture = "\RH_m4\inv\m16a4glacog.paa";
	};
	
	class PK : Rifle
	{
		model = "\vilas_mod_models\PK_MG_proxy";
	};

	class M249 : Rifle
	{
		model = "\Ska_Racs_Wp\Ska_M249";
		picture = "\Ska_Racs_Wp\Editor\M249pic.paa";
	};
};



Interesting Links



You can find some more info in my answers here: