WeaponData: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(created page, further description needed?)
 
(Redirected page to Weapon script)
 
Line 1: Line 1:
The WeaponData which describes various attributes about a weapon can be found in ''weapon_[weapon name].txt'' in the ''scripts'' folder.
#redirect [[Weapon script]]
 
Here is a list of all attributes and their functions (comments taken from weapon_parse.h), not all attributes have to be specified:
<pre>
"printname" // Name for showing in HUD, etc.
"viewmodel" // View model of this weapon
"playermodel" // Model of this weapon seen carried by the player
"anim_prefix" // Prefix of the animations that should be used by the player carrying this weapon
 
"bucket" // inventory slot.
"bucket_position" // position in the inventory slot.
 
"clip_size" // max primary clip size (-1 if no clip)
"clip2_size" // max secondary clip size (-1 if no clip)
"primary_ammo" // "primary" ammo type
"secondary_ammo" // "secondary" ammo type
 
 
"default_clip" // amount of primary ammo in the gun when it's created
"default_clip2" // amount of secondary ammo in the gun when it's created
 
"weight" // this value used to determine this weapon's importance in autoselection.
"flags" // miscellaneous weapon flags
</pre>
 
Other possible data which can be nested inside ''WeaponData'' is ''SoundData'' and ''TextureData'':
<pre>
SoundData
{
 
"reload" "Weapon_Pistol.Reload"
"reload_npc" "Weapon_Pistol.NPC_Reload"
"empty" "Weapon_Pistol.Empty"
"single_shot" "Weapon_Pistol.Single"
"single_shot_npc" "Weapon_Pistol.NPC_Single"
"special1" "Weapon_Pistol.Special1"
"special2" "Weapon_Pistol.Special2"
"burst" "Weapon_Pistol.Burst"
}
</pre>
 
<pre>
TextureData
{
"weapon"
{
"font" "WeaponIcons"
"character" "b"
}
 
"weapon_s"
{
"font" "WeaponIconsSelected"
"character" "b"
}
 
"ammo"
{
"font" "WeaponIcons"
"character" "s"
}
 
"crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
 
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
}
</pre>
 
Here's an example of weapon_shotgun.txt:
 
<pre>
// Shotgun
 
WeaponData
{
// Weapon data is loaded by both the Game and Client DLLs.
"printname" "#HL2_Shotgun"
"viewmodel" "models/weapons/v_shotgun.mdl"
"playermodel" "models/weapons/w_shotgun.mdl"
"anim_prefix" "shotgun"
 
"bucket" "3"
"bucket_position" "0"
 
"clip_size" "6"
"primary_ammo" "Buckshot"
"secondary_ammo" "None"
 
"weight" "4"
"item_flags" "0"
 
// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
SoundData
{
 
"empty" "Weapon_Shotgun.Empty"
"reload" "Weapon_Shotgun.Reload"
"special1" "Weapon_Shotgun.Special1"
"single_shot" "Weapon_Shotgun.Single"
"double_shot" "Weapon_Shotgun.Double"
// NPC WEAPON SOUNDS
"reload_npc" "Weapon_Shotgun.NPC_Reload"
"single_shot_npc" "Weapon_Shotgun.NPC_Single"
}
 
// Weapon Sprite data is loaded by the Client DLL.
TextureData
{
"weapon"
{
"font" "WeaponIcons"
"character" "b"
}
"weapon_s"
{
"font" "WeaponIconsSelected"
"character" "b"
}
"ammo"
{
"font" "WeaponIcons"
"character" "s"
}
"crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
}
}
</pre>

Latest revision as of 03:57, 16 August 2009

Redirect to: