Wise
12-10-13, 10:10 PM
Hello, I tried to find a guide How to make teleport NPC via SQL, that will work with the latest Trinity DB. My searching was unsuccessful. So i decided to make a new one by myself.
I will show you how to make Teleport NPC from the scratch via SQL step-by-step.
What we need:
1.) Trinity Compiled Server or Repack (If you want to test the Teleport NPC by yourself)
2.) Trinity Database (version 335.52) >>> DOWNLOAD (http://trinitycore.org/f/files/file/5-tdb-full-updates/)
3.) SQL Editor Tool - I use SQLyog, but you can also use HeidiSQL or Navicat or whatever, it doesn't really matter. >>>DOWNLOAD SQLyog (http://code.google.com/p/sqlyog/downloads/detail?name=SQLyog-11.2.5-0.x86Community.exe&can=2&q=)
4.) Truice - Trinity database tool for creating NPCs, Items, Quests, GObjects. >>>DOWNLOAD (http://fbe.am/o5C)
5.) Event Horizon - Smart AI creating and editing tool. Very user-friendly interface.>>>DOWNLOAD (http://www.mediafire.com/download/nbhxmlla0a5gi5q/Event.Horizon.SAI+Editor.121.zip)
Okay, so let's say that you have all the things installed, your SQL server is running and you are ready to go. So we can begin.
Step 1 - Create NPC
At first you must create the NPC, which will teleport you. Open the Truice and connect to your database. At the top of the window which appeared, click on the "Creature" tab.
Now at the bottom of the window click on "New Creature"
Suddenly, a wild window with many boxes appeared. You don't need to understand them all, all you need to change is below.
Now take a look at the numbers, which you need to change.
1 - Entry - Use an empty entry in your database.
2 - Name - Use name on your own.
3 - Model ID - This is how the creature will look like. For example, display id of Medivh is 18718. You can find the NPC's display id by typing ".npc info"
4 - Level - It doesn't really matter what level you use.
5 - Unit Class - Set it to 1 (warrior) to prevent DB errors.
6 - Faction - This is how the creatures reacts to each other and to players. Set both faction_A and faction_H to 35, so the creature will be friendly to both factions.
7 - NPC Flag - Set it to 1, so the creature can use gossip.
8 - Unit Flag - Set it to 4, so the creature will not move.
9 - AI Name - Set it to SmartAI, so the creature can use Smart AI.
10 - Gossip Menu ID - Set it to 60000, I will explain this later. (ID 60000 should be empty by default in DB)
Now click in the right bottom corner at "Show Creature Template Script". Now you can manually copy-paste the script into your SQLyog or whatever you use or just click "Execute Script" in the right bottom corner and this will copy the NPC into your database. You should see a massage "Script executed successfully". If you don't, then you probably typed something wrong.
We are done with creating NPC. Now open your SQLyog or whatever you use.
Step 2 - Create Gossip
1.) At first we must create, what will the creature say, when you right-click on it.
In SQLyog or whatever you use, open npc_text table, insert a new row with ID 60000 and text0_0 write whatever you want. In SQLyog, you have to uncheck the "Set Null" in the text window to start typing.
2.) Now open the gossip_menu table. This table connects the creature_template with the gossip. Insert a new row with entry which you wrote to truice (60000) and text_id is the id from npc_text table, so set it to 60000.
Now the creature will say the text when you right-click on it.
Step 3 - Create Gossip Options
Open the gossip_menu_option table and insert new row.
menu_id is the id from gossip_menu table, set this to 60000. If you want to create more gossip options at 1 NPC, they will all have the same number.
id is the unique number according to each menu_id, set this to 1. If you want to create more gossip options at 1 NPC, they will all have a unique number. If you want to create next gossip option, then the number will be 2, if next, the number will be 3 and so on........
option_icon is what the gossip_option icon will look like, here are some of them:
White chat bubble - 0
Brown bag - 1
Flight - 2
Book - 3
Interaction wheel - 4
Interaction wheel - 5
Brown bag with yellow dot - 6
White chat bubble with black dots - 7
Tabard - 8
Two swords - 9
Yellow dot - 10
option_text is what the gossip option says. We will create a teleport to Stormwind, so write something like "Teleport to Stormwind!"
option_id - I can't explain this, set it to 1.
npc_option_npcflag - Set this to 1 too.
Now you have the gossip_option on which you can click. But since it's only option, it will don't do anything, so we need to add a teleport script to it.
Step 3 - Create Teleport Script
Open the Event Horizon and connect to your DB.
1.) Write the Entry of the Teleport NPC to the upper left corner. When it loads, make sure that the text under the NPC name is green and says "Smart AI is enabled" or the teleport will dont work.
2.) Click on Prepare New. Script Description is only for description, it does not affect how the script will work. Write something like Teleport to Stormwind!
3.) In On Event box choose GOSSIP_SELECT (or write 62 where is 0), so the script will be execute when you click on gossip. Now the 2 options in the right part appeared. We must set on which gossip option will the script execute. Menu Id is the menu_id from gossip_menu_option table, set it to 60000. Action ID is the id from gossip_menu_option, set it to 1
4.) In Do Action box choose TELEPORT (or write 62 where is 0), so when you click the gossip, it will teleport you. Now in the right part 1 option appeared. Map ID is the id if the map to which you want to teleport. You can find the Map ID by typing .gps in game.
Eastern Kingdoms - 0
Kalimdor 1
Outland 530
Northrend 571.
5.) In At Target box choose ACTION INVOKER (or write 7 where is 0), so when you click the gossip, it will teleport the player who clicked on the gossip (you). Now you must write the teleport coordinates somewhere. The X Y Z coordinates + orientation will be written to the last 4 boxes in the right part (Target Tab). Take a look at THIS (http://imageshack.us/a/img694/1858/zgyu.jpg). The coordinates of Stormwind (Trade District) are X: -8832 Y: 630 Z: 94 Orientation: 0
Orientation is: North - 0 West - 1,5 South - 3 East - 4,5
6.) Now click on Save New and the script should appear in the big box with title "Teleport to Stormwind" or whatever you typed to description. The script is now saved to your DB (smart_scripts table)
Now restart your server and try if it works. If not, then check every step you made.
Adding More Teleports
If you want to add more teleports to the Teleport NPC, then follow these steps.
1.) Insert new row into gossip_menu_option , since we want create more teleports in this menu, the menu_id will be 60000.
The id must be unique with each menu_id, so if you set "Teleport to Stormwind" id 1, then this id will be 2.
Set text to whatever you want, it depends on the teleport destination.
Dont forget to set the option_id and npc_option_npcflag to 1 or your gossip will not work.
2.) Head to the Event Horizon, open the Teleport NPC if you already dont have.
Then click on the "Teleport to Stormwind" script in the big white box, then click to Duplicate.
Now in the "Parameters" Part, Event tab change Action ID to 2, since you want to create script for the second gossip option.
Click on the Action tab and set the Map ID.
Then click on Target tab and change current coordinates to desired coordinates where you want to teleport.
Now click on the Save New, if you clicked on Duplicate before changing these datas, it should create a new script. If you did not, you will edit the current script.
Now restart your server and try if this one works too.
This guide was created by ShadowRaider
I will show you how to make Teleport NPC from the scratch via SQL step-by-step.
What we need:
1.) Trinity Compiled Server or Repack (If you want to test the Teleport NPC by yourself)
2.) Trinity Database (version 335.52) >>> DOWNLOAD (http://trinitycore.org/f/files/file/5-tdb-full-updates/)
3.) SQL Editor Tool - I use SQLyog, but you can also use HeidiSQL or Navicat or whatever, it doesn't really matter. >>>DOWNLOAD SQLyog (http://code.google.com/p/sqlyog/downloads/detail?name=SQLyog-11.2.5-0.x86Community.exe&can=2&q=)
4.) Truice - Trinity database tool for creating NPCs, Items, Quests, GObjects. >>>DOWNLOAD (http://fbe.am/o5C)
5.) Event Horizon - Smart AI creating and editing tool. Very user-friendly interface.>>>DOWNLOAD (http://www.mediafire.com/download/nbhxmlla0a5gi5q/Event.Horizon.SAI+Editor.121.zip)
Okay, so let's say that you have all the things installed, your SQL server is running and you are ready to go. So we can begin.
Step 1 - Create NPC
At first you must create the NPC, which will teleport you. Open the Truice and connect to your database. At the top of the window which appeared, click on the "Creature" tab.
Now at the bottom of the window click on "New Creature"
Suddenly, a wild window with many boxes appeared. You don't need to understand them all, all you need to change is below.
Now take a look at the numbers, which you need to change.
1 - Entry - Use an empty entry in your database.
2 - Name - Use name on your own.
3 - Model ID - This is how the creature will look like. For example, display id of Medivh is 18718. You can find the NPC's display id by typing ".npc info"
4 - Level - It doesn't really matter what level you use.
5 - Unit Class - Set it to 1 (warrior) to prevent DB errors.
6 - Faction - This is how the creatures reacts to each other and to players. Set both faction_A and faction_H to 35, so the creature will be friendly to both factions.
7 - NPC Flag - Set it to 1, so the creature can use gossip.
8 - Unit Flag - Set it to 4, so the creature will not move.
9 - AI Name - Set it to SmartAI, so the creature can use Smart AI.
10 - Gossip Menu ID - Set it to 60000, I will explain this later. (ID 60000 should be empty by default in DB)
Now click in the right bottom corner at "Show Creature Template Script". Now you can manually copy-paste the script into your SQLyog or whatever you use or just click "Execute Script" in the right bottom corner and this will copy the NPC into your database. You should see a massage "Script executed successfully". If you don't, then you probably typed something wrong.
We are done with creating NPC. Now open your SQLyog or whatever you use.
Step 2 - Create Gossip
1.) At first we must create, what will the creature say, when you right-click on it.
In SQLyog or whatever you use, open npc_text table, insert a new row with ID 60000 and text0_0 write whatever you want. In SQLyog, you have to uncheck the "Set Null" in the text window to start typing.
2.) Now open the gossip_menu table. This table connects the creature_template with the gossip. Insert a new row with entry which you wrote to truice (60000) and text_id is the id from npc_text table, so set it to 60000.
Now the creature will say the text when you right-click on it.
Step 3 - Create Gossip Options
Open the gossip_menu_option table and insert new row.
menu_id is the id from gossip_menu table, set this to 60000. If you want to create more gossip options at 1 NPC, they will all have the same number.
id is the unique number according to each menu_id, set this to 1. If you want to create more gossip options at 1 NPC, they will all have a unique number. If you want to create next gossip option, then the number will be 2, if next, the number will be 3 and so on........
option_icon is what the gossip_option icon will look like, here are some of them:
White chat bubble - 0
Brown bag - 1
Flight - 2
Book - 3
Interaction wheel - 4
Interaction wheel - 5
Brown bag with yellow dot - 6
White chat bubble with black dots - 7
Tabard - 8
Two swords - 9
Yellow dot - 10
option_text is what the gossip option says. We will create a teleport to Stormwind, so write something like "Teleport to Stormwind!"
option_id - I can't explain this, set it to 1.
npc_option_npcflag - Set this to 1 too.
Now you have the gossip_option on which you can click. But since it's only option, it will don't do anything, so we need to add a teleport script to it.
Step 3 - Create Teleport Script
Open the Event Horizon and connect to your DB.
1.) Write the Entry of the Teleport NPC to the upper left corner. When it loads, make sure that the text under the NPC name is green and says "Smart AI is enabled" or the teleport will dont work.
2.) Click on Prepare New. Script Description is only for description, it does not affect how the script will work. Write something like Teleport to Stormwind!
3.) In On Event box choose GOSSIP_SELECT (or write 62 where is 0), so the script will be execute when you click on gossip. Now the 2 options in the right part appeared. We must set on which gossip option will the script execute. Menu Id is the menu_id from gossip_menu_option table, set it to 60000. Action ID is the id from gossip_menu_option, set it to 1
4.) In Do Action box choose TELEPORT (or write 62 where is 0), so when you click the gossip, it will teleport you. Now in the right part 1 option appeared. Map ID is the id if the map to which you want to teleport. You can find the Map ID by typing .gps in game.
Eastern Kingdoms - 0
Kalimdor 1
Outland 530
Northrend 571.
5.) In At Target box choose ACTION INVOKER (or write 7 where is 0), so when you click the gossip, it will teleport the player who clicked on the gossip (you). Now you must write the teleport coordinates somewhere. The X Y Z coordinates + orientation will be written to the last 4 boxes in the right part (Target Tab). Take a look at THIS (http://imageshack.us/a/img694/1858/zgyu.jpg). The coordinates of Stormwind (Trade District) are X: -8832 Y: 630 Z: 94 Orientation: 0
Orientation is: North - 0 West - 1,5 South - 3 East - 4,5
6.) Now click on Save New and the script should appear in the big box with title "Teleport to Stormwind" or whatever you typed to description. The script is now saved to your DB (smart_scripts table)
Now restart your server and try if it works. If not, then check every step you made.
Adding More Teleports
If you want to add more teleports to the Teleport NPC, then follow these steps.
1.) Insert new row into gossip_menu_option , since we want create more teleports in this menu, the menu_id will be 60000.
The id must be unique with each menu_id, so if you set "Teleport to Stormwind" id 1, then this id will be 2.
Set text to whatever you want, it depends on the teleport destination.
Dont forget to set the option_id and npc_option_npcflag to 1 or your gossip will not work.
2.) Head to the Event Horizon, open the Teleport NPC if you already dont have.
Then click on the "Teleport to Stormwind" script in the big white box, then click to Duplicate.
Now in the "Parameters" Part, Event tab change Action ID to 2, since you want to create script for the second gossip option.
Click on the Action tab and set the Map ID.
Then click on Target tab and change current coordinates to desired coordinates where you want to teleport.
Now click on the Save New, if you clicked on Duplicate before changing these datas, it should create a new script. If you did not, you will edit the current script.
Now restart your server and try if this one works too.
This guide was created by ShadowRaider