[Show Table of Contents]

Created on 5-11-2006
Last Updated: 5-12-2006
Author: PepsiCola

§How to create NPCs

  • In this article I will explain 2 ways on how to populate a zone with NPCs. In this tutorial, we will go through and populate tutoriala zone with 2 npcs as an example. You can apply the same techniques described here to any zone you like. The tutoriala zone was chosen because its fairly small and also since this is a tutorial after all, why not use a tutrial zone for this example.


1. Have a working EQEmu setup. (This guide assumes that you have version 0.7.0 of EQEmu with Cavedude's database installed and working).
2. A front end for MySQL. I recommend installing Navicat MySQL. You can download it from http://www.navicat.com∞ or here∞ for direct download. In this tutorial we will be using Navicat to edit the database.
3. It is recommended that you read through the entire tutorial before starting out so that you can familiarize yourself with it.

§Setting up Navicat

To setup Navicat, simply launch the executable. After installing it, run Navicat. Now we need to setup a connection, to do that, click on the Connection button on the toolbar. You will get a dialog box named [Connection]. In Connection Name enter any name you want. I usedEQEmu. In Host name/IP address and Port enter either the host name or IP address and port number that you used when setting up your server. For User name and Password enter the user name and password that you used to setup your eq database. If you don't want to type in your password everytime you use Navicat to connect to the database, you can leave the Save password check box checked. Now press the Test Connection button to test out your connection. Note: If you get an error when testing your connection, make sure that you have MySql running. If it is running and you still get an error, make sure that you have entered all your information correctly. If everthing is good, exit Navicat, and we are ready to move on!

§Setting up the zone

If you have not done so already, go ahead and run the emu and create a character. Once you have done that, exit out completely. Now that you have created a character, you will need to edit the character_ table to place your character in the tutoriala zone. The first thing you need to check is to see if that zone is already created. To do that, launch Navicat. On the left hand side of the screen, you will see an icon with the name of your connection that you specified earlier with a red lightning bolt. Simply click on that and the lightning bolt should gogreen. Then click on the grayed out cylinder with the name of your eq database; it should also go green, and the list of tables should appear on the right hand side. Now, double-click on the zone table to open it up. Go ahead and maximize the window by clicking on the box icon on the title bar of the window. What we are going to do is make sure that the tutoriala zone exsist in the table. To do that, I'm going to show you how to search for it. (This will come in handy later. Thats is why I want to show you how to search. You can thank me later.) To perform a search, click on the Filter Wizard button on the toolbar at the top. You should see a new box open up across the top of the screen. Click on . You will notice that the name of the first column in the table is listed there. If you want to perform a search in a different column, you would simply click on the column name in red and select a new column. But that will not be neccessary because we want to perform a search in the short_name column. So, make sure that short_name is selected. Now, if you wanted to change the search criteria, than you can selcect another by clicking on contains. But that will not be neccessary. Make sure its on contains. And for the last part, click on , and enter the shortname of the zone. Since we are using tutoriala, simply enter in tutoriala in the box and press enter, or click on the green box with the arrow in it to close it out. To perform the search, make sure that the check box in front of the search criteria is checked, and either click on or press CTRL+R on your keyboard to perform the search. Now if all is good you should see tutoriala in the table along with all its data. There are 2 things that I want to point out before we move on. First, scroll to the right and find the zoneidnumber and write it down somewhere, it should be listed as 188, also, note the safe_x, safe_y, safe_zvalues. And second, to save you a headeache later, make sure that the value in underworld is set to -10000. To do that, double-click and edit the value, then click the black checkmark that is located on the bottom-left corner of the window to save your changes. Then close the window and go back the the main screen. So, you are probably wondering as to why you had to change that. I will tell you. If you were to place your character in the zone, you would get an error and the client will try to respawn you to the safepiont in the zone and it would loop indefinetly. That is because if you left underworld set to 1000, it would try to respawn you to location 0, 0, 0; and since 0, 0, 0 is less than 1000, it thinks that you are spawning underneath the zone and you would get a nasty error. Anyway, its a long explanation, so lets move on!

§Adding Your Character to the Zone

Ok, now that we have verified and tweaked the 'tutoriala' zone, we are ready to add your character to it. To do that, we will need to make some changes in the 'character_' table. So, go ahead and open up the 'character_' table. Now find your character that you created and edit the following values:

  • Edit the x y z values to reflect the safe values from the zone. Since they were all 0 (zeroes), just change them to that.
  • Change the zonename to tutoriala.
  • Change the zoneid to 188

Once again, these values can be obtained from the zone table. Now, save your changes and exit Navicat. Go ahead and launch the EQEmu and run the game, select your character and enter the zone. You should now be in the empty tutoriala zone!

§Adding the NPC

Finally we have reached the main section of the tutorial. This is where things get interesting. Now, we are going to add a npc to the zone for you to interact with. Before we go ahead and add a npc, we need to determine as to what race, class, model, texture, etc. of the npc we want to add. So, since there is not an updated list of ids used, you can simply search the forums, or refer to the outdated EQEmu Guidebook∞.

The first thing to add an npc, we need to create a dummy npc that we will place in the zone. If you are still in the emu, logout, and shut down the emu. Make sure that MySql is still running, and launch Navicat. We will be adding information to 4 (four) different tables to successfully add an npc. (Note: This is one way of adding an npc. Read below for the second way to add a npc. I will be working on an application that will make adding npcs a breeze, but for the mean time this is the manual way of doing it.) The table that we will be editing are the following:

npc_types: This is where we add the npc and specify there name, last name, level, gender, etc.
spawn2: This is where we assign a spawngroupID, the zone to add him to, and the x y z coordinates that will place him in the zone.
spawngroup: This is where we assign a npc to a spawn group. That is how they spawn within the zone. More than one npc can be assigned to a spawn group. For example a magician and his pet can spawn together if they are placed in the same spawn group.
spawnentry: This is where we specify which group to spawn and the spawn chance for the npc to 'pop'. For example, if you had 2 different npcs that you wanted to spawn radomly, you can assign them to a group, and give them a spawn chance of 50 to each npc. That tells us that they have a 50/50 chance of spawning to a specific location.

§npc_types table

So, first things first. Since we are working on the tutoriala zone, we are going to add Arias. So with Navicat already running, open up the npc_types table. Now, we are going to assign him an id. To do that, we need to make sure that we give him an id that is not in use. Here is a good way to come up with an id for a npc. I would create a 6 digit id for my npc and break it down as follows:

The first 3 digits, I would use the zone id. That way, if we are working on a zone, we can easily search for what npcs are in a zone by using the begin with filter in Navicat.
The last 3 digits would be there sequential number for the npc.

So, for this example, we know that we are going to add a npc to the tutoriala zone. We know that the id for the zone is 188 so the first three digits of his id would be 188. And since we know that this is the first npc we are going to add, we will number him 001. Therefore the complete id for Arias would be 188001. Now, we need to make sure that this id is not in use, so go ahead and perform a search and see if there is an id of 188001 in the npc_types table. If all is well, you should not get anything to pop up. Now we will go ahead and enter in some data for him. Go ahead and click on the black + (plus sign) that is located on the bottom left hand corner of the screen, and under id, enter in 188001 then enter the following information as follows by tabbing over to the following boxes and entering in the data:


  • name - Arias (To enter data to the name field, you will notice that the field is a memo. Just click on the Memo button on the toolbar at the top of the page and a box sould open up at the bottom of the page. Just enter his name there.
  • level - 5
  • race - 2
  • class - 1
  • bodytype - 1
  • hp - 75
  • gender - 0
  • texture - 0

This is the minimum amount of data for now that we will need. Go ahead and save the data by clicking on the black check mark located on the bottom left corner of the screen.

§spawn2 table

Now we will add a spawn entry to the spawn2 table. Close out of the npc_types table, and open up the spawn2 table. Now we need to make create a spawngroupID for our newly created npc. We will follow the same syntax as before; the first 3 digits will be the zone id, 188 and the last 3 digits will be the sequential order of the spawngroup. Since this is the first spawngroup for the tutoriala, we will use 001. Go ahead and do a search for the spawngroupID of 188001. If all is well, you should get nothing in return. Now we are ready to add the new entry to the table. Go ahead and enter in the following information as follows:

  • spawngroupID - 188001
  • zone - tutoriala
  • x - 0
  • y - 0
  • z - 0
  • heading - 0

This is the minimal data we need for now. Go ahead and save the changes. You might have noticed that we skipped the id column. Do not worry. All you need to know is that its automatically generated.

§spawngroup table

Now for the spawngroup table just enter the following:

id - 188001 (this is the spawngroupID from above. It goes here.)
name - tutoriala188001 (this is the name of the zone with the spawngroupID combined)

Save your changes and close out the table.

§spawnentry table

For the final table, spawnentry enter the following:

  • spawngroupID - 188001 (Self-explanatory)
  • npcID - 188001 (This is the npcID that we created for Arias from the npc_types table.)
  • chance - 100 (This number tells us that he has a 100% chance of spawning everytime you go into the zone.)

Save your changes and close out the table.

Now you have entered all the data that you need to successfully create an npc. Now, for the moment you have been waiting for, go ahead and launch the emu and log in, select your character and enter the zone. Depending on where you camped, you might need to walk around and find your friend in the zone!

§Placing the NPC

So, you are probably wondering on what to do next. Now that you know that he is there, I'm going to show you how to reposition him to a place where you want him to be.

First, target him.
Go to a location within the zone where you want him to be. The place where you stand and the direction in which you are facing will become his new location where he will spawn.
Type the following command in the main chat window: #spawnfix. You will notice that he will disappear, and that Updating coordinates successful. will appear in the main chat window. To make him reappear, first move out of his way, then use the following command to re-populate the zone: #repop.

Now he should re-appear where you were last standing. You can edit the npc by using the #npcedit command. For information on that, type #npcedit help.

§Adding the second NPC from within

Here is another way that you can add an npc from within the game. For that, you will need to use the #spawn command. Here is the syntax:

#spawn [name] [race] [level] [material] [hp] [gender] [class] [priweapon] [secweapon] [merchantid]

  • [name] - Self-explanatory. You will notice that if you have spaces in a name, you will need to replace them with an _ (underscore). Otherwise the name will break off at the first space.
  • [race] - The code for the race can be obtained from the EQEMu Guide shown above. The guide is outdated but its still useful.
  • [level] - Self-explanatory.
  • [material] - This refers to the texture of the model. See the EQEmu Guide.
  • [hp] - Self-explanatory.
  • [gender] - 0 = male, 1 = female, 2 = neutral.
  • [class] - Self-explanatory. See the EQEmu Guide.
  • [priweapon] - Self-explanatory. See the items table in the eq database.
  • [secweapon] - Self-explanatory. See the items table in the eq database.
  • [merchantid] - This is where you assign a merchantid if he is a vendor.

So, to add The Gloomingdeep Jailor, type in the following in the main chat window:

#spawn The_Gloomingdeep_Jailor 455 1 1 1 2 1

Now, you will need to add the npc to the tables in the eq database. To do that, make sure that your newly created npc is targeted, and use the following command:

#npcspawn create
Next time you enter the zone, your newly created npc should spawn right where you placed him.

Then you can use the #spawnfix to relocate the npc, and #npcedit to edit it to your satisfaction.


To wrap it up, I have showed you 2 ways on how to add npcs to a zone. All you have to do now is add in some perl script for some quest data and you are ready to rock 'n roll!

I hope that this guide has come in handy. If you have any questions or comments, you can PM me.