Half-Life 2

The Art of Creating and Using NPCs effectively

Note: This would have been useful when I made it several years ago, the only real purpose it serves now is to add questionable 'content' to my website.
It also seems a waste to just delete it..


This is a simple guide I have created from my experiences in using the Half-Life2 console to create and use NPCs.
Although the commands on how to create NPCs were given in many websites, how to actually use them, and to give equipment to the NPCs were not included.
I hope to fix the problem here.


The Basics
In order to create NPCs, you must first open the console using the ` key. This is located on the top left hand corner of your keyboard, just in case you are stupid (that's one of my tasteless jokes).
Once the console is open, you can create NPCs quite simply by typing in "npc_create npc_[insert npc name here]"
For instance, if I wanted to create a zombie, I would press ` to open the console then type
npc_create npc_zombie
BUT! Before you go off to start creating some zombies of your own, there are more things I need to say!

The Specifics
The creation of the NPC is done where ever you were aiming at, therefore, in order to create a zombie, you must aim at a flat ground (and also some distance away from you unless you want to get whacked) then type in the command.
You will see that the zombie is created there.
Great! Now we move onto the more complicated NPCs, the ones that use weapons.
In order to create and use NPCs that use guns, you must first set their equipment. This is done by the command "npc_create_equipment weapon_[insert weapon name here]"
So, for instance, I want to create a Combine soldier with the standard Overwatch Pulse Rifle, then I open the console then type
npc_create_equipment weapon_ar2
npc_create npc_combine_s
Yay! You've just created a weapon wielding NPC!

The Console Codes
In order to actually create NPCs though, you need to know the Console Codes that create them, this can be found quite easily on the internet, so I'm not going to bother to list them all here, however, I will list a few codes, the ones that I prefer the most.
NPC Codes
NPC Name Console Code Alliance Type
Zombie zombie Alien
Poison Zombie poisonzombie Alien
Combine Soldier combine_s Combine
Resistance Fighter citizen Resistance
Barney barney Resistance
Alyx alyx Resistance
Vortigaunt vortigaunt Resistance
Antlion antlion Antlion
Big Antlion antlionguard Antlion

Weapon Codes
Weapon Name Console Code
Submachine Gun smg1
Overwatch Pulse Rifle ar2
Shotgun shotgun
RPG Launcher rpg


Additional Information
Each Alliance Type is hostile to the other, except on very rare occasions. Whether or not an NPC is hostile to the human player can be modified, but I don't know how. NPCs like Striders, Helicopters, Gunships and such can be created, but their location needs to be done using co-ordinates, otherwise there isn't enough room so they are not created (or for Striders, they are created, but with only about half their head above the ground). Many of the weapons cannot be used by the NPC players, though all the ones I have listed work. Remember to type in npc_ before npc name and weapon_ before weapon name (e.g. npc_barney, weapon_ar2) Of those that are automatically friendly to the player, only the Resistance Fighters follow you around, and then, only four at a time, also, on most maps, due to some issues with the layout of the map, the citizens will be too stupid to follow you (though the Antlions, which are bugs, seem to be able to follow you fine...). Barney, Alyx and Monk (The Priest) all have lots of health, unlike the standard Combine Soldiers and the Resistance Fighters, so if you're going to use NPCs, use one of those three, I prefer Barney, just because he's so crazy. It's really fun to have about 20 Barneys with RPGs running around killing everybody in the area..
If you just want to see the NPCs fight each other, without you interfering, it'd be best to turn notarget on (done by going in console, then typing "sv_cheats 1" followed by "notarget"), as doing so will mean the AI will just kill each other (provided the other is of a different Alliance Type).
And that's about it. It's quite pitiful, but it is simple...
N.B. When I said "20 Barneys with RPGs running around killing everybody in the area.." The Barneys don't actually run around on their own, finding enemies and killing, they stand pretty stationery like a turret, and only move and fight when they 'detect' an enemy presence, i.e. get fired upon. Which means you'll probably have to create a few hundred Barneys if you want the Barneys to take care of everything for you (i.e. create 2 or 3 Barneys for every encounter).


Back to Home.