Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 10-21-2003, 01:02 PM   #1 (permalink)
Newbie
 
Join Date: Oct 2003
Posts: 15
Default i want to move the moongates.

PublicMoongate.cs
[code:1]public static readonly PMList Trammel =
new PMList( 1012000, 1012012, Map.Trammel, new PMEntry[]
{
new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
new PMEntry( new Point3D( 771, 752, 5 ), 1012006 ), // Yew
new PMEntry( new Point3D( 2701, 692, 5 ), 1012007 ), // Minoc
new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
new PMEntry( new Point3D( 643, 2067, 5 ), 1012009 ), // Skara Brae
new PMEntry( new Point3D( 3563, 2139, 34), 1012010 ), // Magincia
new PMEntry( new Point3D( 3763, 2771, 50), 1046259 ) // Haven
} );
[/code:1]

Is this the part of the code i need to edit to change the location of the moongates.
i want them in the towns them selfs.
Necroscope is offline   Reply With Quote
Old 10-21-2003, 01:03 PM   #2 (permalink)
 
Join Date: Oct 2003
Posts: 329
Send a message via ICQ to neimen
Default

why not just add a moongate in town and leave those?

do [add publicmoongate

and place it anywhere
__________________
What I like, you may not; What you like, I may not; everything has it's place
neimen is offline   Reply With Quote
Old 10-21-2003, 01:10 PM   #3 (permalink)
Newbie
 
Join Date: Oct 2003
Posts: 15
Default

ya i know but i just got shot of all ofter maps like Fel/mal and ish.and im trying to move the gates into town to cut down on items in game.adding a pub moongate wont help much it wont take you to the other town,just to the other moongate
Necroscope is offline   Reply With Quote
Old 10-21-2003, 02:30 PM   #4 (permalink)
Forum Expert
 
Ravenal's Avatar
 
Join Date: Oct 2003
Location: Spokane Valley, WA
Age: 24
Posts: 1,528
Default

Ahh I your in luck i swung by! heres a script that was not done by me and it works like heck!!!
Just override your publicmoongate.cs

PublicMoongate.cs

[code:1]
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Mobiles;

namespace Server.Items
{
public class PublicMoongate : Item
{
[Constructable]
public PublicMoongate() : base( 0xF6C )
{
Movable = false;
Light = LightType.Circle300;
}

public PublicMoongate( Serial serial ) : base( serial )
{
}

public override void OnDoubleClick( Mobile from )
{
if ( !from.Player )
return;

if ( from.InRange( GetWorldLocation(), 1 ) )
UseGate( from );
else
from.SendLocalizedMessage( 500446 ); // That is too far away.
}

public override bool OnMoveOver( Mobile m )
{
return !m.Player || UseGate( m );
}

public bool UseGate( Mobile m )
{
if ( m.Criminal )
{
m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
return false;
}
else if ( Server.Spells.SpellHelper.CheckCombat( m ) )
{
m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
return false;
}
else if ( m.Spell != null )
{
m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
return false;
}
else
{
m.CloseGump( typeof( MoongateGump ) );
m.SendGump( new MoongateGump( m, this ) );

Effects.PlaySound( m.Location, m.Map, 0x20E );
return true;
}
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );

writer.Write( (int) 0 ); // version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );

int version = reader.ReadInt();
}

public static void Initialize()
{
Server.Commands.Register( "MoonGen", AccessLevel.Administrator, new CommandEventHandler( MoonGen_OnCommand ) );
}

[Usage( "MoonGen" )]
[Description( "Generates public moongates. Removes all old moongates." )]
public static void MoonGen_OnCommand( CommandEventArgs e )
{
DeleteAll();

int count = 0;

//count += MoonGen( PMList.Trammel );
count += MoonGen( PMList.Felucca );
count += MoonGen( PMList.Ilshenar );
//count += MoonGen( PMList.Malas );

World.Broadcast( 0x35, true, "{0} moongates generated.", count );
}

private static void DeleteAll()
{
ArrayList list = new ArrayList();

foreach ( Item item in World.Items.Values )
{
if ( item is PublicMoongate )
list.Add( item );
}

foreach ( Item item in list )
item.Delete();

if ( list.Count > 0 )
World.Broadcast( 0x35, true, "{0} moongates removed.", list.Count );
}

private static int MoonGen( PMList list )
{
foreach ( PMEntry entry in list.Entries )
{
Item item = new PublicMoongate();

item.MoveToWorld( entry.Location, list.Map );

if ( entry.Text == "Umbra" ) // Umbra
item.Hue = 0x497;
}

return list.Entries.Length;
}
}

public class PMEntry
{
private Point3D m_Location;
private string m_Text;

public Point3D Location
{
get
{
return m_Location;
}
}

public string Text
{
get
{
return m_Text;
}
}

public PMEntry( Point3D loc, string text )
{
m_Location = loc;
m_Text = text;
}
}

public class PMList
{
private string m_Text, m_SelText;
private Map m_Map;
private PMEntry[] m_Entries;

public string Text
{
get
{
return m_Text;
}
}

public string SelText
{
get
{
return m_SelText;
}
}

public Map Map
{
get
{
return m_Map;
}
}

public PMEntry[] Entries
{
get
{
return m_Entries;
}
}

//public PMList( int number, int selNumber, Map map, PMEntry[] entries )
public PMList( string text, string selText, Map map, PMEntry[] entries )
{
m_Text = text;
m_SelText = selText;
m_Map = map;
m_Entries = entries;
}

//public static readonly PMList Trammel =
//new PMList( 1012000, 1012012, Map.Trammel, new PMEntry[]
//{
//new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
//new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
//new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
//new PMEntry( new Point3D( 771, 752, 5 ), 1012006 ), // Yew
//new PMEntry( new Point3D( 2701, 692, 5 ), 1012007 ), // Minoc
//new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
//new PMEntry( new Point3D( 643, 2067, 5 ), 1012009 ), // Skara Brae
//new PMEntry( new Point3D( 3563, 2139, 34), 1012010 ), // Magincia
//new PMEntry( new Point3D( 3763, 2771, 50), 1046259 ) // Haven
//} );

public static readonly PMList Felucca =
new PMList( "Felucca", "Felucca", Map.Felucca, new PMEntry[]
{
new PMEntry( new Point3D( 4467, 1283, 5 ), "Moonglow" ), // Moonglow
new PMEntry( new Point3D( 1336, 1997, 5 ), "Britain" ), // Britain
new PMEntry( new Point3D( 1499, 3771, 5 ), "Jhelom" ), // Jhelom
new PMEntry( new Point3D( 771, 752, 5 ), "Yew" ), // Yew
new PMEntry( new Point3D( 2701, 692, 5 ), "Minoc" ), // Minoc
new PMEntry( new Point3D( 1828, 2948,-20), "Trinsic" ), // Trinsic
new PMEntry( new Point3D( 643, 2067, 5 ), "Skara Brae" ), // Skara Brae
new PMEntry( new Point3D( 3563, 2139, 34), "Magincia" ), // Magincia
new PMEntry( new Point3D( 2711, 2234, 0 ), "Buccaneer's Den" ) // Buccaneer's Den
} );

public static readonly PMList Ilshenar =
new PMList( "Lands of Hotos`", "Lands of Hotos`", Map.Ilshenar, new PMEntry[]
{
//new PMEntry( new Point3D( 1215, 467, -13 ), "Compassion" ), // Compassion
//new PMEntry( new Point3D( 722, 1366, -60 ), "Honesty" ), // Honesty
//new PMEntry( new Point3D( 744, 724, -28 ), "Honor" ), // Honor
//new PMEntry( new Point3D( 281, 1016, 0 ), "Humility" ), // Humility
//new PMEntry( new Point3D( 987, 1011, -32 ), "Justice" ), // Justice
new PMEntry( new Point3D( 940, 504, -30 ), "Staffs of the Anceint World" ), // Sacrifice
new PMEntry( new Point3D( 1721, 218, 96 ), "Passage of Chaos" ), // Spirituality
new PMEntry( new Point3D( 1084, 652, -20 ), "The Vampire's Lair" ), // Valor
new PMEntry( new Point3D( 1603, 334, -16 ), "City of Hotoas" ) // Chaos
} );

//public static readonly PMList Malas =
//new PMList( 1060643, 1062039, Map.Malas, new PMEntry[]
//{
//new PMEntry( new Point3D( 1015, 527, -65 ), 1060641 ), // Luna
//new PMEntry( new Point3D( 1997, 1386, -85 ), 1060642 ) // Umbra
//} );

public static readonly PMList[] UORLists = new PMList[]{ Felucca };
public static readonly PMList[] LBRLists = new PMList[]{ Felucca, Ilshenar };
public static readonly PMList[] AOSLists = new PMList[]{ Felucca, Ilshenar };
public static readonly PMList[] RedLists = new PMList[]{ Felucca };
}

public class MoongateGump : Gump
{
private Mobile m_Mobile;
private Item m_Moongate;
private PMList[] m_Lists;

public MoongateGump( Mobile mobile, Item moongate ) : base( 100, 100 )
{
m_Mobile = mobile;
m_Moongate = moongate;

PMList[] checkLists;

if ( mobile.Player )
{
if ( mobile.Kills >= 5 )
{
checkLists = PMList.RedLists;
}
else
{
int flags = mobile.NetState == null ? 0 : mobile.NetState.Flags;

if ( Core.AOS && (flags & 0x8) != 0 )
checkLists = PMList.AOSLists;
else if ( (flags & 0x4) != 0 )
checkLists = PMList.LBRLists;
else
checkLists = PMList.UORLists;
}
}
else
{
checkLists = PMList.AOSLists;
}

m_Lists = new PMList[checkLists.Length];

for ( int i = 0; i < m_Lists.Length; ++i )
m_Lists[i] = checkLists[i];

for ( int i = 0; i < m_Lists.Length; ++i )
{
if ( m_Lists[i].Map == mobile.Map )
{
PMList temp = m_Lists[i];

m_Lists[i] = m_Lists[0];
m_Lists[0] = temp;

break;
}
}

AddPage( 0 );

AddBackground( 0, 0, 380, 280, 5054 );

AddButton( 10, 210, 4005, 4007, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 45, 210, 140, 25, 1011036, false, false ); // OKAY

AddButton( 10, 235, 4005, 4007, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 45, 235, 140, 25, 1011012, false, false ); // CANCEL

AddHtmlLocalized( 5, 5, 200, 20, 1012011, false, false ); // Pick your destination:

for ( int i = 0; i < checkLists.Length; ++i )
{
AddButton( 10, 35 + (i * 25), 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf( m_Lists, checkLists[i] ) + 1 );
//AddHtmlLocalized( 30, 35 + (i * 25), 150, 20, checkLists[i].Number, false, false );
AddHtml( 30, 35 + (i * 25), 150, 20, checkLists[i].Text, false, false );
}

for ( int i = 0; i < m_Lists.Length; ++i )
RenderPage( i, Array.IndexOf( checkLists, m_Lists[i] ) );
}

private void RenderPage( int index, int offset )
{
PMList list = m_Lists[index];

AddPage( index + 1 );

AddButton( 10, 35 + (offset * 25), 2117, 2118, 0, GumpButtonType.Page, index + 1 );
//AddHtmlLocalized( 30, 35 + (offset * 25), 150, 20, list.SelNumber, false, false );
AddHtml( 30, 35 + (offset * 25), 150, 20, list.SelText, false, false );

PMEntry[] entries = list.Entries;

for ( int i = 0; i < entries.Length; ++i )
{
AddRadio( 200, 35 + (i * 25), 210, 211, false, (index * 100) + i );
//AddHtmlLocalized( 225, 35 + (i * 25), 150, 20, entries[i].Number, false, false );
AddHtml( 225, 35 + (i * 25), 150, 20, entries[i].Text, false, false );
}
}

public override void OnResponse( NetState state, RelayInfo info )
{
if ( info.ButtonID == 0 ) // Cancel
return;
else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
return;

int[] switches = info.Switches;

if ( switches.Length == 0 )
return;

int switchID = switches[0];
int listIndex = switchID / 100;
int listEntry = switchID % 100;

if ( listIndex < 0 || listIndex >= m_Lists.Length )
return;

PMList list = m_Lists[listIndex];

if ( listEntry < 0 || listEntry >= list.Entries.Length )
return;

PMEntry entry = list.Entries[listEntry];

if ( !m_Mobile.InRange( m_Moongate.GetWorldLocation(), 1 ) || m_Mobile.Map != m_Moongate.Map )
{
m_Mobile.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
}
else if ( m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca )
{
m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
}
else if ( m_Mobile.Criminal )
{
m_Mobile.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
}
else if ( Server.Spells.SpellHelper.CheckCombat( m_Mobile ) )
{
m_Mobile.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
}
else if ( m_Mobile.Spell != null )
{
m_Mobile.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
}
else if ( m_Mobile.Map == list.Map && m_Mobile.InRange( entry.Location, 1 ) )
{
m_Mobile.SendLocalizedMessage( 1019003 ); // You are already there.
}
else
{
BaseCreature.TeleportPets( m_Mobile, entry.Location, list.Map );

m_Mobile.Combatant = null;
m_Mobile.Warmode = false;
m_Mobile.Hidden = true;
m_Mobile.Map = list.Map;
m_Mobile.Location = entry.Location;

Effects.PlaySound( entry.Location, list.Map, 0x1FE );
}
}
}
}
[/code:1]

