This tutorial intends to teach you how to obtain the brown textures when a tank is damaged. You probably noticed that when a tank is damaged in OFP, it gets more and more brown as it gets more and more damaged.
It's a property to set on the textures in Oxygen. It's also dealing with local damage like the tracks, hull, turret etc...

As an exemple, look at these Tigers :



So this is how it works :

1. Config.cpp

The first thing to do is to have a look at how the armor values are declared in the OFP "Tank" class. If you want to do your own armor, copy/paste it on your own tank class and change the values :

class Tank: LandVehicle
{

...blablabla...

armor=400;
armorStructural=2,000000;

class HitEngine { armor=0,800000; material=60; name="engine"; passThrough=1; };
class HitHull { armor=1; material=50; name="hull"; passThrough=1; };
class HitTurret { armor=0,800000; material=51; name="turet"; passThrough=1; };
class HitGun { armor=0,600000; material=52; name="gun"; passThrough=1; };
class HitLTrack { armor=0,600000; material=53; name="pasL"; passThrough=1; };
class HitRTrack { armor=0,600000; material=54; name="pasP"; passThrough=1; };

armorHull=1;
armorTurret=0,800000;
armorGun=0,600000;
armorEngine=0,800000;
armorLights=0,400000;
armorTracks=0,600000;

...blablabla...

}

The important thing here are the "class Hitblablabla { }" lines. As you can see there is one for each part of the tank. This is how the local damage is handled in the config.cpp. Let's have a look at the parameters :
"armor =" seems to be an armor coefficient. (not very important for this tutorial)
"material =" is the number allocated to each texture to indicate what part of the tank it belongs to.
"name =" is the name of the selection of the "Hit-points" LOD to indicate what part have to be damaged when the selected area is hit.
"passThrough =" is, i think, a boolean to indicate if the area located behind will take damage as well... but i'm not sure at all, i'm just assuming.

2. The "Hit-points" LOD.

Here we start the serious things. If you did your model well, you are supposed to have a LOD names "Hit-points", quite similar to others lods like "Geometry" or "Fire Geometry". I assume you already selected the barel, the turret and all other animated parts, so when the turret moves for exemple, the corresponding "Hit area" will follow (if you see what i mean).

So now select the turret and make a named selection called "turet" :

Now guess what ? yes ! select the gun, and make a named selection called "gun".
Select the Hull and make a named selection called "hull".
Select the left trackand make a named selection called "pasL".
Select the right track and make a named selection called "pasP".
Select the engine hit area and make a named selection called "engine".
These must be the exact same names as in the config.cpp (the "name=" parameter for each class Hitblablabla).

3. Allocating a number to the textures.

You now have to edit all the "display lods" (0.000, 1.000, ..., 15.000) and do the following thing :

select ALL the faces which belongs to the turret for exemple (exept the gun). Make sure you dont forget anything, otherwise you will have one small part which doesnt gets brown when the turret is damaged :



Now click Faces/Faces properties or just press E on your keyboard. you should obtain the following box :



In the "User" field, enter 51. Then press Apply/ok. You will now obtain a brown turret when it will be hit in the game.
You now have to do the same thing with the other parts of the tank. Note that the User number must be the exact same as the "material=" number in the "class Hitblablabla" of the config.cpp.

So you now have to select the gun, and enter 52 in the User field.
Select the hull, and enter 50 in the User field.
Select the left track, and enter 53 in the User field.
Select the right track, and enter 54 in the User field.
If you have the engine showing, select it and enter 60 in the User field.

You now have to do the same for every display lods, and make sure EVERY faces in the model is allocated to a part of the tank if you dont want to have one face still bright when the others are black !


back to the news