Skip to content

Base Weapon

Blixibon edited this page Nov 2, 2019 · 2 revisions

This page lists changes to CBaseCombatWeapon, which every weapon derives from. This means every weapon in the game technically possesses these changes, although some changes might only be relevant to a specific group of them.

Some I/O were already possible through other, more complicated means (e.g. keyvalues changed with AddOutput).

Inputs


  • SetAmmo1 <integer> - Sets the weapon's currently loaded primary ammo.
  • SetAmmo2 <integer> - Sets the weapon's currently loaded secondary ammo.
  • GiveDefaultAmmo <void> - Resets the weapon's loaded ammo to "default", which is usually the max.

  • EnablePlayerPickup <void> - Enables player pickup if it was disabled before.
  • DisablePlayerPickup <void> - Disables player pickup if it was enabled before.
  • EnableNPCPickup <void> - Enables NPC pickup if it was disabled before.
  • DisableNPCPickup <void> - Disables NPC pickup if it was enabled before.

  • BreakConstraint <void> - If the weapon was set to start constrained, this input breaks its constraint.

  • ForcePrimaryFire <void> - Forces the weapon to trigger its primary attack one time. This is supported on most guns, although implementation is weapon-specific and may function differently from weapon to weapon.
  • ForceSecondaryFire <void> - Forces the weapon to trigger its secondary attack one time. This is supported on most guns, although implementation is weapon-specific and may function differently from weapon to weapon.

Outputs


  • OnDropped <void> - Fires when dropped by a NPC or player, passing the dropper as the activator.

KeyValues


  • Ammo 1 <integer> - Sets the weapon's currently loaded primary ammo. Requires the "Preserve ammo" spawnflag to function.
  • Ammo 2 <integer> - Sets the weapon's currently loaded secondary ammo. Requires the "Preserve ammo" spawnflag to function.

Spawnflags


  • Deny NPC pickup 8 - Prevents NPCs from automatically picking up a weapon.
  • Preserve ammo values when picked up 16 - Prevents the weapon from resetting its ammo values before being spawned, picked up, dropped, etc.

NPC/player interaction with weapons

Mapbase adds a bunch of weapon-related I/O/KV to NPCs and players, covered on the Base NPC and Base Player for NPC or player-specific changes and Base Combat Character for changes used by both types.

Clone this wiki locally