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

Npc destroy: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Undo revision 453618 by Gameplayer (talk))
Tag: Undo
 
(16 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{wrongtitle|title=npc_destroy}}
{{this is a|console command|name=npc_destroy}}
 
The <code>npc_destroy</code> console command is a debugging tool that destroys NPCs. Destroyed NPCs are silently removed, so outputs such as "OnDamaged" and "OnDeath" are not fired, nor are ragdolls created. Destroyed NPCs carrying weapons will drop the weapon before removing themselves.
The <code>npc_destroy</code> console command is a debugging tool that destroys NPCs. Destroyed NPCs are silently removed, so outputs such as "OnDamaged" and "OnDeath" are not fired, nor are ragdolls created. Destroyed NPCs carrying weapons will drop the weapon before removing themselves.


This command flags the NPC with a note to destroy 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 destroy itself, so if AI is not running (due to the [[ai_disable]] command), the command will be ignored.
 
{{devreq}}
==Usage==
==Usage==
* <code>npc_destroy</code>
{{wildcardnote|npc_destroy npc*zombie|destroy|NPC|npc}}
* {{code|npc_destroy}}
** This will destroy the NPC under your crosshair, if any.
** This will destroy the NPC under your crosshair, if any.
* <code>npc_destroy <entity index></code>
* {{code|npc_destroy <entity index>}}
** This will destroy the NPC matching the specified entity index, if any.
** This will destroy the NPC matching the specified entity index, if any.
* <code>npc_destroy <name></code>
* {{code|npc_destroy <name>}}
** This will destroy all NPCs who's classname matches the specified name, or who's targetname matches the specified name.
** This will destroy all NPCs whose classname or targetname matches the specified name.
* <code>like a brown splob</code>
* {{code|npc_destroy *}}
**Like a brow splobbable splob
** This will destroy all NPCs in the map
 


==See also==
==See also==
Line 21: Line 22:


[[Category:Debugging]]
[[Category:Debugging]]
[[Category:AI Commands]]

Latest revision as of 09:15, 17 September 2024

npc_destroy is a console command available in all Source Source games. The npc_destroy console command is a debugging tool that destroys NPCs. Destroyed NPCs are silently removed, so outputs such as "OnDamaged" and "OnDeath" are not fired, nor are ragdolls created. Destroyed NPCs carrying weapons will drop the weapon before removing themselves.

This command flags the NPC with a note to destroy 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.

Usage

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


See also