Soldier Protection – Arma 3

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ")
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Arma 3: Tutorials]]
{{TOC|side}}
[[Category:Arma 3: Editing]]
{{Wiki|stub}}
The current state of the documentation only covers the basics of the implementation, some information might be inaccurate. Additional details will be added soon.
== General ==
This system allows the definition of the protection level of various [[LOD#Hit-points|hit-points]] (head, face, neck) in a given piece of equipment (I.e. Headgear, vest). To do so, the system supports the following hit points: head, face, neck, chest, diaphragm, abdomen, pelvis, arms, hands and legs.


Each equipment item which should have a certain level of protection should have the necessary hit point configured (see examples bellow)
 
This new system allows the definition of the protection level of various [[LOD#Hit-points|hit-points]] (head, face, neck) in a given piece of equipment (I.e. Headgear, vest).<br>
Each equipment item which should have a certain level of protection should have the necessary hit point configured (see examples below).


For the story, the old system was able to cover only one hit-point, as shown hereafter:
For the story, the old system was able to cover only one hit-point, as shown hereafter:
{|  
{| style="margin: auto"
!  
! Old System
!  
! New System
|- style="vertical-align:top;"
! New supported hitpoints
| <center>[[File:soldierProtectionOld.jpg|250px]]</center>
|- style="vertical-align:top"
| <center>[[File:soldierProtectionCurrent.jpg|250px]] </center>
| style="text-align: center" | [[File:soldierProtectionOld.jpg|250px]]
|- style="vertical-align:top;"
| style="text-align: center" |  [[File:soldierProtectionCurrent.jpg|250px]]
| <syntaxhighlight lang="cpp">class ItemInfo
|
* head
* face
* neck
* chest
* diaphragm
* abdomen
* pelvis
* arms
* hands
* legs
|- style="vertical-align:top"
|
<syntaxhighlight lang="cpp">
class ItemInfo
{
{
    hitPointName   = "HitBody";
hitPointName = "HitBody";
    armor           = [0,∞];
armor = 1; //float [0 .. ∞]
    passThrough     = [0,1];
passThrough = 1.0 //float [0 .. 1]
};</syntaxhighlight>
};
| <syntaxhighlight lang="cpp">class ItemInfo
</syntaxhighlight>
|
<syntaxhighlight lang="cpp">
class ItemInfo
{
{
    class HitpointsProtectionInfo
class HitpointsProtectionInfo
    {
{
        class Chest
class Chest
        {
{
            hitpointName   = "HitChest";
hitpointName = "HitChest";
            armor           = [0,∞];
armor = 1 ; //float [0 .. ∞]
            passThrough     = [0,1];
passThrough = 1.0; //float [0 .. 1]
        };
};
        class Diaphragm
class Diaphragm
        {
{
            hitpointName   = "HitDiaphragm";
hitpointName = "HitDiaphragm";
            armor           = [0,∞];
armor = 1 ; //float [0 .. ∞]
            passThrough     = [0,1];
passThrough = 1.0 ; //float [0 .. 1]
        };
};
    };
};
};</syntaxhighlight>
};
</syntaxhighlight>
|
|}
|}
<!-- ==Functionality==
todo


-->== Implementation ==
 
== Implementation ==
 
As described hereafter, various properties (hitpoint) need to be defined in the config to fully benefit from the soldier protection.
As described hereafter, various properties (hitpoint) need to be defined in the config to fully benefit from the soldier protection.
==== Unit base class ====
 
The following code is an example of a custom man base class containing every config parameters relevant to the soldier protection. Its values represents the state of the soldier protection without any equipment, each piece of gear can increase the protection level of one of these hit points, provided it is configured. This class is just here to help you understanding the relation between the configuration of a gear item and the base class.  
=== Unit base class ===
 
The following code is an example of a custom man base class containing every config parameters relevant to the soldier protection.
Its values represents the state of the soldier protection without any equipment, each piece of gear can increase the protection level of one of these hit points, provided it is configured.
This class is just here to help you understanding the relation between the configuration of a gear item and the base class.


Note: Good practice is not to edit or update the base class but create a new class which inherits from the vanilla class.
Note: Good practice is not to edit or update the base class but create a new class which inherits from the vanilla class.
Line 53: Line 75:
{
{
class Man;
class Man;
class CAManBase: Man
class CAManBase : Man
{
{
class HitPoints
class HitPoints
Line 63: Line 85:
};
};
};
};
class TM4_CAManBase: CAManBase
class TM4_CAManBase : CAManBase
{
{
class HitPoints: HitPoints
armor = 2; // total hit points (meaning global "health") of the object.
// keep constant among various soldiers so that the hit points armor coefficients remains on the same scale
armorStructural = 0.4; // divides all damage taken to total hit point, either directly or through hit point passThrough coefficient.
// must be adjusted for each model to achieve consistent total damage results
explosionShielding = 0.04; // for consistent explosive damage after adjusting = ( armorStructural / 10 )
minTotalDamageThreshold = 0.001; // minimalHit for total damage
impactDamageMultiplier = 0.5; // multiplier for falling damage
 
class HitPoints
{
{
class HitFace: HitHead
class HitFace
{
{
armor               = 1; // coefficient of the total armor defined below for the whole object
armor = 1; // "Healthpoints" of this hitpoint is armor value (of hitpoint) * armor value (coefficient of the total armor defined below for the whole object)
material           = -1; // damage material (-1 means "unused")
material = -1; // damage material (-1 means "unused")
name               = "face_hub"; // selection name from hit points LOD in object
name = "face_hub"; // selection name from hit points LOD in object
passThrough         = 0.1; // coefficient defining how much damage will pass into total damage when this hit point is damaged
passThrough = 0.1; // coefficient defining how much damage will pass into total damage when this hit point is damaged
radius             = 0.08; // size of the hit point sphere, this is how it works: https://community.bistudio.com/wiki/Arma_3_Damage_Description
radius = 0.08; // size of the hit point sphere, this is how it works: https://community.bistudio.com/wiki/Arma_3_Damage_Description
explosionShielding = 0.1; // multiplier of explosive damage (parameter: explosive > 0 in ammunition type)
explosionShielding = 0.1; // multiplier of explosive damage (parameter: explosive > 0 in ammunition type)
minimalHit         = 0.01; // minimal damage value that can be applied, damage below this threshold is ignored
minimalHit = 0.01; // minimal damage value that can be applied (based on armor value), damage below this threshold is ignored
// example: total hit point armor = 2 and hitpoint class armor = 10 and minimalHit = 0.04
// -> all damage below a hit value of 2*10*0.04 = 0.8 is ignored
}
}
class HitNeck: HitFace
class HitNeck : HitFace
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "neck";
name = "neck";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.1;
radius = 0.1;
explosionShielding = 0.5;
explosionShielding = 0.5;
minimalHit         = 0.01;
minimalHit = 0.01;
}
}
class HitHead: HitNeck
class HitHead : HitNeck
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "head";
name = "head";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.2;
radius = 0.2;
explosionShielding = 0.5;
explosionShielding = 0.5;
minimalHit         = 0.01;
minimalHit = 0.01;
depends             = "HitFace max HitNeck"; // returns the greater of HitFace and HitNeck.
depends = "HitFace max HitNeck"; // returns the greater of HitFace and HitNeck.
// for depends to work, HitHead must be inheriting from HitFace and HitNeck.
// "max" is not the only operator you can use. + and * are confirmed working.
// Other operators from the https://community.bistudio.com/wiki/Simple_Expression list may be usable as well.
};
};
class HitPelvis: HitBody
class HitPelvis
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "pelvis";
name = "pelvis";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.2;
radius = 0.2;
explosionShielding = 1;
explosionShielding = 1;
visual             = "injury_body";
visual = "injury_body";
minimalHit         = 0.01;
minimalHit = 0.01;
};
};
class HitAbdomen: HitPelvis
class HitAbdomen : HitPelvis
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "spine1";
name = "spine1";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.15;
radius = 0.15;
explosionShielding = 1;
explosionShielding = 1;
visual             = "injury_body";
visual = "injury_body";
minimalHit         = 0.01;
minimalHit = 0.01;
};
};
class HitDiaphragm: HitAbdomen
class HitDiaphragm : HitAbdomen
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "spine2";
name = "spine2";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.15;
radius = 0.15;
explosionShielding = 6;
explosionShielding = 6;
visual             = "injury_body";
visual = "injury_body";
minimalHit         = 0.01;
minimalHit = 0.01;
}
}
class HitChest: HitDiaphragm
class HitChest : HitDiaphragm
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "spine3";
name = "spine3";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.15;
radius = 0.15;
explosionShielding = 6;
explosionShielding = 6;
visual             = "injury_body";
visual = "injury_body";
minimalHit         = 0.01;
minimalHit = 0.01;
};
};
class HitBody: HitChest
class HitBody : HitChest
{
{
armor               = 1000; // not supposed to take damage directly
armor = 1000; // not supposed to take damage directly
material           = -1;
material = -1;
name               = "body";
name = "body";
passThrough         = 0.1;
passThrough = 0.1;
radius             = 0.16;
radius = 0.16;
explosionShielding = 6;
explosionShielding = 6;
visual             = "injury_body";
visual = "injury_body";
minimalHit         = 0.01;
minimalHit = 0.01;
depends             = "HitPelvis max HitAbdomen max HitDiaphragm max HitChest";
depends = "HitPelvis max HitAbdomen max HitDiaphragm max HitChest"; // depends work only for hit points defined in inheritance chain
// arbitrary example for different operator usage: = "(2* (HitPelvis + HitAbdomen) * HitDiaphragm) max HitChest";
 
};
};
class HitArms: HitHands
class HitArms
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "arms";
name = "arms";
passThrough         = 1;
passThrough = 1;
radius             = 0.1;
radius = 0.1;
explosionShielding = 1;
explosionShielding = 1;
visual             = "injury_hands";
visual = "injury_hands";
minimalHit         = 0.01;
minimalHit = 0.01;
};
};
class HitHands: HitArms
class HitHands : HitArms
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "hands";
name = "hands";
passThrough         = 1;
passThrough = 1;
radius             = 0.1;
radius = 0.1;
explosionShielding = 1;
explosionShielding = 1;
visual             = "injury_hands";
visual = "injury_hands";
minimalHit         = 0.01;
minimalHit = 0.01;
depends             = "HitArms";
depends = "HitArms";
};
};
class HitLegs: HitLegs
class HitLegs
{
{
armor               = 1;
armor = 1;
material           = -1;
material = -1;
name               = "legs";
name = "legs";
passThrough         = 1;
passThrough = 1;
radius             = 0.12;
radius = 0.12;
explosionShielding = 1;
explosionShielding = 1;
visual             = "injury_legs";
visual = "injury_legs";
minimalHit         = 0.01;
minimalHit = 0.01;
};
};
};
};
armor = 2; // keep constant among various soldiers so that the hit points armor coefficients remains on the same scale
armorStructural = 0.4; // divide all damage taken to total hit point, either directly or through hit point passThrough coefficient, must be adjusted for each model to achieve consistent total damage results
explosionShielding = 0.04; // for consistent explosive damage after adjusting = ( armorStructural / 10 )
minTotalDamageThreshold = 0.001; // minimalHit for total damage
impactDamageMultiplier = 0.5; // multiplier for falling damage
};
};
};
};
</syntaxhighlight>
</syntaxhighlight>


