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

npc_create

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

npc_create is a console command available in all Source Source games. It allows you to create NPCs on the fly, spawning 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 will be a small 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 with all of their data set to default. In essence, they act as they would if they were placed by a level designer who had not set any of the 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 and Gunships) won't find a track to path on. As a result, npc_create is not a command 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