Jargs
09-05-2007, 04:39 PM
Written by Daikenkaiking
First off, lets get down to the basics of what you need:
1. A Custom Portal Added to the DB, with a Unique entry ( SQL at bottom of post )
2. Basic knowledge on how to use the GM Scripts, and how to add them to your server.
Lets Get Started!
We're going to be making a portal to the STV Arena as the example.
A Link in the CODE boxes with + in front of it means that line was added at this step.
First off, open up a Blank Document ( I recommend notepad, as it doesn't add any custom headers or other junk to the file ).
Lets Create a Function we can use to make the Portal.
global TELE_GURUBASHI = function(plr)
{
};What we are doing here is creating a basic function. This won't do anything until we add more stuff to it, so moving on...
We need to add the script to move the player to the location, this is done by the Teleport(); command.
global TELE_GURUBASHI = function(plr)
{
+ plr.Teleport(0, -13232.7, 219.565, 31.9761);
};A breakdown of the Teleport(); Function:
Teleport(mapid, x coord, y coord, z coord);
For the Gurubashi Arena, the coords are as follows:
MapID: 0
X: -13232.7
Y: 219.565
Z: 31.9761
This script still will not work, as we've not yet defined the GameObject Event to run the function, we'll do that now.
global TELE_GURUBASHI = function(plr)
{
plr.Teleport(0, -13232.7, 219.565, 31.9761);
};
+.RegisterGameObjectEvent(GO_ID, 2, TELE_GURUBASHI);You must replace GO_ID with the portal ID in your DB ( SQL is at the bottom ).
What this does, is when the portal is clicked, tells the server to run the TELE_GURUBASHI function, or the teleport player function.
This script is now operational. Optionally, you could add a message to the player, this could be done like the following:
global TELE_GURUBASHI = function(plr)
{
plr.Teleport(0, -13232.7, 219.565, 31.9761);
+ plr.SendSystemMessage("Welcome to the Gurubashi PvP Arena!");
};
.RegisterGameObjectEvent(GO_ID, 2, TELE_GURUBASHI);Now save this file as something.gm, such as "ArenaTele.gm" and add it to the "scripts" folder on your server. If there is not a scripts folder, create one. Then, either type reloadscripts in the console, or .reloadscripts InGame, and add the GO to the game, and click on it!
I hope someone finds this useful, and any problems, feel free to ask for help. :)
Portal SQL:
insert into `gameobject_names` (`entry`, `Type`, `DisplayID`, `Name`, `spellfocus`, `sound1`, `sound2`, `sound3`, `sound4`, `sound5`, `sound6`, `sound7`, `sound8`, `sound9`, `unknown1`, `unknown2`, `unknown3`, `unknown4`, `unknown5`, `unknown6`, `unknown7`, `unknown8`, `unknown9`, `unknown10`, `unknown11`, `unknown12`, `unknown13`, `unknown14`) values('500000','4','5231','Portal to Gurubashi Arena','0','0','1','0','0','0','0','0','0','0','0' ,'0','0','0','0','0','0','0','0','0','0','0','0',' 0');
First off, lets get down to the basics of what you need:
1. A Custom Portal Added to the DB, with a Unique entry ( SQL at bottom of post )
2. Basic knowledge on how to use the GM Scripts, and how to add them to your server.
Lets Get Started!
We're going to be making a portal to the STV Arena as the example.
A Link in the CODE boxes with + in front of it means that line was added at this step.
First off, open up a Blank Document ( I recommend notepad, as it doesn't add any custom headers or other junk to the file ).
Lets Create a Function we can use to make the Portal.
global TELE_GURUBASHI = function(plr)
{
};What we are doing here is creating a basic function. This won't do anything until we add more stuff to it, so moving on...
We need to add the script to move the player to the location, this is done by the Teleport(); command.
global TELE_GURUBASHI = function(plr)
{
+ plr.Teleport(0, -13232.7, 219.565, 31.9761);
};A breakdown of the Teleport(); Function:
Teleport(mapid, x coord, y coord, z coord);
For the Gurubashi Arena, the coords are as follows:
MapID: 0
X: -13232.7
Y: 219.565
Z: 31.9761
This script still will not work, as we've not yet defined the GameObject Event to run the function, we'll do that now.
global TELE_GURUBASHI = function(plr)
{
plr.Teleport(0, -13232.7, 219.565, 31.9761);
};
+.RegisterGameObjectEvent(GO_ID, 2, TELE_GURUBASHI);You must replace GO_ID with the portal ID in your DB ( SQL is at the bottom ).
What this does, is when the portal is clicked, tells the server to run the TELE_GURUBASHI function, or the teleport player function.
This script is now operational. Optionally, you could add a message to the player, this could be done like the following:
global TELE_GURUBASHI = function(plr)
{
plr.Teleport(0, -13232.7, 219.565, 31.9761);
+ plr.SendSystemMessage("Welcome to the Gurubashi PvP Arena!");
};
.RegisterGameObjectEvent(GO_ID, 2, TELE_GURUBASHI);Now save this file as something.gm, such as "ArenaTele.gm" and add it to the "scripts" folder on your server. If there is not a scripts folder, create one. Then, either type reloadscripts in the console, or .reloadscripts InGame, and add the GO to the game, and click on it!
I hope someone finds this useful, and any problems, feel free to ask for help. :)
Portal SQL:
insert into `gameobject_names` (`entry`, `Type`, `DisplayID`, `Name`, `spellfocus`, `sound1`, `sound2`, `sound3`, `sound4`, `sound5`, `sound6`, `sound7`, `sound8`, `sound9`, `unknown1`, `unknown2`, `unknown3`, `unknown4`, `unknown5`, `unknown6`, `unknown7`, `unknown8`, `unknown9`, `unknown10`, `unknown11`, `unknown12`, `unknown13`, `unknown14`) values('500000','4','5231','Portal to Gurubashi Arena','0','0','1','0','0','0','0','0','0','0','0' ,'0','0','0','0','0','0','0','0','0','0','0','0',' 0');