This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Custom Pistols

From Valve Developer Community
Jump to: navigation, search

English (en)
... Icon-Important.png

A set of entities were added to Half-Life: Alyx to allow some modification of the weapon system by the creation of custom pistols.

  • Replicates functionality of Alyx's pistol with slide and ammo clips
  • Exposes many properties in hammer with default values based on Alyx's pistol
  • Supported by inventory alongside shipped weapons
  • Not upgradable
  • Not extensible via scripting
  • Shares backpack ammo with Alyx's pistol

The new entities are:


This entity provides the same behavior as Alyx's initial pistol without any upgrades. It exposes properties in hammer including models, effects, sounds as well as various values like damage and firing rates. The default property values are the same as Alyx's initial pistol. A generic pistol can be placed in a level without changing its default values and it will behave like the shipped pistol. The pistol is composed of multiple moving models: a frame, a slide and a clip. Each of those model needs a left-handed and right-handed version. They all can be overridden to make different looking and animating pistols. One of the properties defines where the pistol will be shown in the weapon inventory UI (Top, Bottom, Left, Right). Another property defines the name of the weapon in the inventory. This name should be unique to allow the inventory to differentiate between generic pistols. If the player already has a weapon in the same inventory slot, the last picked weapon will take its place. The other weapon will no longer be accessible from the inventory but will still be kept around. The player can cycle which weapon is accessible in a given slot by opening the inventory and moving his hand all the way outside the edge of the inventory until it closes.


This entity is a single ammo clip that can be loaded in a generic pistol or stored in the backpack. It exposes properties like models and ammo per clip. Some of those properties are also found in the generic pistol entity and should be set to match the associated pistol.


This entity is a group of clips that can be put in the backpack to increase the total bullet clip count.

The ammo for generic pistols come from the same backpack pool as Alyx's pistol even though their clips and bullets can be made to look different. Only generic clips can be loaded into generic pistols and the backpack will pull the correct one based on the active weapon.

The pistol behavior is triggered by the game logic but many of the actual functionality is driven by attach points, hand poses, animations and anim graphs defined in the models. Those can all be replaced as long as they conform to the structure and the naming conventions of the shipped pistol. The best way to learn about those structures is to open and study the content of Alyx's pistol in the workshop tools.