Adding Damage to your addon

Adding Damage to your addon tutorial by Gnat

Draft Revision 0 - 18th June 2008

I won't pretended to be a definitive expert on this, but it seems no one else has compiled known bits all together.

What I will address in this tut;

What I won't address (until further knowledge);

Scope

Damage Textures

Step 1 - Face selection

Step 2 - Material definitions

members.iinet.net.au_nrspence_arma_damagetut_dt_1.jpg

Step 3 - Destruct RVMATs

ambient[] = {1,1,1,1};
diffuse[] = {1,1,1,1};
forcedDiffuse[] = {0,0,0,0};
emmisive[] = {0,0,0,1};
specular[] = {1,1,1,0};
specularPower = 40;
PixelShaderID = "NormalMapMacroASSpecularDIMap";
VertexShaderID = "NormalMapAS";
class Stage1
{
	texture = "SIG_general\effects\bottom_nohq.pac";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage2
{
	texture = "ca\data\destruct\vehicle_destr256_256_mc.paa";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0.2,0,0};
		pos[] = {0.2,0,0};
	};
};
class Stage3
{
	texture = "#(argb,8,8,3)color(1,1,1,1)";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};
class Stage4
{
	texture = "ca\data\destruct\vehicle_destr256_256_smdi.paa";
	uvSource = "tex";
	class uvTransform
	{
		aside[] = {1,0,0};
		up[] = {0,1,0};
		dir[] = {0,0,0};
		pos[] = {0,0,0};
	};
};

There are 3 Red Highlighted section in the above code you need to customize;

Once finished you should have 5 files for each texture;

members.iinet.net.au_nrspence_arma_damagetut_dt_2.jpg

Step 4 - CONFIG.CPP

class CfgSkeletons
{
	class car;
	class MyAddonSkeleton: car
	{
		isDiscrete = 1;
		skeletonInherit = ""; 
class CfgModels
{
	class default{};
	class Vehicle: Default
	{
		sectionsInherit = "";
		sections[] = {xxxx, xxxxx, xxxxxx, xxxxxx};
	};
	class Car: Vehicle
	{
		sectionsInherit = "Vehicle";
		sections[] =
		{
			xxxxxx, xxxxx, xxxxx, xxxxx, xxxxxx
		};
	};
	class MyAddonP3D: Car
	{
		skeletonName = "MyAddonSkeleton";
		sectionsInherit = "car";

Below is an example

class CfgVehicles
{
	class Landrover;
	class MyAddon: Landrover
	{
		............
		............
		class Damage
		{
			tex[] = {};
			mat[] = {
				"SIG_general\effects\bottom.rvmat",
				"SIG_general\effects\bottom.rvmat",
				"SIG_general\effects\bottom_destruct.rvmat",
				.............
				............
				.............
				"SIG_general\effects\LastDamageTexture.rvmat",
				"SIG_general\effects\LastDamageTexture.rvmat",
				"SIG_general\effects\LastDamageTexture_destruct.rvmat"
			};
		};
	............
	............

With above complete for ever texture, this should now mean that you will see damage on your vehicle.

EXCLUSION - GLASS - PENDING being written
- Glass needs extra work, I will describe one way to get “broken glass” effect

NEXT - Animation - PENDING being written

….. if I didn't forget something;

Example Finished Product

members.iinet.net.au_nrspence_arma_damagetut_dt_6.jpg

Final Note:
No doubt some of above is simply a “Parrot copy” and can in reality be changed and IT WILL STILL WORK, but without spending hours upon hours finding out what bits can be changed or altered slightly I have simple written down what works for me. If you find working variations PLEASE let us all know.
Cheers
Gnat