CfgVehicleClasses: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Some wiki formatting)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
cfgVehicleClasses is the new way of using custom vehicleClasses in [[Armed Assault]].
{{TOC|side}}
'''CfgVehicleClasses''' is the new way of using custom vehicle classes in {{GameCategory|arma1|link= y}}.


== The cfgVehicleClasses entry ==


The way this functions is by a seperate cfgVehicleClasses entry, somewhere before the cfgVehicles.
== The CfgVehicleClasses entry ==
 
The way this functions is by a separate {{hl|CfgVehicleClasses}} entry, somewhere before the cfgVehicles.


It would appear like so:
It would appear like so:


<pre>class cfgVehicleClasses
<syntaxhighlight lang="cpp">
class CfgVehicleClasses
{
{
class MyClass
class MyClass
Line 13: Line 16:
displayName = "My Addons";
displayName = "My Addons";
};
};
};</pre>
};
</syntaxhighlight>
 


== The vehicleClass entry ==
== The vehicleClass entry ==


In the cfgVehicleClasses entry for your addon, you would insert
In the {{hl|CfgVehicleClasses}} entry for your addon, you would insert the following:


 
<syntaxhighlight lang="cpp">vehicleClass = "MyClass";</syntaxhighlight>
<pre>vehicleClass = "MyClass";</pre>




== Example Config ==
== Example Config ==


Here is an example config.cpp with correct use of cfgVehicelClasses:
Here is an example config.cpp with correct use of {{hl|cfgVehicleClasses}}:


<pre>// some basic defines
<syntaxhighlight lang="cpp"
>// some basic defines
#define TEast 0
#define TEast 0
#define TWest 1
#define TWest 1
Line 45: Line 50:
#define public 2
#define public 2


#define WeaponNoSlot 0// dummy weapons
#define WeaponNoSlot 0 // dummy weapons
#define WeaponSlotPrimary 1// primary weapons
#define WeaponSlotPrimary 1 // primary weapons
#define WeaponSlotSecondary 16// secondary weapons
#define WeaponSlotSecondary 16 // secondary weapons
#define WeaponSlotItem 256// items
#define WeaponSlotItem 256 // items
#define WeaponSlotBinocular 4096// binocular
#define WeaponSlotBinocular 4096 // binocular
#define WeaponHardMounted 65536
#define WeaponHardMounted 65536


class CfgPatches
class CfgPatches
Line 56: Line 61:
class MySoldier
class MySoldier
{
{
units[] = {"MySoldier"};
units[] = { "MySoldier" };
requiredAddons[] = {};
requiredAddons[] = {};
weapons[] = {};
weapons[] = {};
Line 62: Line 67:
};
};
};
};
class CfgVehicleClasses
class CfgVehicleClasses
{
{
Line 70: Line 76:
};
};


class cfgVehicles
class CfgVehicles
{
{
class All {};
class All {};
class AllVehicles: All {};
class AllVehicles : All {};
class Land: AllVehicles {};
class Land : AllVehicles {};
class Man:Land {};
class Man : Land {};
class CAManBase: Man {};
class CAManBase : Man {};
class SoldierWB: CAManBase {};
class SoldierWB : CAManBase {};
class MySoldier: SoldierWB
class MySoldier : SoldierWB
{
displayName = "My Soldier";
vehicleClass = "MySoldierClass";
weapons[] = { "M4AIM", "M9", "Throw", "Put" };
magazines[] = { "30Rnd_556x45_Stanag", "15Rnd_9x19_M9", "15Rnd_9x19_M9" };
};
};
</syntaxhighlight>
 
 
Here is an example {{hl|config.cpp}} with a simplified and safer use of {{hl|CfgVehicleClasses}}:
 
<syntaxhighlight lang="cpp">
// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7
 
#define true 1
#define false 0
 
// type scope
#define private 0
#define protected 1
#define public 2
 
#define WeaponNoSlot 0 // dummy weapons
#define WeaponSlotPrimary 1 // primary weapons
#define WeaponSlotSecondary 16 // secondary weapons
#define WeaponSlotItem 256 // items
#define WeaponSlotBinocular 4096 // binocular
#define WeaponHardMounted 65536
 
class CfgPatches
{
class MySoldier
{
units[] = { "MySoldier" };
requiredAddons[] = { "CACharacters" };  // to avoid enlisting addon in every new mission
weapons[] = {};
requiredVersion = 1.00;
};
};
 
class CfgVehicleClasses
{
class MySoldierClass
{
{
displayName="My Soldier";
displayName = "My Soldiers";
};
};
 
class CfgVehicles
{
class SoldierWB; // ArmA addonmaker doesn't need to know whole parency tree
class MySoldier : SoldierWB
{
displayName = "My Soldier";
vehicleClass = "MySoldierClass";
vehicleClass = "MySoldierClass";
weapons[]={"M4AIM","M9","Throw","Put"};
weapons[] = { "M4AIM", "M9", "Throw", "Put" };
magazines[]={"30Rnd_556x45_Stanag","15Rnd_9x19_M9","15Rnd_9x19_M9"};
magazines[] = { "30Rnd_556x45_Stanag", "15Rnd_9x19_M9", "15Rnd_9x19_M9" };
};
};
};</pre>
};
</syntaxhighlight>
 
