Tweak Files -Damage component help

Making or wanting help making your own asset? Check in here
Post Reply
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Tweak Files -Damage component help

Post by UTurista »

Hi all,

I've in mind a creation of a small app capable of giving all stats about the game, meaning all recoil values, damage charts and everything associated.

When reading the tweak files I can basically understand the ammo, recoil, deviation and zoom component but the damage component it's still to uncertain for me, meaning, I can't really understand how can the same projectile damage differently to certain parts of Objects (vehicle or person).

To be more precise I would like to know:
  • How does the link between Weapon.tweak -> Projectile.tweak works?
  • How can we know the damage made by each projectile for each body part?
  • All vehicles have different armor values (sides, front, back) how can we find out these values?
  • With explosions, how can we calculate the explosion Radius Vs Damage?
Seeing this would be for the creation of a app, using BF2 editor is not an answer. I assume all of this information is in the Tweak and Con files.

Thanks in advance,
U_Turista
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Moszeusz6Pl
Retired PR Developer
Posts: 939
Joined: 2010-06-24 13:41

Re: Tweak Files -Damage component help

Post by Moszeusz6Pl »

Each weapon have line ObjectTemplate.projectileTemplate whic is defining which projectile is used. To calculate damage get damage of weapon, material(ID) of projectile and material(ID) of armor, check it modifier from common/materials/materialmanagersettings.con and multiple damage by such value. Materials are defined by ObjectTemplate.mapMaterial 0 metal_solid 3032. So mat 0 is using metal_solid material with ID 3032. To check which part have which ID open collision mesh with meshviwewer. As for explosion damage, is probably calculated linear, but it's only a guess.

Image
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

So using a us_tnk_m1a2 Vs a second us_tnk_m1a2:

we have in the us_tnk_m1a2.tweak:

Code: Select all

(...)
ObjectTemplate.armor.maxHitPoints 1700
ObjectTemplate.armor.hitPoints 1700
(...)
ObjectTemplate.setCollisionMesh us_tnk_m1a2
ObjectTemplate.mapMaterial 0 Tank_tracks 182
ObjectTemplate.mapMaterial 1 Armor_5_tank_front 30
ObjectTemplate.mapMaterial 2 Armor_4_tank_sides 29
(...)
ObjectTemplate.projectileTemplate us_tnk_m1a2_Barrel_Projectile
(...)
ObjectTemplate.create GenericProjectile us_tnk_m1a2_Barrel_Projectile
(...)
ObjectTemplate.createComponent DefaultDetonationComp
ObjectTemplate.detonation.explosionMaterial 3720
ObjectTemplate.detonation.explosionRadius 6
ObjectTemplate.detonation.explosionForce 6
ObjectTemplate.detonation.explosionDamage 100
(...)
and in the materials manager

Code: Select all

(...)
MaterialManager.createCell 3720 29
MaterialManager.damageMod 0.6
MaterialManager.setEffectTemplate 0 e_exp_medium2_distant_sound
MaterialManager.setEffectTemplate 0 e_mExp_m_armor
MaterialManager.setEffectTemplate 1 e_bhit_tankshell_ricochet
MaterialManager.setSoundTemplate 0 S_Tank_Shell_Metal
(...)
The value by hitting the tank in the side should be:

Code: Select all

HitPoints = DamageWeapon * DamageMod
DamageMod = 0.6
DamageWeapon = 100
Hitpoints = 60
But it can't be; a side hit is something around 820Hp, so I'm doing something wrong.
Last edited by UTurista on 2013-10-26 12:45, edited 1 time in total.
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Moszeusz6Pl
Retired PR Developer
Posts: 939
Joined: 2010-06-24 13:41

Re: Tweak Files -Damage component help

Post by Moszeusz6Pl »

You are doing it right, but for explosion damage. There is also second damage and material for projectile impact.

Image
Fastjack
PR:BF2 Contributor
Posts: 525
Joined: 2011-09-04 19:47

Re: Tweak Files -Damage component help

Post by Fastjack »

Code: Select all

ObjectTemplate.create GenericProjectile us_tnk_m1a2_Barrel_Projectile
ObjectTemplate.modifiedByUser "J.F.Leusch69"
ObjectTemplate.createNotInGrid 1
ObjectTemplate.createdInEditor 1
rem ---BeginComp :D efaultCollisionComp ---
ObjectTemplate.createComponent DefaultCollisionComp
rem ---EndComp ---
rem ---BeginComp :D efaultDetonationComp ---
ObjectTemplate.createComponent DefaultDetonationComp
ObjectTemplate.detonation.explosionMaterial 3720
ObjectTemplate.detonation.explosionRadius 6
ObjectTemplate.detonation.explosionForce 6
[color=Blue]ObjectTemplate.detonation.explosionDamage 100[/color]
ObjectTemplate.detonation.endEffectTemplate e_exp_medium
ObjectTemplate.detonation.useMMOnEndEffect 1
ObjectTemplate.detonation.detectionRadius 0
ObjectTemplate.detonation.useCollisionNormal 0
ObjectTemplate.detonation.maxDepthForExplosion 2
rem ---EndComp ---
rem ---BeginComp :D efaultProjSoundComp ---
ObjectTemplate.createComponent DefaultProjSoundComp
rem ---EndComp ---
rem ---BeginComp :D efaultPenetrateComp ---
ObjectTemplate.createComponent DefaultPenetrateComp
ObjectTemplate.penetrate.allowSolidPenetration 0
ObjectTemplate.penetrate.allowLiquidPenetration 0
rem ---EndComp ---
ObjectTemplate.gravityModifier 0.01
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Point
ObjectTemplate.collisionGroups 8
ObjectTemplate.material 3720
rem -------------------------------------
ObjectTemplate.addTemplate S_us_tnk_m1a2_Barrel_Projectile_Looping
rem -------------------------------------
ObjectTemplate.timeToLive CRD_NONE/6/0/0
ObjectTemplate.material 3720
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.tracerScaler 8
ObjectTemplate.maxTracerScaler 12
ObjectTemplate.minTracerScaler 1
ObjectTemplate.tracerSizeModifier 1.8
ObjectTemplate.tracerTemplate p_tracer_tank
ObjectTemplate.tracerConvergeDistance -1
ObjectTemplate.minDamage 1
[color=Blue]ObjectTemplate.damage 1200[/color]
Look here:

Code: Select all

ObjectTemplate.detonation.explosionDamage 100

Code: Select all

ObjectTemplate.damage 1200
Calculated damage = 780


The AP tank projectile have two damage sources.
Onetime the Direct hit damage and second the explosion damage.
Don't forget the tank have 2 different projectiles (AP/HE)

Edit: Ninja'd by Moszeusz
Forgot to say that's the tweaks from 0.98
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

So I would need to keep the parser and check the damage values not associated with explosion component?

Code: Select all

(...)
ObjectTemplate.detonation.explosionDamage 100
(...)
ObjectTemplate.material 3720
(...)
ObjectTemplate.minDamage 1
ObjectTemplate.damage 1200
(...)
And now we get the damage by the impact and not by the explosion?

And the updated HP would be

Code: Select all

HitPoints = HpByImpact + HpByExplosion

HpByExplosion = 60 //Calculated previously

HpByImpact = DamageWeapon * DamageMod

DamageMod = 0.6
DamageWeapon = 1200

HpByImpact  = 720


HitPoints = 720+60 = 780Hp
Still not the ~820Hp, I'm still missing something.

And how come in BF 1942 the angle of impact does change the HP but not in BF2, according to the Documentation?

edit: ninja'd
Last edited by UTurista on 2013-10-26 14:24, edited 2 times in total.
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Fastjack
PR:BF2 Contributor
Posts: 525
Joined: 2011-09-04 19:47

Re: Tweak Files -Damage component help

Post by Fastjack »

Still not the ~820Hp, I'm still missing something.
Your explosion has a radius of 6.
Maybe the 100HP explosion damage affected also the tracks.

Edit: tank tracks

Code: Select all

MaterialManager.createCell 3720 86
MaterialManager.damageMod 0.4
Additional tank track damage is 40 HP. That's your final 820 HP Damage.
Last edited by Fastjack on 2013-10-26 15:20, edited 2 times in total.
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

Fastjack wrote:Your explosion has a radius of 6.
Maybe the 100HP explosion damage affected also the tracks.
In theory makes sense but if can hit 2 collision meshes, side and tracks, then it should also hit the rear or top which it doesn't.
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Fastjack
PR:BF2 Contributor
Posts: 525
Joined: 2011-09-04 19:47

Re: Tweak Files -Damage component help

Post by Fastjack »

See above. I updated my post.

You can test it. Change the explosionradius to something like 0.1 and make a direct side hit and check the damage.
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

Fastjack wrote:See above. I updated my post.

You can test it. Change the explosionradius to something like 0.1 and make a direct side hit and check the damage.
Tested and if the radius is set to 0.1 the damage is exactly 720Hp like predicted. But what stops it to make damage on the other collision meshes?

Image

For test purposes I'm always hitting in the same zone, marked. And there, at 1st sight, the Mat1 is closer than Mat0, so why is the Mat0, aka tracks, affected but not the Mat1?
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Fastjack
PR:BF2 Contributor
Posts: 525
Joined: 2011-09-04 19:47

Re: Tweak Files -Damage component help

Post by Fastjack »

Tested and if the radius is set to 0.1 the damage is exactly 720Hp
720? Woot?! I predicted something like 780 damage. Type error or really 720 or you changed the explosion damage?
If it is 720 and you changed only the radius, than it seems like you make no explosion damage.
M42 Zwilling
Retired PR Developer
Posts: 613
Joined: 2012-06-10 11:27

Re: Tweak Files -Damage component help

Post by M42 Zwilling »

Explosion damage doesn't get applied to whatever materials are on the collision mesh. It gets applied to the material set by ObjectTemplate.armor.defaultMaterial in the armor comp.
Image


"How many posts have there been about how much better PR was back in 0.X? The fact is that if we played the older versions we would start to remember the shortcomings, but we tend to hold onto the good memories tighter than the bad ones." - Murphy
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Tweak Files -Damage component help

Post by Rhino »

[R-CON]M42 Zwilling wrote:Explosion damage doesn't get applied to whatever materials are on the collision mesh. It gets applied to the material set by ObjectTemplate.armor.defaultMaterial in the armor comp.
indeed.
Image
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

Code: Select all

ObjectTemplate.armor.maxHitPoints 1700
ObjectTemplate.armor.hitPoints 1700
ObjectTemplate.armor.defaultMaterial 172
So that means if the default material is 172 and there's no

Code: Select all

MaterialManager.createCell 3720 172
in "materialmanagersettings.con"

The damage by the explosion is +100Hp from the 4? line:

Code: Select all

ObjectTemplate.detonation.explosionMaterial 3720
ObjectTemplate.detonation.explosionRadius 6
ObjectTemplate.detonation.explosionForce 6
ObjectTemplate.detonation.explosionDamage 100
Because the default Modifiers is '1'
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Rhino
Retired PR Developer
Posts: 47909
Joined: 2005-12-13 20:00

Re: Tweak Files -Damage component help

Post by Rhino »

I think if its not defined, its 0 but not 100% sure on that.
Image
UTurista
PR:BF2 Developer
Posts: 985
Joined: 2011-06-14 14:13

Re: Tweak Files -Damage component help

Post by UTurista »

I think it should be 0 but its 1.
That's why the damage is 820Hp (720Hp from impact plus 100 from explosion)

Also tested with a 3rd tank very close to the shell impact and the damage it gets is 94Hp ~100Hp, so it's verified 100Hp comes from explosion.

I assume if I understood this I can understand the rest. Thanks all.

But before I leave anyone knows why the Damage system in BF1942 have the angle of attack in consideration:

Code: Select all

Hitpoints = MaterialDamage * DamageMod * AngleFalloff * DistanceMod
But in BF2 it does not. source link.

Again thanks for the answers.
Image


Dont question the wikipedia! Just because it reports different things on different languages does not make it unreliable source!
Fastjack
PR:BF2 Contributor
Posts: 525
Joined: 2011-09-04 19:47

Re: Tweak Files -Damage component help

Post by Fastjack »

Nice Infos. Good to know how it works at all.
Post Reply

Return to “PR:BF2 Community Modding”