6thSense.eu/CG: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 8: | Line 8: | ||
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's contents. <br /> | ||
A config is used for defining, inheriting and overwriting classes. <br /> | A config is used for defining, inheriting and overwriting classes. <br /> | ||
* | = Available Root Classes = | ||
* | * CfgPatches | ||
* | * CfgModels | ||
* | * CfgSkeletons | ||
* | * CfgAmmo | ||
* | * CfgWeapons | ||
* | * CfgMagazines | ||
* | * CfgVehicles | ||
* | * CfgMaterials | ||
* | * CfgTextureToMaterial | ||
* CfgWorlds (Islands) | |||
* Animations | |||
Line 62: | Line 62: | ||
== 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 | 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 === | ||
Line 108: | Line 108: | ||
}; | }; | ||
class M4A1SD: M4AIM | class M4A1SD: M4AIM | ||
{ | { |
Revision as of 16:02, 8 February 2008
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's 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)
- Animations
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 you how to use RobertHammer's M4/M16 sounds
// 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};
};
};
};
Interesting Links
You can find some more info in my answers here: