This article's documentation is for anything that uses the Source engine. Click here for more information.

npc_kill

From Valve Developer Community
Jump to: navigation, search

npc_kill is a console command available in all Source Source games. The npc_kill console command is a debugging tool that kills NPCs. The command kills NPCs by dealing enough damage to kill them, so the "OnDamaged" and "OnDeath" outputs will be fired.

This command flags the NPC with a note to kill itself, so if AI is not running (due to the ai_disable command), the command will be ignored.

Note.pngNote:The game must be in Developer mode for this command to work properly.
Note.pngNote:Some NPCs ignore this command, for example npc_sniper and npc_helicopter.
PlacementTip.pngWorkaround:Use ent_fire <name> sethealth 0 to kill them.

Usage

Note.pngNote:The targetname/classname parameter supports wildcard but anything after the wildcard is ignored. For example, npc_kill npc*zombie will kill any NPC whose targetname/classname starts with npc no matter what text follows after wildcard.
  • npc_kill
    • This will kill the NPC under your crosshair, if any.
  • npc_kill <entity index>
    • This will kill the NPC matching the specified entity index, if any.
  • npc_kill <name>
    • This will kill all NPCs whose classnames match the specified name, or whose targetnames match the specified name.
  • npc_kill *
    • This will kill all NPCs in the map.


See also