Moongates
- Xuri
- Site Admin
- Posts: 3704
- Joined: Mon Jun 02, 2003 9:11 am
- Location: Norway
- Has thanked: 48 times
- Been thanked: 8 times
- Contact:
I think teleport.scp is setup with "hardscripted" moongate teleport locations, so when you step on the location where there's supposed to be a moongate in UO, you'll get teleported to a fixed other moongate location. Which means you'll have to keep re-entering the moongates to get where you want.
Or you could remove those teleport locations from teleport.scp, and setup moongates using the moongate Jscript (which I think functions much like OSI's current moongates):
Or you could remove those teleport locations from teleport.scp, and setup moongates using the moongate Jscript (which I think functions much like OSI's current moongates):
Code: Select all
// Moongate.js (v1.1)
// Gump driven gates for location and facet travel
// Rais 7th Feb 02
// Contact: uox_rais@hotmail.com
// Setup:
// Copy this file (moongate.js) to js/custom
// Edit scpTrig.scp in the scripts folder and add:
// 20000 js/custom/moongate.js (20000 is the script ID, can be changed but must be unique)
// Example usage:
// In game, do the following
// 'add 0xf6c (add's a gate)
// 'nodecay (so it wont go away)
// 'setscptric 20000 (Set the script to run on the gate)
// (if you changed the ID in scpTrig.scp, then use the ID you assigned)
// Issue's:
// Pets don't follow, but thats the same of item type 89 (world gates)
// Tag's Used:
// cchar.ItemUsed hold the serial of the item used (the gate)
// Updates:
// 5/3/02: Made the actual gump routine a function, save's having the exact same code twice
function onUse( pUser, iUsed )
{
// get users socket
var srcSock = pUser.socket;
//Are we using the gate allready?
//Get the serial of the item we have just used
var Serial = new Array;
Serial[0]=iUsed.GetSerial(1);
Serial[1]=iUsed.GetSerial(2);
Serial[2]=iUsed.GetSerial(3);
Serial[3]=iUsed.GetSerial(4);
//Get the stored serial from tag
var oldSerial = new Array;
var iCheck = new String(pUser.GetTag("ItemUsed"));
var oldSerial = iCheck.split(',');
//Compare the 2, if the same, then we are allready using this gate
if( Serial[0] == oldSerial[0] && Serial[1] == oldSerial[1] && Serial[2] == oldSerial[2] && Serial[3] == oldSerial[3] )
return;
else
pUser.SetTag("ItemUsed", Serial[0] + "," + Serial[1] + "," + Serial[2] + "," + Serial[3]);
// this Creates our gump
var ret=displaygump(srcSock, pUser);
}
function onCollide( srcSock, pUser, iUsed )
{
var Serial = new Array;
Serial[0]=iUsed.GetSerial(1);
Serial[1]=iUsed.GetSerial(2);
Serial[2]=iUsed.GetSerial(3);
Serial[3]=iUsed.GetSerial(4);
var oldSerial = new Array;
var iCheck = new String(pUser.GetTag("ItemUsed"));
var oldSerial = iCheck.split(',');
if( Serial[0] == oldSerial[0] && Serial[1] == oldSerial[1] && Serial[2] == oldSerial[2] && Serial[3] == oldSerial[3] )
return;
else
pUser.SetTag("ItemUsed", Serial[0] + "," + Serial[1] + "," + Serial[2] + "," + Serial[3]);
var ret = displaygump(srcSock, pUser);
}
function onGumpPress(srcSock,myButton)
{
//Calc char
var srcChar = srcSock.currentChar;
//Range check. Its possible to call up the gate and run away
//get the items's serial
var oldSerial = new Array;
var iCheck = new String(srcChar.GetTag("ItemUsed"));
var oldSerial = iCheck.split(',');
//Convert serial into actual numbers not strings
oldSerial[0] = parseInt(oldSerial[0])
oldSerial[1] = parseInt(oldSerial[1])
oldSerial[2] = parseInt(oldSerial[2])
oldSerial[3] = parseInt(oldSerial[3])
//Find out what the item is from the serial
var iUsed=CalcItemFromSer(oldSerial[0], oldSerial[1], oldSerial[2], oldSerial[3]);
ret=iUsed.InRange( srcChar, 5);
//Clear the tag so we can use gate again?
srcChar.SetTag("ItemUsed", "0,0,0,0");
//Check ret and button (don't say anything if canceled)
if( ret == false && myButton >= 0)
{
srcSock.SysMessage("You have moved too far away to use this.");
return
}
//Where we going... Fel or tram
if(myButton >=5 && myButton <= 12)
tWorld=0; //Going to Tram
if(myButton >=13 && myButton <= 20)
tWorld=1; //Going to fel
switch(myButton)
{
//Tram Fell (world 0 and 1)
case 5:
case 13:
{
srcChar.Teleport( 1336,1998,5,tWorld ); //Brit
break;
}
case 6:
case 14:
{
srcChar.Teleport( 3564,2141,33,tWorld ); //Magincia
break;
}
case 7:
case 15:
{
srcChar.Teleport( 4467,1284,5,tWorld ); //Moonglow
break;
}
case 8:
case 16:
{
srcChar.Teleport( 643,2068,5,tWorld ); //Skara
break;
}
case 9:
case 17:
{
srcChar.Teleport( 1828,2949,-20,tWorld ); //Trinsic
break;
}
case 10:
case 18:
{
srcChar.Teleport( 2701,694,4,tWorld ); //Vesper
break;
}
case 11:
case 19:
{
srcChar.Teleport( 771,754,4,tWorld ); //Yew
break;
}
case 12:
case 20:
{
srcChar.Teleport( 1499,3772,5,tWorld ); //Jhelom
break;
}
//Iishenar
case 21:
{
srcChar.Teleport( 1216,468,-13,2 ); //Compassion
break;
}
case 22:
{
srcChar.Teleport( 722,1364,-60,2 ); //Honesty
break;
}
case 23:
{
srcChar.Teleport( 750,724,-28,2 ); //Honor
break;
}
case 24:
{
srcChar.Teleport( 282,1015,0 ,2 ); //Humility
break;
}
case 25:
{
srcChar.Teleport( 987,1010,-32 ,2 ); //Justice
break;
}
case 26:
{
srcChar.Teleport( 1174,1286,-30 ,2 ); //Sacrifice
break;
}
case 27:
{
srcChar.Teleport( 1532,1340,-4 ,2 ); //Sprirituality
break;
}
case 28:
{
srcChar.Teleport( 528,219,-42 ,2 ); //Valor
break;
}
case 29:
{
srcChar.Teleport( 1721,218,96 ,2 ); //Chaos
break;
}
}
//Default Stuff, if you have clicked on a button >=5 then you have gone somwhere
}
function displaygump(srcSock, pUser)
{
// Make a noise as the gump opens
pUser.SoundEffect( 0x58, false );
var myGump = new Gump;
// add a background
myGump.AddPage(1); //Page 1 Tramel
myGump.AddBackground(20, 20, 260, 245, 0x23f0);
myGump.AddText( 40, 40, 0, "Pick your destination:" );
//Cancel Button
myGump.AddButton( 47, 207, 0xfa5, 1, 0, 0 );
myGump.AddText( 80, 210, 0, "CANCEL" );
//Facet Buttons
myGump.AddText( 70, 70, 12, "Trammel" );
myGump.AddButton( 48, 72, 0x4b9, 0, 1, 0 );
myGump.AddText( 70, 90, 0, "Felucca" );
myGump.AddButton( 48, 95, 0x4b9, 0, 2, 0 );
myGump.AddText( 70, 110, 0, "Iishenar" );
myGump.AddButton( 48, 115, 0x4b9, 0, 3, 0 );
//Location Buttons
myGump.AddText( 170, 70, 0, "Britian" );
myGump.AddButton( 150, 75, 0x837, 1, 0, 5 );
myGump.AddText( 170, 90, 0, "Magincia" );
myGump.AddButton( 150, 95, 0x837, 1, 0, 6 );
myGump.AddText( 170, 110, 0, "Moonglow" );
myGump.AddButton( 150, 115, 0x837, 1, 0, 7 );
myGump.AddText( 170, 130, 0, "Skara Brea" );
myGump.AddButton( 150, 135, 0x837, 1, 0, 8 );
myGump.AddText( 170, 150, 0, "Trinsic" );
myGump.AddButton( 150, 155, 0x837, 1, 0, 9 );
myGump.AddText( 170, 170, 0, "Vesper" );
myGump.AddButton( 150, 175, 0x837, 1, 0, 10 );
myGump.AddText( 170, 190, 0, "Yew" );
myGump.AddButton( 150, 195, 0x837, 1, 0, 11 );
myGump.AddText( 170, 210, 0, "Jhelom" );
myGump.AddButton( 150, 215, 0x837, 1, 0, 12 );
myGump.AddPage (2); //Page 2 Fel
myGump.AddBackground(20, 20, 260, 245, 0x23f0);
myGump.AddText( 40, 40, 0, "Pick your destination:" );
myGump.AddButton( 47, 207, 0xfa5, 1, 0, 0 );
myGump.AddText( 80, 210, 0, "CANCEL" );
myGump.AddText( 70, 70, 0, "Trammel" );
myGump.AddButton( 48, 72, 0x4b9, 0, 1, 0 );
myGump.AddText( 70, 90, 12, "Felucca" );
myGump.AddButton( 48, 95, 0x4b9, 0, 2, 0 );
myGump.AddText( 70, 110, 0, "Iishenar" );
myGump.AddButton( 48, 115, 0x4b9, 0, 3, 0 );
myGump.AddText( 170, 70, 0, "Britian" );
myGump.AddButton( 150, 75, 0x837, 1, 0, 13 );
myGump.AddText( 170, 90, 0, "Magincia" );
myGump.AddButton( 150, 95, 0x837, 1, 0, 14 );
myGump.AddText( 170, 110, 0, "Moonglow" );
myGump.AddButton( 150, 115, 0x837, 1, 0, 15 );
myGump.AddText( 170, 130, 0, "Skara Brea" );
myGump.AddButton( 150, 135, 0x837, 1, 0, 16 );
myGump.AddText( 170, 150, 0, "Trinsic" );
myGump.AddButton( 150, 155, 0x837, 1, 0, 17 );
myGump.AddText( 170, 170, 0, "Vesper" );
myGump.AddButton( 150, 175, 0x837, 1, 0, 18 );
myGump.AddText( 170, 190, 0, "Yew" );
myGump.AddButton( 150, 195, 0x837, 1, 0, 19 );
myGump.AddText( 170, 210, 0, "Jhelom" );
myGump.AddButton( 150, 215, 0x837, 1, 0, 20 );
myGump.AddPage (3); //Page 3 IIsh
myGump.AddBackground(20, 20, 260, 245, 0x23f0);
myGump.AddText( 40, 40, 0, "Pick your destination:" );
myGump.AddButton( 47, 207, 0xfa5, 1, 0, 0 );
myGump.AddText( 80, 210, 0, "CANCEL" );
myGump.AddText( 70, 70, 0, "Trammel" );
myGump.AddButton( 48, 72, 0x4b9, 0, 1, 0 );
myGump.AddText( 70, 90, 0, "Felucca" );
myGump.AddButton( 48, 95, 0x4b9, 0, 2, 0 );
myGump.AddText( 70, 110, 12, "Iishenar" );
myGump.AddButton( 48, 115, 0x4b9, 0, 3, 0 );
myGump.AddText( 170, 70, 0, "Compassion" );
myGump.AddButton( 150, 75, 0x837, 1, 0, 21 );
myGump.AddText( 170, 90, 0, "Honesty" );
myGump.AddButton( 150, 95, 0x837, 1, 0, 22 );
myGump.AddText( 170, 110, 0, "Honor" );
myGump.AddButton( 150, 115, 0x837, 1, 0, 23 );
myGump.AddText( 170, 130, 0, "Humility" );
myGump.AddButton( 150, 135, 0x837, 1, 0, 24 );
myGump.AddText( 170, 150, 0, "Justice" );
myGump.AddButton( 150, 155, 0x837, 1, 0, 25 );
myGump.AddText( 170, 170, 0, "Sacrafice" );
myGump.AddButton( 150, 175, 0x837, 1, 0, 26 );
myGump.AddText( 170, 190, 0, "Sprirituality" );
myGump.AddButton( 150, 195, 0x837, 1, 0, 27 );
myGump.AddText( 170, 210, 0, "Valor" );
myGump.AddButton( 150, 215, 0x837, 1, 0, 28 );
myGump.AddText( 170, 230, 0, "Chaos" );
myGump.AddButton( 150, 235, 0x837, 1, 0, 29 );
myGump.Send( srcSock );
}-= Ho Eyo He Hum =-
I want to setup a system for the moongates like they have in all the other shards where it comes up with a list of destinations and the player chooses where they want to go. I tried using the code that was posted here under moongates but it does not work....there is an error message when UOX3 tries to load it. Can anyone supply me with a working code? Thanks.