Second example shows safer and easier way to describe parent class in vehicle config.




Line 93: Line 164:
The end result would appear somewhat like this:
The end result would appear somewhat like this:


[[Image:Cfgvehicleclasses_result.jpg|thumb|150px|left|cfgVehicleClasses Result]]
[[File:Cfgvehicleclasses_result.jpg|thumb|400px|left|{{hl|CfgVehicleClasses}} result]]




[[Category:ArmA: Addon Editing]]
{{GameCategory|arma1|Addon Configuration}}

Latest revision as of 00:22, 25 March 2024

CfgVehicleClasses is the new way of using custom vehicle classes in ArmA: Armed Assault.


The CfgVehicleClasses entry

The way this functions is by a separate CfgVehicleClasses entry, somewhere before the cfgVehicles.

It would appear like so:

class CfgVehicleClasses
{
	class MyClass
	{
		displayName = "My Addons";
	};
};


The vehicleClass entry

In the CfgVehicleClasses entry for your addon, you would insert the following:

vehicleClass = "MyClass";


Example Config

Here is an example config.cpp with correct use of cfgVehicleClasses:

// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

#define WeaponNoSlot				0		// dummy weapons
#define WeaponSlotPrimary			1		// primary weapons
#define WeaponSlotSecondary			16		// secondary weapons
#define WeaponSlotItem				256		// items
#define WeaponSlotBinocular			4096	// binocular
#define WeaponHardMounted			65536

class CfgPatches
{
	class MySoldier
	{
		units[] = { "MySoldier" };
		requiredAddons[] = {};
		weapons[] = {};
		requiredVersion = 1.00;
	};
};

class CfgVehicleClasses
{
	class MySoldierClass
	{
		displayName = "My Soldiers";
	};
};

class CfgVehicles
{
	class All {};
	class AllVehicles : All {};
	class Land : AllVehicles {};
	class Man : Land {};
	class CAManBase : Man {};
	class SoldierWB : CAManBase {};
	class MySoldier : SoldierWB
	{
		displayName = "My Soldier";
		vehicleClass = "MySoldierClass";
		weapons[] = { "M4AIM", "M9", "Throw", "Put" };
		magazines[] = { "30Rnd_556x45_Stanag", "15Rnd_9x19_M9", "15Rnd_9x19_M9" };
		
	};
};


Here is an example config.cpp with a simplified and safer use of CfgVehicleClasses:

// some basic defines
#define TEast 0
#define TWest 1
#define TGuerrila 2
#define TCivilian 3
#define TSideUnknown 4
#define TEnemy 5
#define TFriendly 6
#define TLogic 7

#define true 1
#define false 0

// type scope
#define private 0
#define protected 1
#define public 2

#define WeaponNoSlot				0		// dummy weapons
#define WeaponSlotPrimary			1		// primary weapons
#define WeaponSlotSecondary			16		// secondary weapons
#define WeaponSlotItem				256		// items
#define WeaponSlotBinocular			4096	// binocular
#define WeaponHardMounted			65536

class CfgPatches
{
	class MySoldier
	{
		units[] = { "MySoldier" };
		requiredAddons[] = { "CACharacters" };  // to avoid enlisting addon in every new mission
		weapons[] = {};
		requiredVersion = 1.00;
	};
};

class CfgVehicleClasses
{
	class MySoldierClass
	{
		displayName = "My Soldiers";
	};
};

class CfgVehicles
{
	class SoldierWB; // ArmA addonmaker doesn't need to know whole parency tree
	class MySoldier : SoldierWB
	{
		displayName = "My Soldier";
		vehicleClass = "MySoldierClass";
		weapons[] = { "M4AIM", "M9", "Throw", "Put" };
		magazines[] = { "30Rnd_556x45_Stanag", "15Rnd_9x19_M9", "15Rnd_9x19_M9" };
		
	};
};

Second example shows safer and easier way to describe parent class in vehicle config.


Result

The end result would appear somewhat like this:

CfgVehicleClasses result