Creating a custom Vendor NPC MaNGOSZero
Recently I have been lurking around the web and have started to notice more and more vanilla emu servers are being created, some with custom content and some without. I would like to see more with LOADS of custom stuff. And so I hope that, by writing this tutorial, I can help inspire more people to dabble in the wonderful world of Emulator servers and custom content! This tutorial is written with a MaNGOSZero DB in mind, and I'm sure you guys and girls are smart enough to adapt it to suit your various needs. This tutorial assumes you have a server up and running. With that intro out of the way, lets get to making a vendor!
Step One
You will require a database editor (I use HeidiSQL): HeidiSQL - MySQL made easy
It is a self-explanatory installation.
Step Two
Make a new connection and connect to your database using your MySQL login information. ~MAKE SURE MYSQL IS RUNNING~
(Username: root Password: ascent) <- If you don't know the info then this is probably it.
Step Three
You should have a bunch of databases available once you have connected. We are focusing on the 'mangos' one for now. Double click on it and look for the table called 'creature_template'.
Now, to the right of this you will see all sorts! Look at the tabs and open the one labelled Data.
Step Four
Now you should see the creature_template table. As you can see there are lots of columns, for now let's focus on the first 5 (ignoring KillCredit 1 and 2).
Code:
`entry` - This can be any number you want, so long as it is unique. <- NOTE DOWN THIS NUMBER
`modelid_1` - This is the display model of the creature (in this case 10913... a kobold vermin id)
`modelid_2` - See above
`name` - This is the name of your vendor (Dirty Gerty, for me)
`subname` - This is the text that appears <Like This> under the creature's `name`
Step Five
Next up are the stats/factions and flags.
Code:
`minevel` - The creature's minimum level.
`maxlevel` - The creature's maximum level.
`minhealth` / `maxhealth` - As with the mana, you can figure this out. If you feel lost as to what figures to use, take a look at an NPC around the same level.
`faction_A` - The faction of the creature towards Alliance players. 80 is friendly to A and Hated to H.
`faction_H` - The faction of the creature towards Horde players. 412 is friendly to H and hated to A.
`npcflag` - All vendors need to have their flag set to 4 (dont ask me why :P )
Step Six
Scrolling far to the right now we can find the columns AIName, MovementType and InhabitType.
Set them to EventAI, 1 and 3 (respectively).
Movement type decides whether or not the mob wanders nearby or stands dead still. Set it to 0 to have the mob stand on one spot.
Step Seven
Adding the sweet items, eh? EH? Right.
Remember the first screenshot? Where you clicked on "creature_template" and then the Data tab? Well do the same thing but this time, instead of "creature_template" - click on "npc_vendor".
Here is where you add the entries regarding what items you want your vendor to sell.
Code:
`entry` - The unique entry of your vendor.
`item` - The entryID of the item you want the NPC to sell. (the same entryID used when you .additem)
`maxcount` - The maximum number of item the vendor can sell at a time, leave 0 for infinite.
`incrtime` - The time it takes to restock the item (in seconds)
You will have to create a new row for each item you want the NPC to sell. If you want them to sell 10 items then make 10 rows with different `item` ids.
Step Eight
Login to your server and spawn the vendor using the custom entry you gave them. ( .npc add customid 1 )
Enjoy your custom vendor!
****************
I hope this tutorial helped someone take their first steps into custom emu content. /wave
Oh and here is the SQL for the vendor I made as an example, a Kobold Tradesman named Dirty Gerty. He sells some basic blizzlike items - feel free to use him, although if you do, a thanks in this thread would be appreciated