==== Armored vest ====
=== Armored vest ===
 
The following vest config will provide protection for the neck, arms, chest, diaphragm abdomen and body.
The following vest config will provide protection for the neck, arms, chest, diaphragm abdomen and body.
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
// Carrier Special Rig (Green)
// Carrier Special Rig (Green)
class V_PlateCarrierSpec_rgr: Vest_NoCamo_Base
class V_PlateCarrierSpec_rgr : Vest_NoCamo_Base
{
/* other properties */
class ItemInfo : ItemInfo
{
{
/* other properties */
/* other properties */
class ItemInfo: ItemInfo
class HitpointsProtectionInfo
{
{
/* other properties */
class Neck
class HitpointsProtectionInfo
{
hitpointName = "HitNeck"; // reference to the hit point class defined in the man base class
armor = 8; // addition to armor of referenced hitpoint
passThrough = 0.5; // multiplier of base passThrough defined in referenced hitpoint
};
class Arms
{
hitpointName = "HitArms";
armor = 8;
passThrough = 0.5;
};
class Chest
{
hitpointName = "HitChest";
armor = 24;
passThrough = 0.1;
};
class Diaphragm
{
hitpointName = "HitDiaphragm";
armor = 24;
passThrough = 0.1;
};
class Abdomen
{
{
class Neck
hitpointName = "HitAbdomen";
{
armor = 24;
hitpointName = "HitNeck"; // reference to the hit point class defined in the man base class
passThrough = 0.1;
armor = 8; // addition to armor of referenced hitpoint
};
passThrough = 0.5; // multiplier of base passThrough defined in referenced hitpoint
class Body
};
{
class Arms
hitpointName = "HitBody";
{
passThrough = 0.1;
hitpointName = "HitArms";
armor = 8;
passThrough = 0.5;
};
class Chest
{
hitpointName = "HitChest";
armor = 24;
passThrough = 0.1;  
};
class Diaphragm
{
hitpointName = "HitDiaphragm";
armor = 24;
passThrough = 0.1;
};
class Abdomen
{
hitpointName = "HitAbdomen";
armor = 24;
passThrough = 0.1;
};
class Body
{
hitpointName = "HitBody";
passThrough = 0.1;
};
};
};
};
};
};
};
};
</syntaxhighlight>
</syntaxhighlight>


