Are you a Level Designer? Are you looking for help/support or other level designers? Then this is the group for you! Doesn't matter what you map for, if your a beginner or a professional this is the group for you.

Post tutorial Report content RSS feed How to create zombies who search and track the player

After reading this tutorial, you will know how can have NPCs searching the player in the whole map ! You can apply as well as for zombies as combines.

Posted by Bioko on Nov 18th, 2010
Basic Mapping/Technical.


In this tutorial, we will see how we can make that an NPC, once he spawns, search the player via an aiscripted_schedule. This method can be useful if you want to make a "survival" map, where for instance, the zombies must search by themselves the player who is hiding in a town or a forest. What is cool here is that you don't have to create a complex path where the NPCs will patrol and spend time scripting the whole shit... No here the NPC will search the player wherever he is ! You will also learn how to use the entity called aiscripted_schedule.

I - Defining the NPC

So first, you will need to create a template NPC who will be spawned on the map and who will search the player. It can be a combine, a zombie, a vortigaunts, a rebel... It is very important that once you placed your npc, you convert it to a template NPC (take a tour to the "Flags" tab) and that you give to him a name (I will use NPC_Seeker here) ! Or else, it won't work !

II - Defining the aiscripted_shedule

Create somewhere in a map an entity called aiscripted_schedule and name it (I will name it AISchedule_Seeker). You must also enter in the field called "Target NPC" the name of your template NPC (since mine is named NPC_Seeker, I will write NPC_Seeker).

Then be sure that the rest of the fields are like those above :

  • Name : AI_Schedule_Seeker
  • Target NPC : NPC_Seeker
  • Searh Radius (0=everywhere) : 0 (let this to zero so the NPC will search everywhere in the map to find the player)
  • AIl in radius : Yes
  • AI state to set : Set state to COMBAT
  • Shedule to run : Run to Goal Entity (You can also make that the NPC just walk to the player or follow his path)
  • Interruptability : Damage or Death (The NPC will stop search the player once he die or get damaged)
  • Goat entity : !player (You can also put the name of another entity or NPC)

The last thing to do is to be sure that in the flags, the case "Repeatable" is checked and the other don't.

III - Defining the NPC spawner

Okay so now we have an aiscripted_schedule who will order the Template NPC to search the player ! But there is still something who is missing... You don't have any idea ? Well, how are we going to spawn an npc if there is no any npc_template_maker on the map ? The answer ; Create a npc_template_maker !

So now let's stop joking and finish the job we started here. Create somewhere a npc_template_maker this is where the NPC will spawn) and write the name of your Template NPC in the field "Name of the Template NPC" (I may write NPC_Seeker). You can also configure the other options who fit you the best. When you have done, go to the Output Tab and add a new output with these parameters :

  • My output named : OnSpawnNPC
  • Targets entitie named : AISchedule_Seeker (the name of your aiscripted_schedule)
  • Via this Input : StartSchedule
  • With a parameter override of : *Leave Blank*
  • After a delay in seconds of : 0

Conclusion :


Once you finish that, then congratulation ! You may now have NPCs searching you in the whole map ! If you want to see what does it looks like in-game, I use this method in a map of Alien Wave called "Frozen Hell". You can download this mod at my website (section "Mods)". Anyway, I hope this tutorial would have been helpful for the community of Source mappers !

- Bioko

Post comment Comments
Hedgepig23 Nov 18 2010 says:

Cheers for the tutorial... but how do you make custom models? (people, guns, cars, etc.)

+2 votes     reply to comment
audryzas Nov 19 2010 replied:

How else...modeling.

+4 votes     reply to comment
MattB1023 Nov 19 2010 replied:

You can use many programs, such as 3ds Max, Blender, Maya, Softimage XSI, Houdini3d, Z-brush, and\or Mudbox.
I use 3ds Max and Mudbox.

+3 votes     reply to comment
Hedgepig23 Nov 19 2010 replied:

Cheers mate, I'll have a go at that.

+2 votes     reply to comment
SteveZombie Nov 19 2010 replied:

There are great tutorials on here that can help.

+2 votes     reply to comment
DarkPivot Nov 19 2010 says:

Great tutorial, it worked. :D I have a question though. I have a staircase in my map, and whenever I go up the staircase, if there are zombies on the bottom, they just either try walking straight towards me going under the staircase, or just turn around and walk away. How do I fix this?

+2 votes     reply to comment
Bioko Author
Bioko Nov 20 2010 replied:

Well, are you sure that you correctly placed the nodes ?

+2 votes   reply to comment
xweert123 Jul 12 2012 replied:

NPC's dislike climbing up stairs, you should place a clip that ramps up the staircase, so zombies can climb up it alot easier, it'll also work alot easier for your info_nodes. If you already have that clip, then i'm not sure what's wrong. D:

+1 vote     reply to comment
Filthma Mar 8 2011 says:

What program do you need to do this?

+2 votes     reply to comment
london_eye Apr 17 2011 replied:

hey you need source sdk you can get it free with any source game you get on steam

+2 votes     reply to comment
SPY-maps May 1 2011 says:

great tut, i use it for years in my sp-maps.

one small remark though, you don't need to add a npc_template_maker. you can also just add a npc itself to the map and add his name as name to the Target NPC field.

it makes combats all the more interesting because now you are sure the enemies will attack the player, without this scripting in a lot of cases combines and other npc's just walked away in a different direction when they didn't see the player anymore.


+2 votes     reply to comment
Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Apr 1, 2008
Open to all members
Send Message
Join this group
Group watch
Start tracking
Related Games
Half-Life 2
Half-Life 2 First Person Shooter
Related Groups
France Geographic with 292 members
Level Design Group
Level Design Group Hobbies & Interests with 616 members