Changing the Damage a Weapon Does to the Player
by David Hutchison · in Torque 3D Professional · 07/27/2012 (6:44 pm) · 3 replies
I have read through the FPS tutorial and searched the website, but I can't seem to find any instructions on how to change the damage level that a stock weapon does to a player when they are hit. I would like to make the pistol more lethal. Thanks in advance for any help.
#2
The handgun AKA Ryder uses the same bullet datablock as the Lurker. Go to the Lurker.cs script found in the art/datablocks section of your project and find the line: datablock ProjectileData( BulletProjectile ) in this datablock there is a perimeter for ProjectileData called directDamage which is set to the damage it deals every hit.
Now look in the Ryder.cs (handgun) file and find the line: datablock ShapeBaseImageData(RyderWeaponImage)and look for the lineitem called:
projectile = BulletProjectile;. You can see that it is using the Lurker's bullet info.
So you need to make the Ryder have its own ProjectileData datablock instead, and then you can change the directDamage to what you want. If you just change it in the Lurker.cs file it will be the new damage for both weapons.
Hope this helps -- let me know if you have any questions.
07/27/2012 (7:46 pm)
Hey David,The handgun AKA Ryder uses the same bullet datablock as the Lurker. Go to the Lurker.cs script found in the art/datablocks section of your project and find the line: datablock ProjectileData( BulletProjectile ) in this datablock there is a perimeter for ProjectileData called directDamage which is set to the damage it deals every hit.
Now look in the Ryder.cs (handgun) file and find the line: datablock ShapeBaseImageData(RyderWeaponImage)and look for the lineitem called:
projectile = BulletProjectile;. You can see that it is using the Lurker's bullet info.
So you need to make the Ryder have its own ProjectileData datablock instead, and then you can change the directDamage to what you want. If you just change it in the Lurker.cs file it will be the new damage for both weapons.
Hope this helps -- let me know if you have any questions.
#3
07/27/2012 (9:25 pm)
Thanks for the quick replies. This is very helpful and appreciated.
Torque Owner Nathan Martin
TRON 2001 Network
Updated:
My mistake, the Lurker is the submachine gun that you get immediately on spawn and the Ryder is the handgun of which uses the same projectile datablock as the Lurker, so they both do the same amount of damage by default. Here is what you do to get different damage amount just for the Ryder handgun:
Open/edit the game/art/datablocks/weapons/Ryder.cs and paste the following around line 57 or just before the ShapeBaseImageData datablock:
datablock ProjectileData(RyderBulletProjectile : BulletProjectile ) { directDamage = 35; };Now look for the field name projectile within the ShapeBaseImageData datablock and change the value from BulletProjectile to RyderBulletProjectile.
Save the Ryder.cs file and run your game, and now it should do seven times the damage it previously was as we effectively changed the damage from stock 5 to 35. You can change the RyderBulletProjectile's directDamage field to any numerical value you want it to be.
Enjoy! :)