Skip to content

Custom Weapon Attributes

wootguy edited this page Jun 2, 2026 · 9 revisions

Weapon attributes define basic weapon/entity appearance and behaviors. Attributes are grouped into sections. Each section can appear only once in the config file unless stated otherwise. See Attribute Types for explanations of the Type values.

[general]

This section is required to register the weapon.

Attribute Type Default Description
classname string Entity name for spawning the weapon as an entity or via the map CFG.
hl_client_classname string Replacement weapon given to players who don't have the SevenKewp client. Don't use aliases here (use weapon_9mmhandgun and weapon_9mmAR, not weapon_glock or weapon_mp5).
kill_feed_icon string Icon to use in the kill feed. This should be the classname of a Half-Life weapon similar to the one you're making ("weapon_357" to use the revolver icon). You can't use custom icons yet.
display_name string Descriptive name for the weapon. Used in text messages.
flags List of flags See Weapon Flags for valid values.
v_model string Path to the firstperson view model.
p_model string Path to the thirdperson model.
p_model_akimbo string Path the thirdperson model which is used only when the weapon is in akimbo mode.
w_model string Path to the world model.
w_model_akimbo string Path to the world model which is used only when the weapon is in akimbo mode.
hud_folder string Path to the folder containing the HUD config. Don't include sprites/ nor a trailing slash.
slot integer 0 Weapon slot to place the weapon in.
slot_position integer -1 Position in the slot to place the weapon. -1 = Automatic.
weight integer 0 Importance for auto weapon switching. See here for the default weapon weights.
deploy_anim integer 0 Animation to play when deploying the weapon.
deploy_time time 0ms Time before you can start shooting.
deploy_anim_time time 0ms Time before an idle animation can play after deployment. This should match or exceed the duration of the animation.
thirdperson_anims string Thirdperson animation set to use. See Thirdperson Weapon Anims for valid values.
thirdperson_anims_zoom string Animation set to use when zoomed in.
thirdperson_anims_akimbo string Animation set to use when akimbo mode is active.
move_speed float 1.00 Movement speed multiplier. Applied while the weapon is deployed.
jump_power integer 800 Upward velocity added from jumping while the weapon is deployed.

Weapon Flags

Valid values for the flags attribute in the [General] section. They control basic weapon behaviors. Values can be combined with +.

Flag Description
dynamic_accuracy Crosshair widens with movement and shrinks when crouched.
empty_idles The last half of idles are used when the clip is empty.
exclusive_hold Weapon must be dropped before switching to other weapons.
exhaustible Remove the weapon when out of ammo.
force_zoom_sprite Force use of zoom crosshair sprite when using dynamic crosshairs.
has_hand_models Default model supports alternate hand models (op4/bshift).
hide_secondary_ammo Hide secondary ammo on HUD.
hl_client_can_use Allow the weapon to be used by vanilla HL clients without prediction. Not recommended for hitscan weapons.
keep_zoom_sprite_aspect Zoom crosshair keeps its aspect ratio when stretched to fit the screen. Empty space is colored black.
link_chargeups Primary and secondary chargeup state and events are shared (minigun behavior).
no_autoreload Don't reload the weapon automatically.
no_autoswitch_empty Don't switch to another weapon when out of ammo.
no_prediction Disable client prediction entirely. This allows vanilla HL clients to use the weapon. Not recommended for hitscan weapons.
primary_priority Primary fire has priority over secondary when both attack buttons are pressed.
select_on_empty Allow selecting the weapon when empty.
strech_zoom_sprite Zoom crosshair stretches to fit the screen.
unlink_cooldowns Primary and secondary attacks cooldown independently.
use_only Weapon is collected with the use key, not by touching.

Thirdperson Weapon Anims

Valid values for the thirdperson_anims attribute in the [General] section. Half-Life player models use similar-looking animations when a Sven Co-op model value is used.

Value Model Type Description
crowbar Half-Life Crowbar
trip Half-Life Tripmine / Medkit.
onehanded Half-Life Weak pistol.
python Half-Life Strong pistol.
shotgun Half-Life Shotgun.
gauss Half-Life Gauss / Tau cannon.
mp5 Half-Life MP5.
rpg Half-Life RPG.
egon Half-Life Gluon gun.
squeak Half-Life Snarks.
hive Half-Life Hornet gun.
bow Half-Life Crossbow.
wrench Sven Co-op Pipe wrench.
gren Sven Co-op Grenade.
bowscope Sven Co-op Zoomed crossbow.
minigun Sven Co-op Minigun.
uzis Sven Co-op Akimbo uzis.
m16 Sven Co-op M16.
sniper Sven Co-op Sniper rifle.
sniperscope Sven Co-op Zoomed sniper rifle.
saw Sven Co-op M249.

[ammo_primary]
[ammo_secondary]

Configures primary/secondary ammo.

Attribute Type Default Description
type string Name of a registered ammo type. Can be your own custom ammo type or one of the defaults.
clip_size integer 0 Size of the clip. -1 = No clip (doesn't reload). Secondary clips not yet implemented.
default_give integer 0 Amount of ammo in the clip when the weapon is picked up, and the ammo given when picking up a duplicate weapon.
drop_entity string Entity classname to spawn when dropping ammo (dropammo and dropammo2 commands).
drop_amount integer 0 Amount of ammo given by the dropped ammo entity.

[reload]
[reload_empty]
[reload_shell]
[reload_pump]
[reload_akimbo]

The combination of reload stages control how the weapon reloads. For simple weapons, all you need is a [reload] section. For weapons that play a different animation when the clip is empty, use [reload] and [reload_empty] sections.

For shotgun-style reloads, use [reload], [reload_shell], and [reload_pump] sections. The [reload] stage in a shotgun-style reload is for lifting the weapon up to insert a shell. Shotgun-style reloads can be interrupted at any time during the shell and pump stages. Empty reload sections aren't allowed for shotguns.

For weapons with an akimbo mode, add a [reload_akimbo] section. This stage is for reloading a single hand, and is mirrored for the left and right hand automatically.

Attribute Type Default Description
anim integer 0 Animation to play for the current reload stage.
time time 0ms Duration of the current reload stage.

[idle]
[idle_akimbo]
[idle_laser]

There are 3 groups of idles you can define. Each group can have up to 4 sections/animations.

  • [idle_akimbo] = Selected if the weapon is in akimbo mode. Animations are for a single weapon and mirrored for both hands.
  • [idle_laser] = Selected if a laser is active. Add this if some idles twist the laser too much.
  • [idle] = Selected if no other groups are defined/active.

Individual idles are selected randomly depending on their configured weight. All weights for an idle group should add up to 100.

If the weapon has the empty_idles flag enabled, the last 2 idles in a group are selected from only when the clip is empty, otherwise the first 2 idles are used.

Attribute Type Default Description
anim integer 0 Animation to play.
time time 0ms Duration of the animation.
weight integer 0 Chance for this animation to be chosen. 100 = 100%.

[akimbo]

Adding this section enables akimbo mode for the weapon. All animation attributes are for a single weapon. Animations are mirrored for both hands automatically.

Attribute Type Default Description
deploy_anim integer 0 Animation played by the opposite hand when activating akimbo mode, and when finishing a reload for one hand.
deploy_time integer 0 Time before you can shoot when activating akimbo mode, or after a reload for one hand has finished.
akimbo_deploy_anim integer 0 Animation to play for both hands when deploying the weapon with akimbo mode active.
akimbo_deploy_time time 0ms Time before you can shoot when deploying in akimbo mode.
holster_anim integer 0 Animation played for the opposite hand before beginning a reload for one hand.
holster_time time 0ms Duration of the holster animation. Delays one-handed reload and toggling akimbo mode.
accuracy float 0 Degrees of accuracy while akimbo mode is active. Crosshair only.

[laser]

Configure a laser that can be toggled by events.

Attribute Type Default Description
dot_sprite string Path to a sprite that will be drawn at the end of the laser.
beam_sprite string Path to a sprite that will be used to draw the laser beam.
dot_size integer 0 Size of the dot sprite (0-255).
beam_width integer 0 Width of the laser beam (0-255).
attachment integer 0 Attachment on the firstperson view model where the laser will be drawn from. If the model is missing the attachment index, then the laser beam won't be drawn.

[primary_attack]
[secondary_attack]
[tertiary_attack]

Control logic for each of the attack buttons.

Attribute Type Default Description
flags List of flags Valid flags:
works_underwater = Attack works under water. A failure event is triggered otherwise.
not_an_attack = Don't run default attack logic (empty sounds, animations, failure events, reloads).
always_cooldown_idle = Cooldown idle animations even if the attack failed (underwater, out of ammo).
akimbo_only = Don't allow the attack if not holding the akimbo version of the weapon.
need_full_cost = Don't allow the attack if the clip has less than the ammo cost.
no_autofire = One attack per click.
ammo_cost integer 0 Ammo spent per attack.
ammo_freq integer 0 Don't spend ammo until this many attacks have triggered. This simulates fractional ammo costs.
ammo_pool string default Valid values:
default = Spend from the primary clip/reserve for primary attacks, and secondary reserve for secondary attacks.
primary_clip = Spend from the primary clip.
primary_reserve = Spend from the primary reserve.
secondary_reserve = Spend from the seconday reserve.
cooldown time 0ms Time to wait before you can attack again.
cooldown_fail time 0ms Time to wait before you can attack again, after failing an attack (underwater, no ammo).
accuracy float 0 Degrees of accuracy for the crosshair.
empty_sound string weapons/357_cock.wav Sound played when an attack fails (under water, no ammo).

Charged attacks

The following attributes are for charged attacks. These are for weapons like the minigun or gauss that need you to hold the attack button down before the attack begins.

Attribute Type Default Description
charge_mode string none Controls how the weapon charges up for an attack. Valid values:
none = Attack does not need to charge up.
constant_fire = Fire constantly after chargeup finishes, and until the attack button is released (minigun behavior).
single_fire = Fire a single shot when charged up, then charge down.
single_fire_cancellable = Fire a single shot when charged up, then charge down. The attack can be cancelled if the attack key was released before the charge up finished.
single_fire_on_release = Fire a single shot when the player releases the attack button (gauss behavior).
charge_time time 0ms Time to reach full charge.
charge_cancel_time time 0ms Minimum time to charge before attacking or cancelling the attack.
charge_ammo_mode string spend_on_attack How to spend ammo while charging up the attack. Valid values:
spend_on_attack = Spend ammo when attacking (minigun behavior).
spend_during_chargeup = Spend ammo gradually as the attack charges up (gauss behavior).
overcharge_time time 0ms Time an attack can be charged before overcharge events are triggered. 0 = never overcharge.
overcharge_mode string cancel What to do when overcharged. Valid values:
cancel = Cancel the attack.
continue = Allow the attack and/or continue charging.
charge_flags List of flags Valid flags:
scale_damage = Attack charge progress scales damage values in events (gauss behavior).
scale_kickback = Attack charge progress scales kickback events (gauss behavior).
charge_move_speed float 1.00 Movement speed multiplier applied while charging up the attack.

Melee Attacks

The following attributes are for melee attacks only. Adding any one of these converts the attack to a melee attack. Melee attacks are not predicted by the client.

Attribute Type Default Description
melee_damage integer 0 Damage applied to the impacted entity.
melee_damage_type List of flags Type of damage to apply. Valid flags:
crush, bullet, slash, burn, freeze, blast, club, shock, sonic, energybeam, nevergib, alwaysgib, drown, paralyze, nervegas, poison, radiation, drownrecover, slowburn, slowfreeze, mortar, sniper, medkitheal, launch, shock_glow
These flags mirror the damage type macros.
melee_range integer 0 Range of the melee attack.
melee_attack_offset vector 0 0 0 Offset from the player's head given in forward, up and right units. The melee attack hitscan begins from here, and ends in front of the player without an offset, at the configured range.
melee_hit_cooldown time 0ms Time to wait before you can attack again, after hitting something.
melee_miss_cooldown time 0ms Time to wait before you can attack again, after missing.
melee_decal_delay time 0ms Time to wait before applying a decal after hitting something. Should match the impact time of the attack animation(s).
melee_hit_wall_sound
melee_hit_wall_sound2
melee_hit_wall_sound3
melee_hit_wall_sound4
string Path to a sound file to play when hitting a solid object (world or machine). A sound is randomly selected from one of these 4 attributes.
melee_hit_flesh_sound
melee_hit_flesh_sound2
melee_hit_flesh_sound3
melee_hit_flesh_sound4
string Path to a sound file to play when hitting a fleshy object (monster). A sound is randomly selected from one of these 4 attributes.
melee_miss_sound
melee_miss_sound2
melee_miss_sound3
melee_miss_sound4
string Path to a sound file to play when missing an attack. A sound is randomly selected from one of these 4 attributes.

Clone this wiki locally