Pick up the crowbar of research scientist Gordon Freeman, who finds himself on an alien-infested Earth being picked to the bone, its resources depleted, its populace dwindling. Freeman is thrust into the unenviable role of rescuing the world from the wrong he unleashed back at Black Mesa. And a lot of people, people he cares about, are counting on him.

Post tutorial Report RSS NPC's Guide

How to create npc

Posted by on - Intermediate Sound Effects

[page=NPC's Guide]
===========================================================================
Appendix:
===========================================================================

1. About this FAQ
2. Creating NPCS
- 2A. Creating Weapons for NPC's
3. Weapons List
4. NPCS
- 4A. Character NPC'S (Non attacking)
- 4B. Enemy NPC'S (Attacking)
5. NPC's that cant be created
6. Thanks
7. Magical Monkeys Advanced-NPC Guide
- 7A. Updates

===========================================================================
1. About this FAQ
===========================================================================

Seeing as how there is no guide out and most people cant find any list or info on creating NPCS or how this all works I did some research and make a list and found out some things. This FAQ shows you what to do to create a NPC and what NPC are create able!

Tutorial Image

===========================================================================
2. Creating NPCS
===========================================================================

All console commands will be in quotation marks "".

First off when you start Half Life 2 go into your console before you do anything and type "sv_cheats 1".

Then load a game save or load a custom map. To load a map go to your console (~ key) and type "MAP" and the map name "MAP xxxxx". Once your in a map go to your console again type "notarget" and hit enter. NOTARGET makes the enemies NOT attack you when they spawn. After this type "noclip" in the console. This makes you fly.

There's another command called "ai_disable" which turns off the AI so you can create good NPC's and bad NPC's and they wont attack each other. But lets stick to the basics! Now wherever you create a NPC at it will be wherever your cursor is pointed.

Lets say you wanted to spawn a Zombie. Point to the ground where you want him and go to your console and type "npc_create npc_zombie" then hit enter. You'll see the Zombie appear!

For a Combine it would be go to your console and type "npc_create npc_combine_s" and he'll appear.

Basically your just changing the last line after the NPC_CREATE NPC_ to whatever you want to spawn. Its really easy.

Even though you’ll need to read the rest of this guide make sure when your done with creating your NPC's and you want to face them you go to your console and you turn off the commands from earlier again by typing "notarget" and "noclip" so you can walk around and so they can see you. But of course turn them on somewhere safe so you can have fun!

---------
2A. Creating Weapons for NPC's
---------

Now when you create a Combine or most any unit that NPC that can fight they don't have anything. So you have to give them something before you create them. This is REAL easy too.

Before you create a NPC think about what weapon you want to give it. Say you want to create a Citizen and you want him to have a Shotgun. Go to your console and type "npc_create_equipment weapon_shotgun" and hit enter. This command lets the game know you want to give the NPC's a shotgun when its made. This will be the default weapon for every NPC you create until you change the
weapon to something else.

Next you'd type in "npc_create npc_citizen". A citizen will now appear with a shotgun.

Just make sure to type in the command with a different weapon if you want something else for a different NPC or you’ll have the same gun.

Like creating NPC's not all weapons work for them. Some don't spawn and some will but then the NPC cant move. So read my weapons list below!

===========================================================================
3. Weapons List
===========================================================================

These are weapons you can create for the NPC's. Its really all about testing. I'm only showing the most stable ones. And some of the ones that do work but have side effects. Anything else not listed may crash your pc and/or not work at all.

The command is always "npc_create_equipment weapon_" You just add the weapon you want after the "_".

pistol (Side effect on some units are they wont move)
shotgun
smg1

Here are the other items but I suggest you test these at your own risk:
cubemap
cguard
physgun
ml
hmg1
immolator
irifle
sniperrifle
crowbar
extinguisher
frag
rollerwand
slam
brickbat
gauss
binoculars
alyxgun
hopwire
Molotov
physcannon
ar2
bugbait
ar1
rpg
smg2
stickylauncher
stunstick
thumper
iceaxe

===========================================================================
4. NPCS
===========================================================================

This is a list of characters you can spawn. Its split up into two lists. The first list is characters that are people you talk to and interact with and the second list are ones you fight.

Once again the command to create an NPC is "npc_create npc_". You just add the name after the "_".

--------
4A. Character NPC'S (Non attacking you)
--------

gman (Doesn't actually do anything. Sits still)
barney (lives really long and sometimes follows you)
alyx (lives about as long as you and sometimes follows you)
citizen (lives not to long and does whatever you say)
monk (fun listening to him talk in battle lol)
dog (useless but cool looking)
kleiner (sits still)
eli (sits still)
Mossman (sits still)
Breen (sits still)
Vortigaunt (REALLY COOL! You can talk to him and he fights!)

--------
4B. Enemy NPC'S (Attacking)
--------

sniper
rollermine
crow (useless)
headcrab
headcrabfast
poisonzombie
helicopter (doesn't seem to work often)
zombie
strider (tends to get stuck under ground)
combine_s
headcrab_black (poisoned one)
metropolice
manhack
turret_floor (Thanks to my friend for this one)
fastzombie
barnacle (starts on floor)
gunship
headcrab_poison
antlion
antlionguard
zombie_torso
combinedropship (seems to fly off)
combinegunship

===========================================================================
5. NPC's that cant be created
===========================================================================

This is a lost of the NPC's that cant be created. This is either because the game crashes or mostly because there just isn't a command.

Combine Elite
Combine APC
Scanner
Lamar

There are also other NPC's that's seem to have names in the game but don't
appear to have models or even work like Assassin and Bullsquid.

===========================================================================
6. Thanks
===========================================================================

Id like to thank Valve for making an AWESOME game that was better then the hype! Even though it had a rough release I cant complain this is the best game I've played since Half Life!

===========================================================================
7. Magical Monkeys NPC Guide-Advanced Guide
===========================================================================

Here's some info on how to spawn different NPCs and how to have fun with them. I'm pretty much certain it's incomplete so contribute anything I've missed and I'll edit it into this post with credit.

--------
The Basics
--------

To spawn an npc (with a few exceptions), look at the area of ground where you want it to spawn, then open up the console (~ key for most, below esc for all) and type "npc_create [npc name]". You can also spawn them aimed away from you using npc_create_aimed, but I haven't been able to make this command work without having an npc of the same type spawned normally first.

To give your npcs weapons, you have to use the npc_create_equipment command. If you wanted to spawn alyx with a shotgun for instance, you'd type "npc_create_equipment weapon_shotgun; wait; npc_create npc_alyx".

To bind a spawning command to a key, type "bind "[key]" "[command]"".

Now you can create some huge zombies vs. antlions vs. combine vs. alyx clones battles. When positioning troops for battle, type "ai_disable" to stop them fighting until you're done positioning. Type it again to turn ai back on.

-------
Fun
-------

NPCs all have inputs which you can activate using the ent_fire command. Some inputs are common to all NPCs, some are unique to one or two NPCs. To list all the inputs (and outputs, although I don't know if they're much use) of an NPC, type "ent_info [npc name]". As far as I can see, all the inputs listed above setrelationships are specific to certain NPCs.

If you want to actually input something to an NPC, you have to name it first. To do this, type "ent_setname [name]". Once you've named an npc, you can then type "ent_fire [name] [input]" and do cool stuff like set them on fire.

To set things on fire, type "ent_setname [name]; wait; ent_fire [name] ignite". I found that code posted by somebody on another forum and it made me want to find out other similar things I could do, and find out I did.

A couple of other useful global inputs are kill and sethealth. There's also a skin input which I'm guessing changes the model or textures but I have no idea how to use it, so if anybody can help with that it'd be much appreciated.

-------
NPC List
-------

Where inputs are blank I've found nothing useful, but I might have missed something (or I might have omitted something you would have found useful).

Combine

Footsoldiers

Combine Soldier: npc_combine_s

Metrocop: npc_metropolice ____ Inputs: enablemanhacktoss - I haven't been able
to get this to work. Maybe you'll have better luck.

Sniper: npc_sniper

------------
Vehicles
------------

All of these remain stationary.
For these use give rather than npc_create. They will spawn above you, rather than underground/inside the ground.

Strider: npc_strider ____ Inputs: setcannontarget - kills things - usage "ent_fire [name of strider] setcannontarget [name of target]" | setminiguntarget - useless, aims at feet of target ____ Notes: Targets must be named using ent_setname. On some levels you have to noclip upwards a little to spawn a strider because it will sink into the ground otherwise. If a strider impales an antlion guard it will fly away.

Dropship: npc_combinedropship ____ Notes: Lots of inputs, the ones I tried didn't work. Test out more if you can be bothered.

Gunship: npc_combinegunship ____ Inputs: dogroundattack - shoots a laser at the ground directly beneath it. Will continue to do so as long as enemies of the combine are beneath it.

Helicopter: npc_helicopter ____ Inputs: dropbomb ____ Notes: Lots of inputs, lots crashed the game. Test out more if you can be bothered.

-----------
Misc
-----------

Scanners and manhacks are spawned on the near side of the wall pointed at

Scanner: npc_cscanner ____ Inputs: equipmine | deploymine | disablespotlight | inspecttargetspotlight - usage "ent_fire [name of scanner] inspecttargetspotlight [name of target] | inspecttargetphoto | followtarget | setflightspeed ____ Notes: Targets must be named using ent_setname.

Manhack: npc_manhack

Rollermine: npc_rollermine ____ Inputs: respondtoexplodechirp - makes it explode

Stalker: npc_stalker ____ Notes: Does nothing but waddle around a bit. Shot me with a laser once in the three times I spawned one. Crashes game when killed.
Not recommended.

------------
Wildlife
------------

Antlions

Antlion: npc_antlion ____ Inputs: bugbait - buggy. will alternately attack you and love you. | burrow | unburrow

Antlion Guard: npc_antlionguard ____ Inputs: setchargetarget - usage "ent_fire [antlion guard name] setchargetarget [target name]" | clearchargetarget | setshovetarget | ragdoll - makes it die ____ Notes: Targets must be named using ent_setname.

------------
Zombies and Headcrabs
------------

Zombie: npc_zombie

Fast Zombie: npc_fastzombie

Poison Zombie: npc_poisonzombie

Headcrab: npc_headcrab ____ Inputs: burrowimmediate | unburrow

Fast Headcrab: npc_headcrab_fast

Poison Headcrab: npc_headcrab_poison

------------
Allies
------------

Vortigaunt: npc_vortigaunt

Citizen: npc_citizen ____ Inputs: giveweapon - usage "ent_fire [name of citizen] [weapon {eg weapon_shotgun}]" | setmedic | setammoresupplier | setreadiness

------------
Characters
------------

setexpressionoverride is an input which allows you to make a character enact any scene. The usage is "ent_fire [character name] setexpressionoverride [file path of scene]". For example, to make alyx perform the gman's closing speech, you would name alyx and type "ent_fire alyx setexpressionoverride scenescitadelgman_out".

Alyx: npc_alyx ____ Inputs: setreadiness | outsidetransition - places her in front of you | setexpressionoverride

Barney: npc_barney ____ Inputs: setreadiness | outsidetransition - places him in front of you | setexpressionoverride

Breen: npc_breen ____ Inputs: ____ setexpressionoverride

Dog: npc_dog ____ Inputs: setexpressionoverride ____ Notes: There are lots of inputs to do with playing catch that I couldn't get to work properly. Dog's AI without scripting is "run away".

Eli: npc_eli ____ Inputs: setexpressionoverride ____

Gman: npc_gman ____ Inputs: setexpressionoverride

Kleiner: npc_kleiner ____ Inputs: setexpressionoverride

Father Grigori: npc_monk ____ Inputs: setexpressionoverride | perfectaccuracy

Mossman: npc_mossman ____ Inputs: setexpressionoverride

Those are all the npcs I currently know of. To find the name of an npc while playing you can type "ent_show_response_criteria" and it'll come up with their name (along with some other stuff if developer is set to verbose).

There are more things to input to than NPCs. Type "ent_fire " and a list of non-NPC entities with inputs will appear under the console. I think these differ from level to level, and they let you do things like stopping the antlions spawning at the beginning of Highway 17.

I have no idea how to spawn explosive barrels etc or whether it's even possible, but hopefully someone will find a way.

I think that's about it. Hope it's of some use.

Post comment Comments
Studiopaw
Studiopaw - - 12 comments

0.O isnt this what garrys mod is about??????
i though you were teaching about MODING!?....

Reply Good karma Bad karma+2 votes
fireandice1
fireandice1 - - 1 comments

cool this makes hl2 lots funner

Reply Good karma Bad karma+1 vote
IGotzNoSkittles78
IGotzNoSkittles78 - - 101 comments

I thought you were gonna teach us how to make actual npcs, instead of spawning them :/

Reply Good karma Bad karma+4 votes
ItsThatMatt
ItsThatMatt - - 112 comments

I think a Guide on how you make them would be better, but still a good guide, thank-you !

Reply Good karma Bad karma+1 vote
Capt.Blei
Capt.Blei - - 153 comments

realy nice guide and funny (cheese xD)

Reply Good karma Bad karma0 votes
Guest
Guest - - 688,978 comments

Combine elite:
ent_create npc_combine_s model models/combine_super_soldier.mdl additionalequipment weapon_ar2

Thanks for this guide, dude

Reply Good karma Bad karma+1 vote
Calavera™
Calavera™ - - 19 comments

quiero saber si exite un comando para que los npc por ejemplo alyx barney y Grigori me sigan a donde yo quiera ir.. ya que no los comandos actuales solamente sirven para los Citizen ellos si te siguen... pero son muy debiles en combate aun que les equipes con buenas armas terminan muriendo igual y mas en su dificultad maxima ya que me gusta asi todo dificil pero para los compañeros no les va a la marcha ya que si intento crear una npc alyx con su arma base o con una escopeta se queda hay quieta rara vez en modo cobertura y nada mas que eso hace!.

Reply Good karma Bad karma+1 vote
Guest
Guest - - 688,978 comments

This comment is currently awaiting admin approval, join now to view.

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: