Difference between revisions of "Weapon.dat"

From GTAMods Wiki
Jump to navigation Jump to search
(weapon names)
 
(7 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{file-stub}}
+
{{lowercase}}{{file-stub}}
  
The <code>weapon.dat</code> is a file located in the <code>data/</code> directory of all GTA games. The file contains information about the weapons properties and settings. The weapons themselfes are defined inside the [[default.ide]] file located in the same folder.
+
The '''<code>weapon.dat</code>''' file is located in the <code>.\data</code> directory and contains weapons properties and settings. Weapon models are defined inside the [[default.ide]] file located in the same folder.
  
 
== File format ==
 
== File format ==
 +
The file is in plain text format so it can be opened with any text editor (like [[wikipedia:Microsoft Notepad|Notepad]]). Line comments are indicated by the character <code>#</code> (number sign) and empty lines are allowed. They can be placed anywhere in the file. Each entry takes up one line and follows a specific format detailed below. Data in each entry are separated by any whitespace like <code> </code>&nbsp;(space) and <code> </code>&nbsp;(horizontal tab). The file must contain the text <code>ENDWEAPONDATA</code> in order for the game to stop reading the file.
  
{{Incomplete}}
+
=== GTA III ===
<!-- general information here (like each file gets terminated by the string "ENDWEAPONDATA" -->
+
{|class="wikitable center-col-1 center-col-2" style="width: 100%;"
 +
!style="width: 3em;" |{{Icon|3}}
 +
!style="width: 12em;" |Identifier
 +
!style="width: 6em;" |Type
 +
!Description
 +
|-
 +
|A ||Weapon Name ||string ||The name must be from the list of [[hardcoded]] names ([[#Weapon names|see below]]).
 +
|-
 +
|B ||Fire Type ||string ||Available types include: <code>MELEE</code>, <code>INSTANT_HIT</code>, <code>PROJECTILE</code>, and <code>AREA_EFFECT</code>
 +
|-
 +
|C ||Range ||float ||The range of the bullet in units
 +
|-
 +
|D ||Firing Rate ||integer ||
 +
|-
 +
|E ||Reload ||integer ||The time to reload in milliseconds, constrained by the animation being played
 +
|-
 +
|F ||Amount of Ammunition ||integer ||The number of ammo per clip
 +
|-
 +
|G ||Damage ||integer ||Damage done to damageable objects; damage done to characters are within the range of the value while to others are accurate to the value
 +
|-
 +
|H ||Speed ||float ||
 +
|-
 +
|I ||Radius ||float ||
 +
|-
 +
|J ||Life span ||float ||
 +
|-
 +
|K ||Spread ||float ||
 +
|-
 +
|L,M,N ||Fire Offset Vector ||float[3] ||The x,y,z offset of the gunflash
 +
|-
 +
|O ||Animation to Play ||string ||
 +
|-
 +
|P ||Animation2 to Play ||string ||
 +
|-
 +
|Q ||Animation Loop Start ||float ||Start point of animation to be looped for shooting
 +
|-
 +
|R ||Animation Loop End ||float ||End point of animation to be looped for shooting
 +
|-
 +
|S ||Animation Fire Point ||float ||
 +
|-
 +
|T ||Animation2 Fire Point ||float ||
 +
|-
 +
|U ||Model ID ||integer ||[[IDE]] model of the weapon
 +
|-
 +
|V ||Flags ||integer ||[[#Flags|See below]]
 +
|}
 +
 
 +
==== Weapon names ====
 +
The game contains a hardcoded list of weapon names. This is used to assign a weapon name to a weapon type (Unarmed is type 0, BaseballBat is type 1, etc.).
 +
*Unarmed
 +
*BaseballBat
 +
*Colt45
 +
*Uzi
 +
*Shotgun
 +
*AK47
 +
*M16
 +
*SniperRifle
 +
*RocketLauncher
 +
*FlameThrower
 +
*Molotov
 +
*Grenade
 +
*Detonator
 +
*HeliCannon
 +
 
 +
==== Flags ====
  
=== GTA III and Vice City ===
+
=== Vice City ===
  
 
{{Incomplete}}
 
{{Incomplete}}
  
{|{{Prettytable}} width="100%"
+
{|class="wikitable center-col-1 center-col-2" style="width: 100%;"
! width="56px"| {{Icon|3}} {{Icon|VC}}
+
!style="width: 3em;" |{{Icon|VC}}
! width="150px"| Identifier
+
!style="width: 12em;" |Identifier
! width="100px"| Type
+
!style="width: 6em;" |Type
! Description
+
!Description
 
|-
 
|-
| <center>A</center> || <center>Weapon Name</center> || string ||  
+
|A ||Weapon Name ||string ||The name must be from the list of [[hardcoded]] names ([[#Weapon names 2|see below]]).
 
|-
 
|-
| <center>B</center> || <center>Fire Type</center> || string || Available types include: <code>MELEE</code>, <code>INSTANT_HIT</code>, <code>PROJECTILE</code>, <code>AREA_EFFECT</code>, and <code>CAMERA</code>
+
|B ||Fire Type ||string ||Available types include: <code>MELEE</code>, <code>INSTANT_HIT</code>, <code>PROJECTILE</code>, <code>AREA_EFFECT</code>, and <code>CAMERA</code>
 
|-
 
|-
| <center>C</center> || <center>Range</center> || float || The range of the bullet in units
+
|C ||Range ||float ||The range of the bullet in units
 
|-
 
|-
| <center>D</center> || <center>Firing Rate</center> || integer ||  
+
|D ||Firing Rate ||integer ||
 
|-
 
|-
| <center>E</center> || <center>Reload</center> || integer || The time to reload in milliseconds, constrained by the animation being played
+
|E ||Reload ||integer ||The time to reload in milliseconds, constrained by the animation being played
 
|-
 
|-
| <center>F</center> || <center>Amount of Ammunition</center> || integer || The number of ammo per clip
+
|F ||Amount of Ammunition ||integer ||The number of ammo per clip
 
|-
 
|-
| <center>G</center> || <center>Damage</center> || integer || Damage done to damageable objects; damage done to characters are within the range of the value while to others are accurate to the value
+
|G ||Damage ||integer ||Damage done to damageable objects; damage done to characters are within the range of the value while to others are accurate to the value
 
|-
 
|-
| <center>H</center> || <center>Speed</center> || float ||  
+
|H ||Speed ||float ||
 
|-
 
|-
| <center>I</center> || <center>Radius</center> || float ||  
+
|I ||Radius ||float ||The length of melee weapon
 
|-
 
|-
| <center>J</center> || <center>Life span</center> || float ||  
+
|J ||Life span ||float ||
 
|-
 
|-
| <center>K</center> || <center>Spread</center> || float ||  
+
|K ||Spread ||float ||
 
|-
 
|-
| <center>L,M,N</center> || <center>Fire Offset Vector</center> || float[3] || The x,y,z offset of the gunflash
+
|L,M,N ||Fire Offset Vector ||float[3] ||The x,y,z offset of the gunflash
 
|-
 
|-
| <center>O</center> || <center>Animation to Play</center> || string ||  
+
|O ||Animation to Play ||string ||Animation file in [[gta3.img]]
 
|-
 
|-
| <center>P</center> || <center>Animation Loop Start</center> || float || Start point of animation to be looped for shooting
+
|P ||Animation Loop Start ||float ||Start point of animation to be looped for shooting
 
|-
 
|-
| <center>Q</center> || <center>Animation Loop End</center> || float || End point of animation to be looped for shooting
+
|Q ||Animation Loop End ||float ||End point of animation to be looped for shooting
 
|-
 
|-
| <center>R</center> || <center>Animation Fire Point</center> || float || Point in animation to fire weapon, value has to be between values in columns P and Q
+
|R ||Animation Fire Point ||float ||Point in animation to fire weapon, value has to be between values in columns P and Q
 
|-
 
|-
| <center>S</center> || <center>Animation2 Loop Start</center> || float || Start point of crouching animation to be looped for shooting
+
|S ||Animation2 Loop Start ||float ||Start point of crouching animation to be looped for shooting
 
|-
 
|-
| <center>T</center> || <center>Animation2 Loop End</center> || float || End point of crouching animation to be looped for shooting
+
|T ||Animation2 Loop End ||float ||End point of crouching animation to be looped for shooting
 
|-
 
|-
| <center>U</center> || <center>Animation2 Fire Point</center> || float || Point in crouching animation to fire weapon, value has to be between values in columns S and T
+
|U ||Animation2 Fire Point ||float ||Point in crouching animation to fire weapon, value has to be between values in columns S and T
 
|-
 
|-
| <center>V</center> || <center>Breakout Animation</center> || float ||  
+
|V ||Breakout Animation ||float ||
 
|-
 
|-
| <center>W</center> || <center>Model ID</center> || integer || [[IDE]] model of the weapon
+
|W ||Model ID ||integer ||[[IDE]] model of the weapon
 
|-
 
|-
| <center>X</center> || <center>Model2 ID</center> || integer || IDE model of the weapon attachment, only Minigun model shows an effect
+
|X ||Model2 ID ||integer ||IDE model of the weapon attachment, only Minigun model shows an effect
 
|-
 
|-
| <center>Y</center> || <center>Flags</center> || hex || see below
+
|Y ||Flags ||hex ||[[#Flags 2|See below]]
 
|-
 
|-
| <center>Z</center> || <center>Weapon Slot</center> || integer || 0: Fist<br>1: Melee<br>2: Thrown<br>3: Pistol<br>4: Shotgun<br>5: Submachine gun<br>6: Assault rifle<br>7: Heavy<br>8: Sniper rifle<br>9: Special
+
|Z ||Weapon Slot ||integer ||
 +
*0 = Fist
 +
*1 = Melee
 +
*2 = Thrown
 +
*3 = Pistol
 +
*4 = Shotgun
 +
*5 = Submachine gun
 +
*6 = Assault rifle
 +
*7 = Heavy
 +
*8 = Sniper rifle
 +
*9 = Special
 
|}
 
|}
  
{| {{Prettytable}}
+
==== Weapon names ====
! Byte
+
The game contains a hardcoded list of weapon names. This is used to assign a weapon name to a weapon type (Unarmed is type 0, BrassKnuckle is type 1, etc.).
! Value
+
*Unarmed
! Column Name
+
*BrassKnuckle
! Description
+
*ScrewDriver
 +
*GolfClub
 +
*NightStick
 +
*Knife
 +
*BaseballBat
 +
*Hammer
 +
*Cleaver
 +
*Machete
 +
*Katana
 +
*Chainsaw
 +
*Grenade
 +
*DetonateGrenade
 +
*TearGas
 +
*Molotov
 +
*Rocket
 +
*Colt45
 +
*Python
 +
*Shotgun
 +
*Spas12Shotgun
 +
*StubbyShotgun
 +
*Tec9
 +
*Uzi
 +
*SilencedIngram
 +
*Mp5
 +
*m4
 +
*Ruger
 +
*SniperRifle
 +
*LaserScope
 +
*RocketLauncher
 +
*FlameThrower
 +
*M60
 +
*Minigun
 +
*Detonator
 +
*HeliCannon
 +
*Camera
 +
 
 +
==== Flags ====
 +
{|class="wikitable"
 +
!Byte
 +
!Value
 +
!Column Name
 +
!Description
 
|-
 
|-
| 1
+
|rowspan="4" |1
| 1
+
|1
| USE_GRAVITY
+
|USE_GRAVITY
|  
+
|
 
|-
 
|-
|
+
|2
| 2
+
|SLOWS_DOWN
| SLOWS_DOWN
+
|
|  
 
 
|-
 
|-
|
+
|4
| 4
+
|DISSIPATES
| DISSIPATES
+
|
|  
 
 
|-
 
|-
|
+
|8
| 8
+
|RAND_SPEED
| RAND_SPEED
+
|
|  
 
 
|-
 
|-
| 2
+
|rowspan="4" |2
| 1
+
|1
| EXPANDS
+
|EXPANDS
|  
+
|
 
|-
 
|-
|
+
|2
| 2
+
|EXPLODES
| EXPLODES
+
|
|  
 
 
|-
 
|-
|
+
|4
| 4
+
|CANAIM
| CANAIM
+
|Can auto-aim, "Classic" controls only<br>Small guns only
| Can auto-aim, "Classic" controls only<br>Small guns only
 
 
|-
 
|-
|
+
|8
| 8
+
|CANAIM_WITHARM
| CANAIM_WITHARM
+
|Can run while auto-aiming, "Classic" controls only<br>Small guns only
| Can run while auto-aiming, "Classic" controls only<br>Small guns only
 
 
|-
 
|-
| 3
+
|rowspan="4" |3
| 1
+
|1
| 1ST_PERSON
+
|1ST_PERSON
|  
+
|
 
|-
 
|-
|
+
|2
| 2
+
|HEAVY
| HEAVY
+
|Disables jumping and sprinting
| Disables jumping and sprinting
 
 
|-
 
|-
|
+
|4
| 4
+
|THROW
| THROW
+
|
|  
 
 
|-
 
|-
|
+
|8
| 8
+
|RELOAD_LOOP2START
| RELOAD_LOOP2START
+
|
|  
 
 
|-
 
|-
| 4
+
|rowspan="4" |4
| 1
+
|1
| USE_2ND
+
|USE_2ND
| Will use a second animation after the main one played<br>Recommended for melee weapons only because it looks odd for others
+
|Will use a second animation after the main one played<br>Recommended for melee weapons only because it looks odd for others
 
|-
 
|-
|
+
|2
| 2
+
|GROUND_2ND
| GROUND_2ND
+
|Use a second animation for attacking knocked down pedestrians
|  
 
 
|-
 
|-
|
+
|4
| 4
+
|FINISH_3RD
| FINISH_3RD
+
|Will use a third finishing animation after the second one played, only works when USE_2ND flag is used
| Will use a third finishing animation after the second one played, only works when USE_2ND flag is used
 
 
|-
 
|-
|
+
|8
| 8
+
|RELOAD
| RELOAD
+
|Reload animation will play
| Reload animation will play
 
 
|-
 
|-
| 5
+
|rowspan="4" |5
| 1
+
|1
| FIGHTMODE
+
|FIGHTMODE
| Will go into a fighting stance after attacking, can crash the game if no such animation exists<br>Melee weapons only
+
|Will go into a fighting stance after attacking, can crash the game if no such animation exists<br>Melee weapons only
 
|-
 
|-
|
+
|2
| 2
+
|CROUCHFIRE
| CROUCHFIRE
+
|Allows firing while crouching; for weapons without a crouching animation, character will stand up to attack and crouch back down
| Allows firing while crouching; for weapons without a crouching animation, character will stand up to attack and crouch back down
 
 
|-
 
|-
|
+
|4
| 4
+
|COP3_RD
| COP3_RD
+
|Cops and other law enforcement ([[Ped type]] 6) will use a third animation instead first, can crash the game if no third animation detected
|  
 
 
|-
 
|-
|
+
|8
| 8
+
|GROUND_3RD
| GROUND_3RD
+
|Use a third animation for attacking knocked down pedestrians
|  
 
 
|-
 
|-
| 6
+
|rowspan="2" |6
| 1
+
|1
| PARTIALATTACK
+
|PARTIALATTACK
| Can attack while running for melee weapons<br>Recommended for melee weapons only because it looks odd for others
+
|Can attack while running for melee weapons<br>Recommended for melee weapons only because it looks odd for others
 
|-
 
|-
|
+
|2
| 2
+
|ANIMDETONATE
| ANIMDETONATE
+
|
|  
 
 
|}
 
|}
  
Line 193: Line 293:
 
* <code>$</code> &ndash; Guns
 
* <code>$</code> &ndash; Guns
  
{| {{prettytable}} width="100%" class="collapsible"
+
{| class="wikitable collapsible" style="width: 100%;"
 
!width="150px"|Identifier
 
!width="150px"|Identifier
 
! Description
 
! Description
Line 233: Line 333:
 
{{Incomplete}}
 
{{Incomplete}}
  
{| {{prettytable}} width="100%" class="collapsible"
+
{| class="wikitable collapsible" style="width: 100%;"
 
!width="150px"|Identifier
 
!width="150px"|Identifier
 
! Description
 
! Description
Line 280: Line 380:
  
 
{{Incomplete}}
 
{{Incomplete}}
 
  
 
== See also ==
 
== See also ==
 +
* {{Icon|gta}} [[DAT|List of all data files]]
 +
* {{Icon|3}} [[OBJS]] &ndash; ''IDE'' section to define weapons in GTA III
 +
* {{Icon|VC}} [[Weapon.dat (VC)|weapon.dat]] file content for Vice City
 +
* {{Icon|VC}} {{Icon|SA}} [[WEAP]] &ndash; ''IDE'' section to define weapons in Vice City and San Andreas
  
* [[OBJS]] &ndash; ''IDE'' section to define weapons in ''GTA III''
+
== External link ==
* [[WEAP]] &ndash; ''IDE'' section to define weapons in ''Vice City'' and ''San Andreas''
+
* {{Icon|VC}} [http://spaceeinstein.altervista.org/weap_vc.php Weapon flags calculator (JavaScript)], by {{U|spaceeinstein}}
* [[DAT|List of all data files]]
 
  
{{N|4|SA|VC}}
+
{{N|SA|VC|3}}
  
[[Category:File_Formats]][[Category:GTA_3]]
+
[[Category:File_Formats]]

Latest revision as of 04:01, 7 July 2017

The weapon.dat file is located in the .\data directory and contains weapons properties and settings. Weapon models are defined inside the default.ide file located in the same folder.

File format

The file is in plain text format so it can be opened with any text editor (like Notepad). Line comments are indicated by the character # (number sign) and empty lines are allowed. They can be placed anywhere in the file. Each entry takes up one line and follows a specific format detailed below. Data in each entry are separated by any whitespace like  (space) and  (horizontal tab). The file must contain the text ENDWEAPONDATA in order for the game to stop reading the file.

GTA III

GTA III Identifier Type Description
A Weapon Name string The name must be from the list of hardcoded names (see below).
B Fire Type string Available types include: MELEE, INSTANT_HIT, PROJECTILE, and AREA_EFFECT
C Range float The range of the bullet in units
D Firing Rate integer
E Reload integer The time to reload in milliseconds, constrained by the animation being played
F Amount of Ammunition integer The number of ammo per clip
G Damage integer Damage done to damageable objects; damage done to characters are within the range of the value while to others are accurate to the value
H Speed float
I Radius float
J Life span float
K Spread float
L,M,N Fire Offset Vector float[3] The x,y,z offset of the gunflash
O Animation to Play string
P Animation2 to Play string
Q Animation Loop Start float Start point of animation to be looped for shooting
R Animation Loop End float End point of animation to be looped for shooting
S Animation Fire Point float
T Animation2 Fire Point float
U Model ID integer IDE model of the weapon
V Flags integer See below

Weapon names

The game contains a hardcoded list of weapon names. This is used to assign a weapon name to a weapon type (Unarmed is type 0, BaseballBat is type 1, etc.).

  • Unarmed
  • BaseballBat
  • Colt45
  • Uzi
  • Shotgun
  • AK47
  • M16
  • SniperRifle
  • RocketLauncher
  • FlameThrower
  • Molotov
  • Grenade
  • Detonator
  • HeliCannon

Flags

Vice City

This section is incomplete. You can help by fixing and expanding it.

Vice City Identifier Type Description
A Weapon Name string The name must be from the list of hardcoded names (see below).
B Fire Type string Available types include: MELEE, INSTANT_HIT, PROJECTILE, AREA_EFFECT, and CAMERA
C Range float The range of the bullet in units
D Firing Rate integer
E Reload integer The time to reload in milliseconds, constrained by the animation being played
F Amount of Ammunition integer The number of ammo per clip
G Damage integer Damage done to damageable objects; damage done to characters are within the range of the value while to others are accurate to the value
H Speed float
I Radius float The length of melee weapon
J Life span float
K Spread float
L,M,N Fire Offset Vector float[3] The x,y,z offset of the gunflash
O Animation to Play string Animation file in gta3.img
P Animation Loop Start float Start point of animation to be looped for shooting
Q Animation Loop End float End point of animation to be looped for shooting
R Animation Fire Point float Point in animation to fire weapon, value has to be between values in columns P and Q
S Animation2 Loop Start float Start point of crouching animation to be looped for shooting
T Animation2 Loop End float End point of crouching animation to be looped for shooting
U Animation2 Fire Point float Point in crouching animation to fire weapon, value has to be between values in columns S and T
V Breakout Animation float
W Model ID integer IDE model of the weapon
X Model2 ID integer IDE model of the weapon attachment, only Minigun model shows an effect
Y Flags hex See below
Z Weapon Slot integer
  • 0 = Fist
  • 1 = Melee
  • 2 = Thrown
  • 3 = Pistol
  • 4 = Shotgun
  • 5 = Submachine gun
  • 6 = Assault rifle
  • 7 = Heavy
  • 8 = Sniper rifle
  • 9 = Special

Weapon names

The game contains a hardcoded list of weapon names. This is used to assign a weapon name to a weapon type (Unarmed is type 0, BrassKnuckle is type 1, etc.).

  • Unarmed
  • BrassKnuckle
  • ScrewDriver
  • GolfClub
  • NightStick
  • Knife
  • BaseballBat
  • Hammer
  • Cleaver
  • Machete
  • Katana
  • Chainsaw
  • Grenade
  • DetonateGrenade
  • TearGas
  • Molotov
  • Rocket
  • Colt45
  • Python
  • Shotgun
  • Spas12Shotgun
  • StubbyShotgun
  • Tec9
  • Uzi
  • SilencedIngram
  • Mp5
  • m4
  • Ruger
  • SniperRifle
  • LaserScope
  • RocketLauncher
  • FlameThrower
  • M60
  • Minigun
  • Detonator
  • HeliCannon
  • Camera

Flags

Byte Value Column Name Description
1 1 USE_GRAVITY
2 SLOWS_DOWN
4 DISSIPATES
8 RAND_SPEED
2 1 EXPANDS
2 EXPLODES
4 CANAIM Can auto-aim, "Classic" controls only
Small guns only
8 CANAIM_WITHARM Can run while auto-aiming, "Classic" controls only
Small guns only
3 1 1ST_PERSON
2 HEAVY Disables jumping and sprinting
4 THROW
8 RELOAD_LOOP2START
4 1 USE_2ND Will use a second animation after the main one played
Recommended for melee weapons only because it looks odd for others
2 GROUND_2ND Use a second animation for attacking knocked down pedestrians
4 FINISH_3RD Will use a third finishing animation after the second one played, only works when USE_2ND flag is used
8 RELOAD Reload animation will play
5 1 FIGHTMODE Will go into a fighting stance after attacking, can crash the game if no such animation exists
Melee weapons only
2 CROUCHFIRE Allows firing while crouching; for weapons without a crouching animation, character will stand up to attack and crouch back down
4 COP3_RD Cops and other law enforcement (Ped type 6) will use a third animation instead first, can crash the game if no third animation detected
8 GROUND_3RD Use a third animation for attacking knocked down pedestrians
6 1 PARTIALATTACK Can attack while running for melee weapons
Recommended for melee weapons only because it looks odd for others
2 ANIMDETONATE

San Andreas

This section is incomplete. You can help by fixing and expanding it.

San Andreas knows two different weapon types. Each weapon can be only one of those types. It gets defined by the first character of a line and defines the whole lines structure. The types are:

  • < – Melee weapons
  • $ – Guns
Identifier Description
A The weapon name.
B Firing type. Can be: MELEE, PROJECTILE (grenades, molotovs, etc.), INSTANT_HIT (for guns), USE (goggles, detonator), AFFECT_AREA (spraycan, fire extinguisher), and CAMERA.
C The maximum distance a target can be aimed at.
D The maximum range of the weapon to cause damage.
E Model identifier of the primary weapon (defined inside the default.ide file).
F Model identifier of the secondary weapon (apparently unused, always -1).
G, H The time the primary weapon requires to be reloaded.
I The slot the weapon requires in the game.
J Animation group to be used.

Melee weapon parameters

This section is incomplete. You can help by fixing and expanding it.

Gun parameters

This section is incomplete. You can help by fixing and expanding it.

Identifier Description
K Ammunition in one clip.
L Damage done by one hit.
M, N, O X, Y, Z offset of the muzzle flash.
P Skill level (0-Poor, 1-Gangster, 2-Hitman, 3-Cop[Colt45 only])
Q Required skill to achieve the level.
R Accuracy
S Strafing speed
T Starting time for animation.
U End time for animation.
V Point in animation to fire weapon (must be between T and U)
W, X, Y Same as T, U, V, but used for firing while crouching.
Z Animation breakout time.
a Hex flags

Weapon aiming offsets

This section is incomplete. You can help by fixing and expanding it.

See also

External link