Heres summut thats my way to say hello to the mmowned.com community
Ok so i am fully aware there are many guides on how to make a teleporter npc so dont flame me about it. I am making this guide because i feel that all other guides tell noobs (like me) very little. This guide will teach you:
1. How to make a custom NPC
2. How to turn your custom NPC into a teleporter
i hope this guide helps
1. How to make a custom NPC
Npc's are made with sql using a sql program. for this guide i will be using heidisql but it should be very similar for navicat, sqlyog etc...
step 1: connect
First open your sql program and you should be prompted to login with your sql username and password this is all pretty self explanatory so login and double click on world and then double click on creature_names then click on on Data at the top.
BTW if you cant translate this into your sql program type into google heidisql and download and install it
Step 2: Make a new npc
press the + button and a new line will pop up! there are boxes and now you need to fill them in so here is what to do with each box:
entry: This is what number you will type ingame to spawn your npc. we are going to use 60 (make sure 60 is not already in use on your server. do this by going ingame and typing: .npc spawn 60 if a npc comes choose a different number. BE SURE TO REMEMBER THIS NUMBER!
name: Type in a name you want to call your npc this is the name you will see ingame this name does not matter. but if you are following me i am gonna use: teleporter
subname: this is the name that will appear under the name you choose e.g. <King of Stormwind>
info_str: type 0
Flags1: 0 once again
type: 7
family: 0
rank: 3
unk4: 0
spelldataid:0
maledisplayid-female_displayid2: there are 4 here male female male 2 female 2 if you want your npc to be female put a display id in the female id 1 and put 0 in all others same for male btw only fill in one of these boxes. so if you want a male put it in male display id and female into femaledisplayid Also to find out a display id go ingame and find the npc you want your teleporter npc to look like and click it and type .npc info and scroll up in chat panel till you find display id: 00000 IT IS NOT ENTRY ID!!!
unknown float1-2: 0 in both of them
civilian: 0
leader: 0 ok and then press the tick
step 3: creature_proto
This bit you have to switch database still in the world bit click on creature_proto and go to data again.
right first off this guide is about the teleporter npc and im not gonna go through all this it will take too long XD
hopefully creature proto is easy just click the + again and fill everything in and click the tick i will give you the important stuff here however if you cant do this. when you make a new one this first box is entry id type in the one you did in creature_names set the faction to 121 set the flags to 1 everything to do with ranged type a 0 and auras are to be set to (MEMO) so dont worry if you cant change it
2. How to turn your custom NPC into a teleporter
This is the lua scripting part open up notepad or a mac/linux equivelant oh and by the way this guide will have a complete lua script at the end if you cant do this bit
step 1
to start off add this into your notepad
Code:
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player , 0)
this creates a text menu which tells the npc to open when you click on him now comes the bit where you add the thingies you can press. we are going to make a very simple lua teleporter just so you get the hang of it so we are going to have two menus called:
Alliance cities
Horde Cities
you add them by typing this
Code:
unit:GossipMenuAddItem(2, "Alliance Cities", 1, 0)
unit:GossipMenuAddItem(2, "Horde Cities", 2, 0)
The blue bits are the names of the menus that are being created
These are the menu numbers make sure you dont have 2 of the same menu numbers
now under this write
Code:
unit:GossipSendMenu(player)
end
you should now have
Code:
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player , 0)
unit:GossipMenuAddItem(2, "Alliance Cities", 1, 0)
unit:GossipMenuAddItem(2, "Horde Cities", 2, 0)
unit:GossipSendMenu(player)
end
ok so this next section im gonna be pretty vague just write this also if you want to add more menus you have to add them to everything we did above and the bit im about to show you
Code:
function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 999) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(2, "Alliance Cities", 1, 0)
unit:GossipMenuAddItem(2, "Horde Cities", 2, 0)
unit:GossipSendMenu(player)
end
Now to program the menus. Remember those menu id sorta things i showed you before the blue numbers? Well that was your menu id you program the menu with that number so i made alliance cities to be number 1 and horde to be 2 so i want it so when someone clicks alliance cities they go to a menu with different cities to go to so you should type
Code:
if(intid == 1) then
unit:GossipCreateMenu(3543, player, 0)
Now then you need to add the locations that bit of code up there told the script where to add the locations so now we add each location type:
Code:
unit:GossipMenuAddItem(1, "Stormwind", 300, 0)
unit:GossipMenuAddItem(1, "Ironforge", 299, 0)
unit:GossipMenuAddItem(1, "Darnassus", 298, 0)
unit:GossipMenuAddItem(1, "The Exodar", 297, 0)
that will add the options for stormwind ironforge darnasses and the exodar after this type
Code:
unit:GossipSendMenu(player)
end
Now we program the horde cities:
type
Code:
if(intid == 2) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(1, "Orgrimmar", 296, 0)
unit:GossipMenuAddItem(1, "Thunderbluff", 295, 0)
unit:GossipMenuAddItem(1, "Undercity", 294, 0)
unit:GossipMenuAddItem(1, "Silvermoon", 293, 0)
unit:GossipSendMenu(player)
end
that tells the script to go to menu 2 which is horde cities and to add org thunderbluff undercity and silvermoon and options to the menu now you may notice numbers after every city we have added. those are menu numbers too! so now we are going to program stormwind so when you click it you get sent (teleported) to stormwind we used the id 300 for stormwind so we type
Code:
if(intid == 300) then
player:Teleport(0, -8909.770508, 554.128418, 93.652893)
unit:GossipComplete(player)
end
you will see alot of numbers in this bit these are the co-ords to tell the server where to send you. you find these co-ords by going to where you want to be ported and type:
the order in which the numbers are in is this
map id, x, y, z
now you need to do this for every place you made but instead of having if(intid == 300) then you need if(intid == menu id for the city you want) then
once you have done them all type end and the one more end to show the end to the script
now there are 2 more lines of code to get you brain around XD
type this
Code:
RegisterUnitGossipEvent(ENTRY ID FOR THE NPC U MADE IN SQL, 1, "On_Gossip")
RegisterUnitGossipEvent(ENTRY ID FOR THE NPC U MADE IN SQL, 2, "Gossip_Submenus")
AND THATS IT!!!!! go to file>save as and make it all files and save it in your repacks script folder as teleport.lua
I hope this guide helped you! if you cant get around the lua bit which i dont blame you it is truely hard here is my script which all you need to do is copy and paste into notepad and save as teleporter.lua and still put in scripts
Code:
function On_Gossip(unit, event, player)
unit:GossipCreateMenu(3544, player , 0)
unit:GossipMenuAddItem(2, "Alliance Cities", 1, 0)
unit:GossipMenuAddItem(2, "Horde Cities", 2, 0)
unit:GossipMenuAddItem(2, "Custom locations- No PVP", 3, 0)
unit:GossipMenuAddItem(2, "Shattrah City", 4, 0)
unit:GossipMenuAddItem(2, "Dalaran", 5, 0)
unit:GossipMenuAddItem(2, "PVP Areas", 6, 0)
unit:GossipSendMenu(player)
end
function Gossip_Submenus(unit, event, player, id, intid, code)
if(intid == 999) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(2, "Alliance Cities", 1, 0)
unit:GossipMenuAddItem(2, "Horde Cities", 2, 0)
unit:GossipMenuAddItem(2, "Custom locations- No PVP", 3, 0)
unit:GossipMenuAddItem(2, "Shattrah City", 4, 0)
unit:GossipMenuAddItem(2, "Dalaran", 5, 0)
unit:GossipMenuAddItem(2, "PVP Areas", 6, 0)
unit:GossipSendMenu(player)
end
if(intid == 1) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(1, "Stormwind", 300, 0)
unit:GossipMenuAddItem(1, "Ironforge", 299, 0)
unit:GossipMenuAddItem(1, "Darnassus", 298, 0)
unit:GossipMenuAddItem(1, "The Exodar", 297, 0)
unit:GossipMenuAddItem(0, "[Back]", 999, 0)
unit:GossipSendMenu(player)
end
if(intid == 2) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(1, "Orgrimmar", 296, 0)
unit:GossipMenuAddItem(1, "Thunderbluff", 295, 0)
unit:GossipMenuAddItem(1, "Undercity", 294, 0)
unit:GossipMenuAddItem(1, "Silvermoon", 293, 0)
unit:GossipMenuAddItem(0, "[Back]", 999, 0)
unit:GossipSendMenu(player)
end
if(intid == 3) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(1, "Swimming pool & Cocktail bar", 292, 0)
unit:GossipMenuAddItem(0, "[Back]", 999, 0)
unit:GossipSendMenu(player)
end
if(intid == 6) then
unit:GossipCreateMenu(3543, player, 0)
unit:GossipMenuAddItem(1, "Gurubashi Arena - all vs all", 291, 0)
unit:GossipMenuAddItem(0, "[Back]", 999, 0)
unit:GossipSendMenu(player)
end
if(intid == 4) then
player:Teleport(530, -1830.723300, 5363.083008, -12.427780)
unit:GossipComplete(player)
end
if(intid == 5) then
player:Teleport(571, 5795.872559, 649.884888, 647.393494)
unit:GossipComplete(player)
end
if(intid == 300) then
player:Teleport(0, -8909.770508, 554.128418, 93.652893)
unit:GossipComplete(player)
end
if(intid == 299) then
player:Teleport(0, -4981.250000, -881.541992, 501.659973)
unit:GossipComplete(player)
end
if(intid == 298) then
player:Teleport(1, 9949.875977, 2402.067627, 1328.413086)
unit:GossipComplete(player)
end
if(intid == 297) then
player:Teleport(530, -3940.312500, -11813.802734, -25.711380)
unit:GossipComplete(player)
end
if(intid == 296) then
player:Teleport(1, 1502.709961, -4415.419922, 21.552200)
unit:GossipComplete(player)
end
if(intid == 295) then
player:Teleport(1, -1285.352539, 178.329681, 129.993958)
unit:GossipComplete(player)
end
if(intid == 294) then
player:Teleport(0, 1657.917725, 239.583572, 62.593163)
unit:GossipComplete(player)
end
if(intid == 293) then
player:Teleport(530, 9416.157227, -7279.041016, 14.202612)
unit:GossipComplete(player)
end
if(intid == 292) then
player:Teleport(0, -8042.347656, -283.876740, 281.279846)
unit:GossipComplete(player)
end
if(intid == 291) then
player:Teleport(0, -13228.653320, 233.191559, 33.278221)
unit:GossipComplete(player)
end
end
RegisterUnitGossipEvent(ENTRY ID FOR NPC U MADE IN SQL, 1, "On_Gossip")
RegisterUnitGossipEvent(ENTRY ID FOR NPC U MADE IN SQL, 2, "Gossip_Submenus")
Feel free to ask any questions about sql or lua and i will do my best to help
-Maceaxe