Just figure out what ya need to change! It took me 15 hours to figure some things out, but when i found out about doing it right, it works like sweet tomatos in the mouth!

The Orignals looked like the one above yours but look closely... This is much eaiser and once you figure out what you need to change it works awesome! if problems just let me know i've never had problems...

[code:1]
public static readonly PMList Felucca =
new PMList( "Felucca", "Felucca", Map.Felucca, new PMEntry[]
{
new PMEntry( new Point3D( 4467, 1283, 5 ), "Moonglow" ), // Moonglow
new PMEntry( new Point3D( 1336, 1997, 5 ), "Britain" ), // Britain
new PMEntry( new Point3D( 1499, 3771, 5 ), "Jhelom" ), // Jhelom
new PMEntry( new Point3D( 771, 752, 5 ), "Yew" ), // Yew
new PMEntry( new Point3D( 2701, 692, 5 ), "Minoc" ), // Minoc
new PMEntry( new Point3D( 1828, 2948,-20), "Trinsic" ), // Trinsic
new PMEntry( new Point3D( 643, 2067, 5 ), "Skara Brae" ), // Skara Brae
new PMEntry( new Point3D( 3563, 2139, 34), "Magincia" ), // Magincia
new PMEntry( new Point3D( 2711, 2234, 0 ), "Buccaneer's Den" ) // Buccaneer's Den

[/code:1]

Say you want to change Trinsic to another name such as Bank of Trinsic you would do this...

[code:1]
new PMEntry( new Point3D( 1828, 2948,-20), "Trinsic" ), // Trinsic *Put the area where the locations are at* *Then Rename Trinsic to whatever you want!

[/code:1]

Now look at this be careful cuz i had some errors with Felucca, Make sure both are saying the exact same thing or when you get ready to goto the gate it might look like 2 FF on top of each other but one moved sligty over

Before I had was Lands of Hotos, and then Land of Hotos and realize i forgot the s it was a mess i could not even see the location, it was like L on top of L but over to the right a little, then a on top of a so so! anyway... Make sure what you do here put it both the same like Trammel must be Trammel in the 2nd line, if you leave it blank when someone clicks on trammel then clicks on the other one the thing it will show it blank and they'll get confused...
[code:1]
public static readonly PMList Felucca =
new PMList( "Felucca", "Felucca", Map.Felucca, new PMEntry[] //EXAMPLE "Lands of Hotos", "Lands of Hotos"

RIGHT is this="Lands of Hotos", "Lands of Hotos"
WRONG is this ="Land of Hotos", "Lands of Hotos"
WRONG = "Lands of Hotos", "(Leaving blank is not smart)"
[/code:1]

I hope this script will help!
__________________
Creator of Genesis :: genesisworlds.com
-- Genesis is the next replacement program for UO Landscaper & Dragon
Ravenal is offline   Reply With Quote
Old 01-07-2004, 11:52 AM   #5 (permalink)
 
Join Date: Aug 2003
Posts: 36
Send a message via ICQ to KainElderan
Default

Couple questions...does this script still work with beta 36? Also, the poster mentions overriding current locations...but what about adding new locations? Looking at the script...
[code:1]
//public static readonly PMList Trammel =
//new PMList( 1012000, 1012012, Map.Trammel, new PMEntry[]
//{
//new PMEntry( new Point3D( 4467, 1283, 5 ), 1012003 ), // Moonglow
//new PMEntry( new Point3D( 1336, 1997, 5 ), 1012004 ), // Britain
//new PMEntry( new Point3D( 1499, 3771, 5 ), 1012005 ), // Jhelom
//new PMEntry( new Point3D( 771, 752, 5 ), 1012006 ), // Yew
//new PMEntry( new Point3D( 2701, 692, 5 ), 1012007 ), // Minoc
//new PMEntry( new Point3D( 1828, 2948,-20), 1012008 ), // Trinsic
//new PMEntry( new Point3D( 643, 2067, 5 ), 1012009 ), // Skara Brae
//new PMEntry( new Point3D( 3563, 2139, 34), 1012010 ), // Magincia
//new PMEntry( new Point3D( 3763, 2771, 50), 1046259 ) // Haven
//} );
[/code:1]

Would I just add this?
[code:1]
new PMEntry( new Point3D( 1079, 1430, -90), ????? ) // Esteria
} );
[/code:1]

Not exactly sure where the set of numbers that are ??'s come from...and not exactly sure how I could do this. I'm trying though, would be very beneficial if I could add 3 locations to public moongate. Thanks for any help.

Kain Elderan
__________________
Silverfalls Administrator
http://www.silverfalls.org
KainElderan is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5