Npc kill: Difference between revisions
Jump to navigation
Jump to search
Note:The game must be in Developer mode for this command to work properly.
Note:Some NPCs ignore this command, for example npc_sniper and npc_helicopter.
Workaround:Use
Note: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.
Cargo Cult (talk | contribs) m (Apostrophe Realignment Militia strikes again! :-]) |
Gameplayer (talk | contribs) (Undo revision 453620 by Gameplayer (talk)) Tag: Undo |
||
(10 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{this is a|console command|name=npc_kill}} | ||
The <code>npc_kill</code> 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. | The <code>npc_kill</code> 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. | 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. | ||
{{devreq}} | |||
{{note|Some NPCs ignore this command, for example [[npc_sniper]] and [[npc_helicopter]]. {{workaround|Use <code>ent_fire <name> sethealth 0</code> to kill them.}}}} | |||
==Usage== | ==Usage== | ||
{{wildcardnote|npc_kill npc*zombie|kill|NPC|npc}} | |||
* <code>npc_kill</code> | * <code>npc_kill</code> | ||
** This will kill the NPC under your crosshair, if any. | ** This will kill the NPC under your crosshair, if any. | ||
Line 12: | Line 13: | ||
* <code>npc_kill <name></code> | * <code>npc_kill <name></code> | ||
** This will kill all NPCs whose classnames match the specified name, or whose targetnames match the specified name. | ** This will kill all NPCs whose classnames match the specified name, or whose targetnames match the specified name. | ||
*<code>npc_kill *</code> | |||
** This will kill all NPCs in the map. | |||
Line 20: | Line 23: | ||
[[Category:Debugging]] | [[Category:Debugging]] | ||
Latest revision as of 09:15, 17 September 2024
npc_kill
is a console command available in all 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.



ent_fire <name> sethealth 0
to kill them.Usage

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.