From eeab1c96645bb76d685e08db209cde8f886097a4 Mon Sep 17 00:00:00 2001 From: WarrentyExpired Date: Sat, 11 Jul 2026 14:22:39 -0400 Subject: [PATCH] #W# Added MoveToLoc script [movetoloc +100 -100. Tweaked [spawngen savebyhand to use SpawnID 99. --- Scripts/Commands/Admin/MoveToLocation.cs | 53 +++++++++++++++++++ Scripts/Engines/Spawner/SpawnGen.cs | 4 +- Scripts/Engines/Spawner/SpawnerHowTo.txt | 4 +- .../Engines/Spawner/WorldSpawns/SpawnList.cs | 2 +- 4 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 Scripts/Commands/Admin/MoveToLocation.cs diff --git a/Scripts/Commands/Admin/MoveToLocation.cs b/Scripts/Commands/Admin/MoveToLocation.cs new file mode 100644 index 0000000..1ce72aa --- /dev/null +++ b/Scripts/Commands/Admin/MoveToLocation.cs @@ -0,0 +1,53 @@ +using System; +using Server; +using Server.Commands; + +namespace Server.Commands +{ + public class MoveToLocCommand + { + public static void Initialize() + { + // Registers the command. GMs and Admins can use it. + CommandSystem.Register( "MoveToLoc", AccessLevel.GameMaster, new CommandEventHandler( MoveToLoc_OnCommand ) ); + } + + [Usage( "MoveToLoc [+x/-x] [+y/-y] [+z/-z]" )] + public static void MoveToLoc_OnCommand( CommandEventArgs e ) + { + Mobile from = e.Mobile; + + if ( e.Length < 2 ) + { + from.SendMessage( "Usage: [MoveToLoc [+x/-x] [+y/-y] [+z/-z]" ); + return; + } + + int currentX = from.X; + int currentY = from.Y; + int currentZ = from.Z; + + int targetX = ParseCoordinate( e.GetString( 0 ), currentX ); + int targetY = ParseCoordinate( e.GetString( 1 ), currentY ); + int targetZ = ( e.Length >= 3 ) ? ParseCoordinate( e.GetString( 2 ), currentZ ) : currentZ; + + from.MoveToWorld( new Point3D( targetX, targetY, targetZ ), from.Map ); + } + + private static int ParseCoordinate( string input, int currentVal ) + { + if ( string.IsNullOrEmpty( input ) ) + return currentVal; + + // Check if it starts with a relative modification operator + if ( input.StartsWith( "+" ) || input.StartsWith( "-" ) ) + { + int modifier = Utility.ToInt32( input ); + return currentVal + modifier; + } + + // Otherwise treat it as a standard absolute coordinate + return Utility.ToInt32( input ); + } + } +} diff --git a/Scripts/Engines/Spawner/SpawnGen.cs b/Scripts/Engines/Spawner/SpawnGen.cs index cc4ae8b..5dbc72f 100644 --- a/Scripts/Engines/Spawner/SpawnGen.cs +++ b/Scripts/Engines/Spawner/SpawnGen.cs @@ -261,7 +261,7 @@ namespace Server foreach ( Item itemsave in World.Items.Values ) { - if ( itemsave is PremiumSpawner && ((PremiumSpawner)itemsave).SpawnID == 1 ) + if ( itemsave is PremiumSpawner && ((PremiumSpawner)itemsave).SpawnID == 99 ) { itemtodo.Add( itemsave ); count +=1; @@ -643,4 +643,4 @@ namespace Server m_Count++; } } -} \ No newline at end of file +} diff --git a/Scripts/Engines/Spawner/SpawnerHowTo.txt b/Scripts/Engines/Spawner/SpawnerHowTo.txt index 64fdfa0..641e7f2 100644 --- a/Scripts/Engines/Spawner/SpawnerHowTo.txt +++ b/Scripts/Engines/Spawner/SpawnerHowTo.txt @@ -391,7 +391,7 @@ command prompt instead: [spawngen savebyhand To save spawns done "by hand" ([add premiumspawner... all by hand premium - spawners has SpawnID = 1). Spawns will be saved in "byhand.map" file in + spawners has SpawnID = 99). Spawns will be saved in "byhand.map" file in Data/Monsters folder. [spawngen save x1 y1 x2 y2 @@ -610,4 +610,4 @@ etc You can place more then one cfg inside the same folder, and don't need to have the name Overseers.cfg. Files can have any name. You can do a file "Graveyards.cfg" for all graveyards in a facet. Plus -another called "Florests.cfg" for florests and open areas etc. \ No newline at end of file +another called "Florests.cfg" for florests and open areas etc. diff --git a/Scripts/Engines/Spawner/WorldSpawns/SpawnList.cs b/Scripts/Engines/Spawner/WorldSpawns/SpawnList.cs index cc23ead..b518eb8 100644 --- a/Scripts/Engines/Spawner/WorldSpawns/SpawnList.cs +++ b/Scripts/Engines/Spawner/WorldSpawns/SpawnList.cs @@ -101,7 +101,7 @@ namespace Server private static Type[] FieldAnimals = new Type[] { typeof( BrownBear ), typeof( Goat ), typeof( MountainGoat ), - typeof( Llama ), typeof( Cow ), typeof( Bull ), typeof( Horse ) + typeof( Cow ), typeof( Bull ) }; private static Type[] SnowAnimals = new Type[]