S  W  A  T   3   M  O  D    H  Q    
DATA FILE INFORMATION - CLOSE WINDOW WHEN FINISHED

Guns.dat

Function

To provide firearm related data such as recoil, rate of fire, sound and ammunition linkage.

Format

The guns.dat file contains tabulated data in this format:

type Weapon reference name.
length 36 for longguns, 10 for pistols.

grip

Grip style to use, leave at "1".

fire delay

Delay between shots, in seconds.

recoil

Recoil angle of the weapon, in degrees.

primary sound

Sound effect to play on primary ammo gunshot.

secondary sound Sound effect to play on secondary ammo gunshot.

flash A

Muzzle flash starburst sprite. Usually gun_flashA.

flash B

Muzzle flash flame sprite. Usually gun_flashB.

Primary/Secondary Ammo

Special data format, explained below.

out-of-ammo click Sound file to play when the gun is dry-fired.
rounds per burst Number of rounds fired per burst; this helps AI judge how many rounds to shoot per firing cycle.
class 0 = Pistol, 1 = Gun with Magazine, 2 = Gun without Magazine
boundradius This is used to determine the size of the gun's bounding cylinder when dropped on the ground, so that it doesn't poke through walls or objects. The larger the weapon is physically, the larger this number should be.
renderoffset This is a three-dimensional vector in the form (X,Y,Z) that can adjust the gun's position in the hands of it's operator. Play with this setting if the gun doesn't appear to seat right in the hands of the user.
muzzlevelmul A decimal multiplier for the gun ammunition muzzle velocity. To scale the velocity up, use a number greater than 1. To scale it down, use a number less than 1.
suppressed Whether or not the weapon is suppressed, 1 = Suppressed, 0 = Not Suppressed.
zoomfactor A decimal multiplier for the zoom factor of the weapon when activated. Set higher than 1 to give a weapon zoom capability.
soundmul A decimal multiplier for the weapons sound volume when fired. To scale the volume down, use a number less than 1. To scale up, use a number greater than 1.
muzzleflashmul A decimal multiplier for the weapons muzzle flash sprite when fired. To increase the size of this sprite, use a number greater than 1. To decrease, use a number less than 1.
flashlight Set to 1 if the weapon has a flashlight attached to it. Set to 0 if this weapon has no flashlight. If you enter a 1, the weapon must have the appropriate flashlight textures on the model! See the Characters\Weapons section for details.
linktochest If you wish this gun to link to the character's chest who owns it when this gun is deselected, enter 1. If you wish the gun to disappear (which happens when a pistol is holstered), select 0.
swatguysel If you wish SWAT to be able to select this weapon, enter 1.
friendlyname This is the reference to an entry in strings.dat. It must end with _name. The description for this weapon is automatically <weaponname>_desc. For instance, if you had a weapon named USP, the description string entry would be named USP_desc.

Primary/Secondary Ammo Format

This field is a parenthesized, comma-separated entry that differs based on the type of ammunition loading procedure the weapon has.

If the weapon is magazine fed (i.e. MP5):

(ammo type, max magazines, max rounds per magazine)

If the weapon is not magazine fed (i.e. Benelli Shotgun):

(ammo type, max rounds in gun, max rounds)

 

1.7 Update: Primary/Secondary Fire Rates

Assume for a moment you wished to create an M4 Masterkey system; an M4 carbine with a shotgun mounted underneath the barrel. Intuitively, you'd say that the primary ammo was a standard .223, and the secondary ammo was buckshot from the underslung shotgun. But, how would you get them to fire at different rates? After all, the shotgun doesn't fire nearly as fast as the M4 itself.

With the update to 1.7, the data file system expanded to allow this sort of representation of primary and secondary fire rates, each unique from the other. To access this functionality, lets have another look at the Primary/Secondary ammo format. It was broken down this way before:

(

Ammo Type,

Max Magazines,

Max Rounds Per Magazine

)

ex.

(

9mmHP,

10,

30

)

(

9mmFMJ,

10,

30

)

 

Note that this way still works, if you wish to keep the primary and secondary fire rates locked; they'll just use the value stored in the "fire delay" field.

But the new way allows unique values for primary and secondary ammo, and requires only one extra value. Here's what it looks like:

(

Ammo Type,

Max Magazines,

Max Rounds Per Magazine,

Fire Delay

)

ex.

(

.223FMJ,

10,

30,

0.1)

(

_throw_grenade,

8,

1,

0.6)

Though it may appear that there are spaces in this example, NO SPACES ARE ALLOWED WITHIN THE PARENTHESES.

And that's all! Now the .223 FMJ ammo will fire every 0.1 seconds, and the grenade ammo will fire every 0.6 seconds.

 

1.7 Update: Flashlights and Laser Sights

Beginning with 1.7, flashlight capabilities have been expanded to allow colored flashlights and sprites to be displayed at the flashlight's point of impact.

Previously, the "flashlight" field could be set to 0 to indicate that the weapon has no flashlight, and 1 to indicate the weapon does have a flashlight. Now, a special parenthesized format may be used in place of the standard 1 or 0:

SPACES ARE NOT ALLOWED WITHIN THE PARENTHESES.

(

Color_red,

Color_green,

Color_blue,

Min_size, Max_size, sprite, corona

)

An explanation of each of the fields:

Color_red The red component of the flashlight color. Ranges from 0 to 1.
Color_green The green component of the flashlight color. Ranges from 0 to 1.
Color_blue The blue component of the flashlight color. Ranges from 0 to 1.
Min_size Radius of the light beam in inches at 15 feet or closer.
Max_size Radius of the light beam in inches at 360 feet or further. Between min_size and max_size, the radius of the light beam will be scaled automatically.
sprite A sprite (from sprites.dat) to display in the center of the beam where the flashlight light lands. May be 0 to specify no sprite.
corona A sprite (from sprites.dat) to display at the flashlight itself as a light corona effect.

And, in closing, an example of a laser sight:

(

1.0,

0,

0,

5, 0.2, lasSight, lasFlash

)

The flashlight color is set to pure red, and the beam is set extremely tight. The sprite on the end is one called "lasSight" (not included), and the corona is one called "lasFlash" (not included).  This would produce, depending on the lasSight sprite, a visible sprite at the light's target, combined with a slight, narrow red illumination.