==== Headgear ====
=== Headgear ===
This headgear increases the protection of the Head only, for example it doesn't provide additional protection for the face, so the value from the base class (above) will be used as they are defined.
 
This headgear increases the protection of the Head only, for example it doesn't provide additional protection for the face,
so the value from the base class (above) will be used as they are defined.
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class H_HelmetB: ItemCore
class H_HelmetB : ItemCore
{
/* other properties */
class ItemInfo : HeadgearItem
{
{
/* other properties */
/* other properties */
class ItemInfo : HeadgearItem
class HitpointsProtectionInfo
{
{
/* other properties */
class Head
class HitpointsProtectionInfo
{
{
class Head
hitpointName = "HitHead"; // reference to the hit point class defined in the man base class
{
armor = 6; // addition to armor of referenced hitpoint
hitpointName = "HitHead"; // reference to the hit point class defined in the man base class
passThrough = 0.5; // multiplier of base passThrough defined in referenced hitpoint
armor = 6; // addition to armor of referenced hitpoint
passThrough = 0.5; // multiplier of base passThrough defined in referenced hitpoint
};
};
};
};
};
};
};
};
</syntaxhighlight>
</syntaxhighlight>
{{GameCategory|arma3|Tutorials}}
{{GameCategory|arma3|Editing}}

