Cleanup is going to take awhile, so the site is back up but editing has been disabled.

Spawn Moving NPCs

From HalfLife 2 Knowledge Base

Jump to: navigation, search

by Zeta

This tutorial will show you how to spawn an npc and make it move to a waypoint.

Contents


Creating the template maker

Make an npc_template_maker with these properties:

  • Name: Give it a name relevant to what npc it will make.
  • Start Disabled: If you want to trigger an npc to appear choose 'yes'.
  • Max npcs: The max number of npcs that it can ever make.
  • Frequency: How many spawn at one time.
  • Max live npcs: Max ammount of npcs that can be alive at one time.
  • Name of template npc: The name of the npc that will be created.

Place the npc_template_maker in the location you want the npc(s) to spawn.

Placing the NPC

Then, somewhere in the map - I suggest next to the maker itself, insert the type of npc you want to spawn.

For this example we'll use a zombie. Edit the properties similar to this:

  • Name: Must be the same as the name of template npc that you set in the maker's properties - eg zombie1
  • Target path corner: The name of the path_corner that the npc will move too when spawned (explained later).

Then in the flags menu tick the following boxes:

  • Fall to ground
  • Template NPC (used by npc_maker)

The npc_maker is now ready to go. All you need to do now is make a path_corner and a trigger to set the whole thing going.

Placing the path_corner

Now place a path_corner entity in the place where you want the spawned npc(s) to move to. It's properties:

  • Name: Give it a relevant name such as zombie_path1. Make sure you imput this name into the properties of the npc you made earlier under - target path_corner. Other wise it will not work.
  • Next stop: Here you can type the name of another path_corner you want the npc(s) to go to after they reach this one.
  • Wait here (secs): Self explanatory - type in the number of seconds you want them to wait (if any).

Now all thats left to do is make a trigger_once entity. in its outputs put the following:

Ontrigger -> Name of npc_maker -> Spawn

Simple as that. Sorry if you guys knew this already but god knows me and onboarderror were stuck on this for awhile


Comment: I tried to follow this tutorial and discovered a little bug. When you choose a output on trigger_once entity, choose

OnStartTouch -> Name of npc_template_maker -> Enable

If you chose spawn it'll only spawn ONE single NPC-unit and that's it. If you choose enable it'll spawn x units with your seleceted freqency. Hope this helped some of you that had the same problem as me.

Personal tools