Skip to content

Base NPC

Blixibon edited this page Nov 29, 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 a 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 a NPC the specified weapon, but make it start holstered (meaning the NPC has to get it out on their own).
  • ChangeWeapon <string> - Holsters a NPC's current weapon, and then unholsters the specified weapon.
  • PickupWeapon <string> - Makes a NPC look for and pick up the specified weapon, which should be an entity in the world.
  • PickupItem <string> - Makes a NPC look for and pick up the specified item, like a health vial or even a frag grenade.

Additional weapon inputs exist.


  • SetFriendlyFire <integer> - Overrides how the game should treat friendly fire towards a specific NPC. 0 = No friendly fire, 1 = Friendly fire, 2 = Use NPC settings/no override
  • SetDynamicInteractions <integer> - Sets a NPC's ability to use dynamic interactions. 0 = No interactions allowed, 1 = All interactions allowed, 2 = Non-Mapbase interactions only

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

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

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

  • SetThinkNPC <float> - Sets an 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 the game should treat friendly fire towards a specific NPC. 0 = No friendly fire, 1 = Friendly fire, 2 = Use NPC settings/no override
  • Dynamic interactions enabled <integer> - Sets a NPC's ability to use dynamic interactions. 0 = No interactions allowed, 1 = All interactions allowed, 2 = Non-Mapbase interactions only
  • Spawn with StartScripting <bool> - Spawns a NPC in the StartScripting state.
Clone this wiki locally