Skip to content

Base NPC

Blixibon edited this page Sep 16, 2019 · 4 revisions

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

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

Inputs


  • SetHealthFraction <float> - Sets this NPC's health as a ratio in between 0 and 1. This input already existed on npc_helicopter, but it was expanded to be used on any NPC.

  • GiveWeaponHolstered <string> - Gives the NPC the specified weapon, but make it start holstered (meaning the NPC has to get it out on their own).
  • ChangeWeapon <string> - Holsters the NPC's current weapon, and then unholsters the specified weapon.
  • PickupWeapon <string> - Tells the NPC to look for and pick up the specified weapon entity, which should already be in the world.
  • PickupItem <string> - Tells the NPC to look for and pick up the specified item, like a health vial or even a frag grenade.

  • SetFriendlyFire <integer> - Overrides how this NPC should treat friendly fire. 0 = No friendly fire, 1 = Friendly fire, 2 = Use NPC settings/no override
  • SetDynamicInteractions <integer> - Sets this NPC's ability to use dynamic interactions. 0 = No interactions allowed, 1 = All interactions allowed, 2 = Non-Mapbase interactions only
  • SetProficiencyOverride <integer> - Overrides this NPC's weapon proficiency.
  • SetForceServerRagdoll <bool> - Forces this NPC to turn into a serverside prop_ragdoll instead of a clientside ragdoll when it dies.

  • AddCapabilities <flags> - Adds the specified Capability_t capabilities to the NPC. See (Enum-Reference)[Enum Reference] for more info.
  • RemoveCapabilities <flags> - Removes the specified Capability_t capabilities to the NPC. See (Enum-Reference)[Enum Reference] for more info.

  • SetCondition <integer> - Adds the specified condition to this NPC.
  • RemoveCondition <integer> - Removes the specified condition from this NPC.

  • SetHintGroup <string> - Sets this NPC's hint group.

  • SetThinkNPC <float> - Sets this entity's general think function to CallNPCThink. A float can be passed to delay this by a specific time.

Outputs


  • OnStateChange <integer> - Fires whenever a NPC changes state, passing the NPC's new state.

  • OnItemPickup <ehandle> - Fires when a NPC picks up an item (e.g. a health vial), passing the item entity.

  • OnHolsterWeapon <ehandle> - Fires when a NPC holsters their current weapon, passing the weapon entity.
  • OnUnholsterWeapon <ehandle> - Fires when a NPC unholsters their current weapon, passing the weapon entity.

KeyValues


  • Friendly fire override <integer> - Overrides how this NPC should treat friendly fire. 0 = No friendly fire, 1 = Friendly fire, 2 = Use NPC settings/no override
  • Dynamic interactions enabled <integer> - Sets this NPC's ability to use dynamic interactions. 0 = No interactions allowed, 1 = All interactions allowed, 2 = Non-Mapbase interactions only
  • Proficiency override <integer> - Overrides a NPC's weapon proficiency.
  • Force server ragdoll <bool> - Forces this NPC to turn into a serverside prop_ragdoll instead of a clientside ragdoll when it dies.
  • Spawn with StartScripting <bool> - Spawns the NPC in the StartScripting state.

Clone this wiki locally