npc_create

From Valve Developer Community
(Redirected from Npc create aimed)
Jump to: navigation, search


The npc_create console command is a debugging tool that allows you to create NPCs on the fly. It creates the NPC in the world at the position you are looking at. The classname specified must be a valid classname from the NPC section in the list of entities. If the NPC hasn't been precached already, there'll be a hitch as the engine caches the NPC's content.

It's important to realize that NPCs created using this command are dropped into the world without all their data set to defaults. In essence, they act as they would if they were placed by a level designer who didn't set any of their KeyValue fields in Hammer. As a result, not all NPCs will be able to function properly when created via this command. For example, all path tracking NPCs (like Striders & Gunships) won't find a track to path on. As a result, npc_create is not a command to use to test AI quality in an area. Instead, it's a great tool for testing things other than the NPCs you're creating.

NPCs that wield weapons need to be told what weapon to spawn with. Otherwise they'll spawn empty handed, and most weapon-using NPCs don't know what to do without a weapon. Use the npc_create_equipment command to specify the weapon classname of the weapon that created NPCs should be given.

Usage

  • npc_create <classname>
    • Create the NPC matching <classname> at the point you're looking at, if it can fit in the space.
  • npc_create_aimed <classname>
    • Creates an NPC of type <classname> at the point you're looking at, if it can fit in the space. The NPC will be oriented to face directly away from you. Useful if you don't want the NPC to see you yet.
  • npc_create_equipment <classname>
    • Used to specify the classname of the weapon that created NPCs should spawn with, if they use weapons. For example, typing the following will create a Combine Soldier with a shotgun:
      • npc_create_equipment weapon_shotgun
      • npc_create npc_combine_s

See also