Jump to content
Official BF Editor Forums
Sign in to follow this  
PiratePlunder

Which Material Is Used For Vehicle Damage

Recommended Posts

This is a very noobish question, in my defence I'm tweaking away without being able to run bf2 from this machine, so I can't even check in game.

Excuses out of the way, which material gets used when calculating projectile damage for vehicles?

As an example, we have a boat in the pirates mod.

ObjectTemplate.armor.hitPoints 1200

ObjectTemplate.armor.defaultMaterial 72

...

ObjectTemplate.mapMaterial 0 Wood 1021

ObjectTemplate.mapMaterial 1 Metal 21

ObjectTemplate.mapMaterial 2 Deck 1022

ObjectTemplate.mapMaterial 3 Wreck 60

ObjectTemplate.mapMaterial 4 Wreck_Sail 60

ObjectTemplate.mapMaterial 5 Default 1021

We then have a cannon projectile with material 122. If that projectile hits the col mesh on the wood material (1021) which of the materials is used to calculate the damage? The armour material or the col mesh material?

Logic suggests to me it should be the armour material (especially as the hitpoints are within the armour component as well) but I don't know. I know 1/2hawk thought it was the colmesh material which is why he bothered to set up different damage modifiers for different projectiles hitting different parts of the ship - i.e. chainshot does more damage to masts than roundshot. I could have sworn that we tested this in game and it worked, but now I'm not so sure. If it does work like this then what is the armour material for?

Only other thing i can think is that both values are used, the armour acting like an additional layer of strength or weakness. Therefore a damagemod value of 1 would effectively ignore the armour.

for information:

Looking at the materialmanagersettings.con

We don't have a cell for 122 72, so presumably it defaults to 1.

MaterialManager.createCell 122 1021

MaterialManager.damageMod 0.75

Edited by PiratePlunder

Share this post


Link to post
Share on other sites

If I remember correctly you can ignore the default material and just consider the projectile/explosion material and the vehicle (i.e. colmesh) materials. When there are no modifiers specified the game will use the projectile vs. Default modifier.

I can't tell whether the Default material is defined by its name or its index; but I think looking for "MaterialManager.createCell 122 0" will be the same as the 122 72 cell.

Share this post


Link to post
Share on other sites

For damage calculations we need to know the damage of the initiator ( projectile ) and the damage mod for the initiator-target cell. When looking up material 112 we find it is "Destroyable_object_huge" and from its settings its more used for an end effect than for a projectile material. A material of 44 ( shell_artillery ) is probably a better choice. Ok, now lets calculate a damage against material 1021, assuming a damage of exactly 100 for the shell. Ow, the material of the col0 is used for calculating damage. Now the cell '44 1021' is not set thats a damageMod of 1 . The projectile will thus subtract exactly 100 points from the target. If the damageMod would be set to 0.75 we'd loose 75 hitpoints.

Note that if you have an Explosion Component the damage from it will add up to the impact damage from the above calculation.

Here's a hint for checking all this ingame: You have to run the debugger and enter 'renderer.drawObjectNames 1' into the console. The debugger will now show the hitpoints for all destroyable objects including PCO's. Fire away and watch the hitpoints go down. ( Btw, i have trouble running BFP2 in the debugger but thats another story ) .

Edited by mschoeldgen[Xww2]

Share this post


Link to post
Share on other sites

Ok, so it uses the col0 mapmaterial to determine the damagemod. Thanks for clearing that up for me.

So out of interest whats the defaultmaterial in the armour component used for? Or is it just some legacy redundant thing?

Share this post


Link to post
Share on other sites

Also note that ObjectTemplate.material is the one it will use for explosions. If you set it to something with a damageMod of 0, then your vehicle will be impervious to explosions.

Share this post


Link to post
Share on other sites
Also note that ObjectTemplate.material is the one it will use for explosions. If you set it to something with a damageMod of 0, then your vehicle will be impervious to explosions.

Ah yes, I just tested it in the editor. Defaultmaterial is used for explosions (though the editor doesn't even bother logging the explosion damage). That should explain why the defaultmaterial name of vanilla objects always contains "blast". :)

Share this post


Link to post
Share on other sites

Thats right. The material 112 (destroyably huge object ) from PP's above example is one of the materials typically used for this armor component 'material' property .

Edited by mschoeldgen[Xww2]

Share this post


Link to post
Share on other sites
Guess that also stops the same explosion hitting more than one material on the same object.

It's a bit weird though that in vanilla you can survive a grenade explosion by sticking your head in a wall.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×