Latest revision as of 10:57, 6 December 2023


This new system allows the definition of the protection level of various hit-points (head, face, neck) in a given piece of equipment (I.e. Headgear, vest).
Each equipment item which should have a certain level of protection should have the necessary hit point configured (see examples below).

For the story, the old system was able to cover only one hit-point, as shown hereafter:

Old System New System New supported hitpoints
soldierProtectionOld.jpg soldierProtectionCurrent.jpg
  • head
  • face
  • neck
  • chest
  • diaphragm
  • abdomen
  • pelvis
  • arms
  • hands
  • legs
class ItemInfo
{
	hitPointName	= "HitBody";
	armor			= 1; //float [0 .. ∞]
	passThrough		= 1.0 //float [0 .. 1]
};
class ItemInfo
{
	class HitpointsProtectionInfo
	{
		class Chest
		{
			hitpointName	= "HitChest";
			armor			= 1 ; //float [0 .. ∞]
			passThrough		= 1.0; //float [0 .. 1]
		};
		class Diaphragm
		{
			hitpointName	= "HitDiaphragm";
			armor			= 1 ; //float [0 .. ∞]
			passThrough		= 1.0 ; //float [0 .. 1]
		};
	};
};


Implementation

As described hereafter, various properties (hitpoint) need to be defined in the config to fully benefit from the soldier protection.

