How to Modify Weapon Attributes

We know how to modify weapon damage (see Modifying the Damage System, but what about tweaking a weapons performance.

Lets play with the VSS.

These settings were all made at the end of the ObjectSpawnTemplates.con file on Al Khafji Docks. The foot prints were observed from shooting at one of those fule drums from a distance of about 20 game meters.

Basics
Recoil
Deviance
Semi vs. Fully Automatic
Gravity

Basics

ObjectTemplate.Active VSS
ObjectTemplate.magSize 10
ObjectTemplate.numOfMag 9

magSize is the number of bullets in a magazine. numOfMag is the number of magazines that can be carried (including the one in the weapon). Changing these values has no effect. Setting them to 0 will cause sporadic crashes.

ObjectTemplate.Active VSS
ObjectTemplate.reloadtime 10

reloadtime is the time in seconds it takes to put in a new magazine. Increasing this number has no effect. but decreasing it will cause a reload to occur quicker (the graphic speed won't change, but if you hold the trigger, the graphic will stop the reload process and start firing).

ObjectTemplate.Active VSS
ObjectTemplate.roundOfFire 10

This is how many bullets per second a fully automatic weapon fires. Increasing this number works. Decreasing it causes some strange client/server bug where you seem to get free bullets (alot more bullets). You'll hafto try it to see. Set it to 1 for example.

ObjectTemplate.Active VSS
ObjectTemplate.zoomFov 0.5

This sets the zoom ratio when you right click/zoom. It is set to .1 for snipers (x10 zoom), .5 for rifles (x2 zoom) and .8 for pistols. Changing it doesn't change the graphic (you still zoom at the original value) but when you move the mouse, the move is jerky, like the client and server are fighting on how to move but at conflicting zoom levels. Once again, try it to see what I mean (try .1)

RECOIL

These settings deal with recoil. After a sustained burst of fire, the gun will move in a certain direction based on these settings.

ObjectTemplate.Active VSS
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/0.28/0.32/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/-0.2/0.2/0
ObjectTemplate.setGoBackOnRecoil 0

When setHasRecoilForce is set to 1, then the weapon will recoil. setRecoilForceUp and setRecoilForceLeftRight determine which direciton, and by how much this move will be. The arguments work like this:

- CRD_UNIFORM means a uniform distribution between the next two numbers (in this case .28 degrees and .32 degrees). - 0.28 - the minimum of the uniform distribution (in degrees) - 0.32 - the maximum of the uniform distribution (in degrees) - 0 - this number is either a 0 or 1. if 0, then only positive numbers are returned. If 1, then the number between .28 and .32 has a 50/50 chance of being negative.

Some examples:

rem *** same thing as setting setHasRecoilForce to 0
ObjectTemplate.Active VSS
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/0/0/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/0/0/0

You will notice there is still a little randomness to the bullet pattern even when the recoil effect is turned off. This is due to something else which will be covered in the next section.

rem *** After Each Burst, the weapon will have moved in a certain
rem *** direction (up/down, or left/right) no more than +/- 5 degrees.
ObjectTemplate.Active VSS
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/-5/5/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/-5/5/0

in that second example, during the burst, you will move in the randomly chosen direction. The next burst will be in a random other direction. This is what that CRD_UNIFORM means.

ObjectTemplate.Active VSS
ObjectTemplate.setHasRecoilForce 1
ObjectTemplate.setRecoilForceUp CRD_UNIFORM/0.1/0.2/0
ObjectTemplate.setRecoilForceLeftRight CRD_UNIFORM/-0.2/0.2/0
ObjectTemplate.setGoBackOnRecoil 0

This will cause the recoil to go up only, but a lot slower than the original setting (now we're randomly going to move the angle up a number between 0.1 and 0.2 degrees. but since these number differ by .1 (instead of .04) our slow climb will vary from burst to burst (overall low recoil, but a bit unpredictable).

Other options besides CRD_UNIFORM are: CRD_NONE, CRD_EXPONENTIAL, and CRD_NORMAL. Further reading can be done here on these (I didn't try them so I don't know if they will work or not): http://www.planetbattlefield.com/mdt/scripting/CRD.shtm

The last setting, setGoBackOnRecoil, if set to 1, will return the weapon back to its starting point after firing the burst. 0 means the weapon will stay where it is after the effects of recoil. You will notice that if you are standing, and you set this to 0, and setHasRecoilForce is 1 that the gun may not return back to it's origin (it comes close though). This is due to the fact your standing and will be covered later.

These 4 settings can be controlled server side only.

DEVIANCE

ObjectTemplate.Active VSS
ObjectTemplate.setFireDev 2.5 0.275 0.08
ObjectTemplate.setDevMod 1 0.75 0.65
ObjectTemplate.setTurnDev 1.5 0.1 0.1 0.1
ObjectTemplate.setSpeedDev 2 0.175 0.175 0.1
ObjectTemplate.setMiscDev 3 2.5 0.1

setFireDev is why short controlled bursts are more accurate than long sustanined busts. The 3 arguments (x, y, and z) mean:

 

setDevMod is deviation based on your stance while firing:

 

setTurnDev is deviance based on moving your mouse while firing

 

setSpeedDev is deviance based on wether you turning while firing.

 

setMiscDev is deviance based on wether your jumping while firing

 

I couldn't detect any perceptable difference when changing any of these. But maybe I dont understand the arguments very well. Further reading can be found here: http://www.planetbattlefield.com/mdt/scripting/ObjectTemplate/Properties/SetFireDev.shtm. From this page, you'll see links to the other deviation settings.

SEMI vs. FULLY AUTOMATIC

ObjectTemplate.fireOnce 0

Defaults to 0, and sets wether holding down the left mouse button will continue to fire or not. Changing this on either pistols or rifles had no effect server side only.

Gravity

Projectiles like the RPG/SMAW, or T-72/M1 tank shell have some other modifiers associated with them. The following code:

ObjectTemplate.Active RPGProjectile
ObjectTemplate.gravityModifier 0

Would make the RPG projectile go straight like a stinger. Normally, it is set to .4. Adjusting this gravityModifier will affect how much the projectile lobs.