Random Encounters?


Sep 7, 2019
My guess is that Tile type is either StaticTile or LandTile and these kinda stuffs got screwed and mixed up
thanks!. the error points to TileComparer. In the script public class TileComparer : IComparer used LandTile. I changed to StaticTile adn ill see if it works.

        public class TileComparer : IComparer
            public int Compare( object o1, object o2 )
                StaticTile tile1 = (StaticTile) o1;
                StaticTile tile2 = (StaticTile) o2;

                if ( tile1.Z < tile2.Z ) return -1;
                if ( tile1.Z > tile2.Z ) return 1;

                else return 0;
Post automatically merged:

okay, running into another crash now :oops:

System.InvalidCastException: Specified cast is not valid.
   at Server.Misc.SpawnFinder.FindSpawnTileInternal(PlayerMobile pm, Point3D centerPoint, Point2D currentPoint, Point3D& spawnPoint, LandType landType, EffectType effectType, Int32 effectHue)
   at Server.Misc.SpawnFinder.<>c__DisplayClass4.<FindSpiral>b__3(Map map, Int32 x, Int32 y)
   at Server.Searches.SpiralSearch.SearchSpiral(Map map, Int32 start, SearchDirection direction, Boolean randomStart, Tour tour)
   at Server.Misc.SpawnFinder.FindSpiral(PlayerMobile pm, Point3D centerPoint, Point3D& spawnPoint, LandType landType, Int32 distance, Boolean inwards, EffectType effectType, Int32 effectHue)
   at Server.Misc.RandomEncounterEngine.GenerateEncounter(PlayerMobile playerMobile, RandomEncounter encounterTemplate, ArrayList cleanupList)
   at Server.Misc.RandomEncounterEngine.GenerateEncounters(String timerType)
   at Server.Timer.Slice()
   at Server.Core.Main(String[] args)
The issue now seems to lie in FindSpawnTileInternal and findspiral... I've attached spawnfinder.cs to this post as there are quite a few moving parts to this as far as i can tell.
Post automatically merged:

Got it working, it was indeed landtile/statictile being mixed up.


Last edited: