|It is currently Mon Oct 19, 2009 5:30 pm
All times are UTC - 6 hours [ DST ]
Prepping Your Files
True Testing Enviroment
Stop Base Camping
Removing Out Of Bounds
Stop Base Camping 2
Add Repair Points
Add Spawn Points
Main Base Swapping
Modifying the Point System
Conquest Ticket System
Making CTF Versions of Maps
Partially Disabling Vehicles
Totally Disabling Vehicles
Making a Carbomb
Adding Healing Supply
Adding/Changing/Removing Carrier Vehicles
Spawn Weapon Kits
Change the Weapon Kits of Soldiers
Modifying Weapon Attributes
Modifying the Damage System
|Fix Wall Hacks
How to Fix Wall/Floor Hacks
Al Khafji Docks
Leaning F16 Fix
Oil Fields Exploding A-10
Operation Bragg Fixes
Weapon Kits List
Global Object Spawners
Global Soldier Spawns
Projectile Material Numbers
Modifying the Damage System
This tutorial is divided into four sections.
1) The first section shows how to modify the damage of the stinger by changing the material number of the projectile, while at the same time trying to get the reader to understand the damage system in the process.
2) The second section shows how to make the same modification, but by creating a new material number server side only.
3) The third section explains the damage system in more detail and also discusses how to change the damage of a material against a specific topic.
4) The fourth section shows how to change a single weapon's damage against a target (even if other weapons use the same material number).
1) Changing a Projectile's Material NumberI've been reading about the damage system in BF, and thought I'd try screwing around with the stinger. My goal was to make the stinger more powerfull, but do it server side only.
If you look at the objects.rfa file for DC, and look at OBJECTS\handweapons\Stinger\Objects.rfa, you'll see the definition of the stinger. go down till you see the line that says:
every hand weapon should have a line like this. it tells you what the projectile is for the weapon. now for the stinger, it's projectile is defined in OBJECTS\handweapons\StingerMissile\Weapons.con. but for most other weapons (like machine guns, etc), you can find their projectile info in OBJECTS\handweapons\common\weapons.con
so looking at OBJECTS\handweapons\StingerMissile\Weapons.con, you'll see the projectile info for StingerMissile. the lines we are concerned about are the ones that say:
these numbers define the material of the projectile. basically, the BF server uses this number to find an entry in the game.rfa (bf1942\game\materialManagerdefine.con), which is the base damage that material causes. if you looked up 850, you'll see the stinger:
but stop here. we don't care about this for now, We will pick up here in the next section. what we are going to do right now is just flat out change the material of the stinger. i thought the SMAW material would be cool.
If you look up the material for the SMAW, you'll see it is:
by the way, the material2 is used for splash damage, whereas material is just direct damage.
so lets do it! I'll use lost village as an example. open up your ObjectSpawnTemplates.con file, and add these lines at the end of the file:
Now try firing a stinger missile. it still looks like a stinger, acts like a stinger, but now it does nasty splash damage, and can drop a blackhawk in one shot. of course, it'll probly take out a humvee in one shot too.. dunno didn't test it.
2) Creating a new Material NumberNow if you didn't want to change the material # of the stinger, you could have instead just increased the materialDamage of the stinger material. This could either be done in the game.rfa itself, or on a per map basis.
To do it on a per map basis, what we'll do is create a brand new material number, and use the existing stinger attGroup and defGroup, but increase the materialDamage.
First, we need to find a material number that isn't already being used. After doing a search in the game.rfa, i discovered that material number 851 is not being used for anything. Using 851 as our new material number, the following code at the end of your ObjectSpawnTemplates.con file would increase the stinger's materialDamage to 30:
Notice we ObjectTemplate.Active the StingerMissile Projectile, and change it's material and material2 to our new material number (851). Then we define 851 to be just like 850, except that increase the materialDamage to 30.
3) Modifying the Damage a weapon does to a specific targetOK, we saw how to modify a parameter that affects how overall powerful a weapon is, but what if we want to modify the damage a weapon does to a specific target?
For that, lets look at the damage system a little deeper.
First off, the basic formula for computing damage in the BF engine is:
Hitpoints = MaterialDamage * DamageMod * AngleFalloff * DistanceMod
Lets walk through these:
What this means is that if your within 40 meters, the DistanceMod will be 1. if you are further than 80 meters, then the DistanceMod will be .5. If you are between 40 to 80 meters, the DistanceMod is determined by this formula:
DistanceMod = minDamage + (1-minDamage) * (distToMinDamage - distance) / (distToMinDamage - distToStartLoseDamage)
You could probably use an ObjectTemplate.Active in your map RFA's to reopen the projectile in question and change these. I havn't tried it so I'll leave it as an excersice to the reader.
As an example, we're going to increase the amount of damage the stinger does to infantry.
First, we find the Stinger's projectile template in the objects.rfa:OBJECTS\handweapons\Stinger\Objects.rfa. It is:
looking at objects.rfa:OBJECTS\handweapons\StingerMissile\Weapons.con, we get the material of the Stinger:
Remember, material is direct damage, and material2 is for splash damage.
Now open up the game.rfa:bf1942\game\materialManagerdefine.con, and look down till you see the stinger material 850 lines:
We could increase the materialDamage for the stinger to make it more powerful as described in the previous section, however, this would affect all targets. We only want to increase the damage to infantry. Which is what DamageMod is going to do for us.
Staying in the game.rfa, open up bf1942\Game\damage_system\StingerMissile.con
The first three lines are the damage the stinger does to infantry:
40 is head, 41 is trunk, 42 is limbs. Notice the damageMod of .1! WTF??? A stinger is a missile, and if it hits you, it's gonna freekin hurt. Lets fix this.
Lets change it to 1 instead of .1. Lets rem out the original lines and add the new code. So now we have:
Now that knocks off about a bar and a half. Good enough for me. Tweak it to your liking.
The rest of the file defines the damage done to other materials. Materials for models are defined in 3dmax when the model is made. Check the reference section of this site for a list of materials and where they are used.
4) Changing specific target damamge on a per map basisSometimes, more than one weapon uses the same material number. Therefore, adjusting the values in the previous section would affect all projectiles that use that material number.
What if you only wanted to change the damage a certain projectile does against a target, but do not want to affect the damage other projectiles do that might be using that same material number?
Using the method described in Section 2 above, this can be accompished. This can either be done in the game.rfa (which would affect all maps), or on a per map basis.
Lets say we want to adjust the splash damage done by a SMAW or RPG against infantry (we're going to decrease it). Checking the game.rfa, 852 is not being used by any material, so we're going to use that as our new material for SMAW/RPG splash.
We'll put this in our ObjectSpawnTemplates.con of our map rfa (or we can put it in the game.rfa, in bf1942\game\materialManagerdefine.con).
Now, if you look at the objects.con for the RPG or SMAW, you'll see the material used for splash (material2) is 707. Unfortunately, this is the same material grenades use for splash as well, and we don't want to affect grenades, just SMAWs and RPGs.
We can either change this 707 here to be 852 (which would affect all maps), or we can put the following code at the end of our ObjectSpawnTemplates.con:
The only thing left to do now is to define material 852 in its entirety. What we'll do is copy and paste all the settings for material 707, and change all the 707s to be 852s. This can either be done in the game.rfa, at the end of an existing file under damage_system\, or at the end of ObjectSpawnTemplates.con.
The result would look like this (the infantry lines that were changed are in bold):