Unit base class

The following code is an example of a custom man base class containing every config parameters relevant to the soldier protection. Its values represents the state of the soldier protection without any equipment, each piece of gear can increase the protection level of one of these hit points, provided it is configured. This class is just here to help you understanding the relation between the configuration of a gear item and the base class.

Note: Good practice is not to edit or update the base class but create a new class which inherits from the vanilla class.

class CfgVehicles
{
	class Man;
	class CAManBase : Man
	{
		class HitPoints
		{
			class HitHead;
			class HitBody;
			class HitHands;
			class HitLegs;
		};
	};
	class TM4_CAManBase : CAManBase
	{
		armor				= 2;	// total hit points (meaning global "health") of the object.
									// keep constant among various soldiers so that the hit points armor coefficients remains on the same scale
		armorStructural		= 0.4;	// divides all damage taken to total hit point, either directly or through hit point passThrough coefficient.
									// must be adjusted for each model to achieve consistent total damage results
		explosionShielding	= 0.04; // for consistent explosive damage after adjusting = ( armorStructural / 10 )
		minTotalDamageThreshold	= 0.001;	// minimalHit for total damage
		impactDamageMultiplier	= 0.5;		// multiplier for falling damage

		class HitPoints
		{
			class HitFace
			{
				armor				=  1;	// "Healthpoints" of this hitpoint is armor value (of hitpoint) * armor value (coefficient of the total armor defined below for the whole object)
				material			= -1;	// damage material (-1 means "unused")
				name				= "face_hub"; // selection name from hit points LOD in object
				passThrough			= 0.1;	// coefficient defining how much damage will pass into total damage when this hit point is damaged
				radius				= 0.08;	// size of the hit point sphere, this is how it works: https://community.bistudio.com/wiki/Arma_3_Damage_Description
				explosionShielding	= 0.1;	// multiplier of explosive damage (parameter: explosive > 0 in ammunition type)
				minimalHit			= 0.01;	// minimal damage value that can be applied (based on armor value), damage below this threshold is ignored
											// example: total hit point armor = 2 and hitpoint class armor = 10 and minimalHit = 0.04
											// -> all damage below a hit value of 2*10*0.04 = 0.8 is ignored
			}
			class HitNeck : HitFace
			{
				armor				=  1;
				material			= -1;
				name				= "neck";
				passThrough			= 0.1;
				radius				= 0.1;
				explosionShielding	= 0.5;
				minimalHit			= 0.01;
			}
			class HitHead : HitNeck
			{
				armor				=  1;
				material			= -1;
				name				= "head";
				passThrough			= 0.1;
				radius				= 0.2;
				explosionShielding	= 0.5;
				minimalHit			= 0.01;
				depends				= "HitFace max HitNeck"; // returns the greater of HitFace and HitNeck.
				// for depends to work, HitHead must be inheriting from HitFace and HitNeck.
				// "max" is not the only operator you can use. + and * are confirmed working.
				// Other operators from the https://community.bistudio.com/wiki/Simple_Expression list may be usable as well.
			};
			class HitPelvis
			{
				armor				=  1;
				material			= -1;
				name				= "pelvis";
				passThrough			= 0.1;
				radius				= 0.2;
				explosionShielding	= 1;
				visual				= "injury_body";
				minimalHit			= 0.01;
			};
			class HitAbdomen : HitPelvis
			{
				armor				=  1;
				material			= -1;
				name				= "spine1";
				passThrough			= 0.1;
				radius				= 0.15;
				explosionShielding	= 1;
				visual				= "injury_body";
				minimalHit			= 0.01;
			};
			class HitDiaphragm : HitAbdomen
			{
				armor				=  1;
				material			= -1;
				name				= "spine2";
				passThrough			= 0.1;
				radius				= 0.15;
				explosionShielding	= 6;
				visual				= "injury_body";
				minimalHit			= 0.01;
			}
			class HitChest : HitDiaphragm
			{
				armor				=  1;
				material			= -1;
				name				= "spine3";
				passThrough			= 0.1;
				radius				= 0.15;
				explosionShielding	= 6;
				visual				= "injury_body";
				minimalHit			= 0.01;
			};
			class HitBody : HitChest
			{
				armor				= 1000; // not supposed to take damage directly
				material			= -1;
				name				= "body";
				passThrough			= 0.1;
				radius				= 0.16;
				explosionShielding	= 6;
				visual				= "injury_body";
				minimalHit			= 0.01;
				depends				= "HitPelvis max HitAbdomen max HitDiaphragm max HitChest"; // depends work only for hit points defined in inheritance chain
				// arbitrary example for different operator usage: = "(2* (HitPelvis + HitAbdomen) * HitDiaphragm) max HitChest";

			};
			class HitArms
			{
				armor				=  1;
				material			= -1;
				name				= "arms";
				passThrough			= 1;
				radius				= 0.1;
				explosionShielding	= 1;
				visual				= "injury_hands";
				minimalHit			= 0.01;
			};
			class HitHands : HitArms
			{
				armor				=  1;
				material			= -1;
				name				= "hands";
				passThrough			= 1;
				radius				= 0.1;
				explosionShielding	= 1;
				visual				= "injury_hands";
				minimalHit			= 0.01;
				depends				= "HitArms";
			};
			class HitLegs
			{
				armor				=  1;
				material			= -1;
				name				= "legs";
				passThrough			= 1;
				radius				= 0.12;
				explosionShielding	= 1;
				visual				= "injury_legs";
				minimalHit			= 0.01;
			};
		};
	};
};

Armored vest

The following vest config will provide protection for the neck, arms, chest, diaphragm abdomen and body.

// Carrier Special Rig (Green)
class V_PlateCarrierSpec_rgr : Vest_NoCamo_Base
{
	/* other properties */
	class ItemInfo : ItemInfo
	{
		/* other properties */
		class HitpointsProtectionInfo
		{
			class Neck
			{
				hitpointName	= "HitNeck";	// reference to the hit point class defined in the man base class
				armor			= 8;			// addition to armor of referenced hitpoint
				passThrough		= 0.5;			// multiplier of base passThrough defined in referenced hitpoint
			};
			class Arms
			{
				hitpointName	= "HitArms";
				armor			= 8;
				passThrough		= 0.5;
			};
			class Chest
			{
				hitpointName	= "HitChest";
				armor			= 24;
				passThrough		= 0.1;
			};
			class Diaphragm
			{
				hitpointName	= "HitDiaphragm";
				armor			= 24;
				passThrough		= 0.1;
			};
			class Abdomen
			{
				hitpointName	= "HitAbdomen";
				armor			= 24;
				passThrough		= 0.1;
			};
			class Body
			{
				hitpointName	= "HitBody";
				passThrough		= 0.1;
			};
		};
	};
};

Headgear

This headgear increases the protection of the Head only, for example it doesn't provide additional protection for the face, so the value from the base class (above) will be used as they are defined.

class H_HelmetB : ItemCore
{
	/* other properties */
	class ItemInfo : HeadgearItem
	{
		/* other properties */
		class HitpointsProtectionInfo
		{
			class Head
			{
				hitpointName	= "HitHead";	// reference to the hit point class defined in the man base class
				armor			= 6;			// addition to armor of referenced hitpoint
				passThrough		= 0.5;			// multiplier of base passThrough defined in referenced hitpoint
			};
		};
	};
};