Kilra Yan

Member
Since according to wiki the player have to place the altar and the tome using the Exodus Summoning Altar and not the staff, I am attempting to fix the code to improve further this quest so it could be included to ServUO distro.

Please if you know a script way that force to place an object like BaseAddon or PeerlessAltar in the world let me know.

Actually I tested this code

Code:
(new ExodusAlterAddon()).MoveToWorld( new Point3D(4218, 564, 42 ), mobile.Map );
(new ExodusTomeAltar()).MoveToWorld( new Point3D(4219, 563, 57 ), mobile.Map );

but it doesnt do anything, when it comes the time that it should be called it doesnt appear anything.

If you need the full code I am testing please ask.

The quest is the following

https://www.servuo.com/threads/the-exodus-encounter-quest.916/
 
Since according to wiki the player have to place the altar and the tome using the Exodus Summoning Altar and not the staff, I am attempting to fix the code to improve further this quest so it could be included to ServUO distro.

Please if you know a script way that force to place an object like BaseAddon or PeerlessAltar in the world let me know.

Actually I tested this code

Code:
(new ExodusAlterAddon()).MoveToWorld( new Point3D(4218, 564, 42 ), mobile.Map );
(new ExodusTomeAltar()).MoveToWorld( new Point3D(4219, 563, 57 ), mobile.Map );

but it doesnt do anything, when it comes the time that it should be called it doesnt appear anything.

If you need the full code I am testing please ask.

The quest is the following

https://www.servuo.com/threads/the-exodus-encounter-quest.916/
Sounds like the original creator of the script had the same issue with the altars, I remember him mentioning it when he first posted the system -- hence why he made it so you had to create static altars. I'll see if I can't do some research and try and help you find how to do this.
 
Thanks the solution is there for sure and I have a couple of ideas in mind already probably today i am going to solve this :) great quest btw strange that the dev stucked with such a relative simple task like this compared all the rest
 
Almost solution found, just need to get around this error that happen on the server log (without crash) when I attempt to add the deed in my backpack

Code:
using System;
using System.Collections.Generic;
using Server;
using Server.Multis;
using Server.Targeting;
using Server.Mobiles;
using Server.Items;

namespace Server.Items
{
   [Flipable( 0x14F0, 0x14EF )]
    public abstract class ExodusAlterAddonDeed : Item
    {
        public abstract BaseAddon Addon{ get; }
		
		[Constructable]
        public ExodusAlterAddonDeed()
            : base(0x14F0)
        {
            Weight = 1.0;
			Name = "Exodus Summoning Altar";
			LootType = LootType.Blessed;
			//Hue = 0;

            if ( !Core.AOS )
                LootType = LootType.Newbied;
        }

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

        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();

            if ( Weight == 0.0 )
                Weight = 1.0;
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
                from.Target = new InternalTarget( this );
            else
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
        }

        private class InternalTarget : Target
        {
            private ExodusAlterAddonDeed m_Deed;

            public InternalTarget( ExodusAlterAddonDeed deed ) : base( -1, true, TargetFlags.None )
            {
                m_Deed = deed;

                CheckLOS = false;
            }

            protected override void OnTarget( Mobile from, object targeted )
            {
				
                IPoint3D p = targeted as IPoint3D;
                Map map = from.Map;
				
				
				
                if ( p == null || map == null/* || m_Deed.Deleted */|| m_Deed == null )
				{	
					from.SendLocalizedMessage( 500269 );
                    return;
				}

				//return; //debug return;
				
                if ( m_Deed.IsChildOf( from.Backpack ) )
                {
                    BaseAddon addon = m_Deed.Addon;

                    Server.Spells.SpellHelper.GetSurfaceTop( ref p );

                    BaseHouse house = null;

                    AddonFitResult res = addon.CouldFit( p, map, from, ref house );

                    if ( res == AddonFitResult.Valid )
                        //addon.MoveToWorld( new Point3D( p ), map );
						from.SendLocalizedMessage( 500269 ); // You cannot build that there. 
                    else if ( res == AddonFitResult.Blocked )
                        from.SendLocalizedMessage( 500269 ); // You cannot build that there. 

                    else if( res == AddonFitResult.NotInHouse )
					{
						PlayerMobile mobile = (PlayerMobile) from;	
						if (mobile == null)
							return;
						
						//START RITUAL PLACEMENT SCRIPT
						if (mobile.Map == Map.Trammel || mobile.Map == Map.Felucca)
						{
							if (mobile.Location.X >= 1853 && mobile.Location.X <= 1862 && mobile.Location.Y >= 870 && mobile.Location.Y <= 878)
							{
								//location compassion
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 4209 && mobile.Location.X <= 4215 && mobile.Location.Y >= 561 && mobile.Location.Y <= 566)
							{
								//location honesty
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1729 && mobile.Location.X <= 1732 && mobile.Location.Y >= 3526 && mobile.Location.Y <= 3529)
							{
								//location honor
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 4273 && mobile.Location.X <= 4276 && mobile.Location.Y >= 3693 && mobile.Location.Y <= 3700)
							{
								//location humility
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1297 && mobile.Location.X <= 1304 && mobile.Location.Y >= 629 && mobile.Location.Y <= 636)
							{
								//location justice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 3352 && mobile.Location.X <= 3357 && mobile.Location.Y >= 287 && mobile.Location.Y <= 295)
							{
								//location sacrifice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 3352 && mobile.Location.X <= 3357 && mobile.Location.Y >= 287 && mobile.Location.Y <= 295)
							{
								//location sacrifice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1593 && mobile.Location.X <= 1607 && mobile.Location.Y >= 2488 && mobile.Location.Y <= 2493)
							{
								//location spirituality
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 2486 && mobile.Location.X <= 2495 && mobile.Location.Y >= 3926 && mobile.Location.Y <= 3936)
							{
								//location valor
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
						}
						mobile.SendMessage("That is not the right place to permorm thy ritual.");
						//return;
					}

                    /*from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
					else if ( res == AddonFitResult.DoorsNotClosed )
                    from.SendMessage( "You must close all house doors before placing this." );
					else if ( res == AddonFitResult.DoorTooClose )
                    from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
					else if ( res == AddonFitResult.NoWall )
                    from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.*/

                    if ( res == AddonFitResult.Valid )
					{
						m_Deed.Delete();
						house.Addons.Add( addon );
					}
					if ( res == AddonFitResult.NotInHouse )
					{
						m_Deed.Delete();
					}
					else
					{
						addon.Delete();
					}
                }
                else
                {
                    from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
                }
            }
        }
    }
}
 

Attachments

  • Immagine.jpg
    Immagine.jpg
    130.9 KB · Views: 5
An abstract class cannot be instantiated in the same way as a regular object I.e using the new keyword.

Remove the keyword abstract from public abstract class ExodusAlterAddonDeed : Item
 
Already tryed and had to change the code like following

Code:
using System;
using System.Collections.Generic;
using Server;
using Server.Multis;
using Server.Targeting;
using Server.Mobiles;
using Server.Items;

namespace Server.Items
{
   [Flipable( 0x14F0, 0x14EF )]
    public class ExodusAlterAddonDeed : Item
    {		
		private BaseAddon m_Deed;
		
		public BaseAddon Addon
        {
            get
            {
                return this.m_Deed;
            }
            set
            {
                m_Deed = value;
            }
        }
		
		[Constructable]
        public ExodusAlterAddonDeed()
            : base(0x14F0)
        {
            Weight = 1.0;
			Name = "Exodus Summoning Altar";
			LootType = LootType.Blessed;
			//Hue = 0;

            if ( !Core.AOS )
                LootType = LootType.Newbied;
        }

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

        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();

            if ( Weight == 0.0 )
                Weight = 1.0;
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
                from.Target = new InternalTarget( this );
            else
                from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
        }

        private class InternalTarget : Target
        {
            private ExodusAlterAddonDeed m_Deed;

            public InternalTarget( ExodusAlterAddonDeed deed ) : base( -1, true, TargetFlags.None )
            {
                m_Deed = deed;

                CheckLOS = false;
            }

            protected override void OnTarget( Mobile from, object targeted )
            {
				
                IPoint3D p = targeted as IPoint3D;
                Map map = from.Map;
				
                if ( p == null || map == null || m_Deed.Deleted || m_Deed == null )
				return;

				//return; //debug return;
				
                if ( m_Deed.IsChildOf( from.Backpack ) )
                {
                    BaseAddon addon = m_Deed.Addon;

                    Server.Spells.SpellHelper.GetSurfaceTop( ref p );

                    BaseHouse house = null;

                    AddonFitResult res = addon.CouldFit( p, map, from, ref house );

                    if ( res == AddonFitResult.Valid )
                        //addon.MoveToWorld( new Point3D( p ), map );
						from.SendLocalizedMessage( 500269 ); // You cannot build that there.
                    else if ( res == AddonFitResult.Blocked )
                        from.SendLocalizedMessage( 500269 ); // You cannot build that there.

                    else if( res == AddonFitResult.NotInHouse )
					{
						PlayerMobile mobile = (PlayerMobile) from;	
						if (mobile == null)
							return;
						
						//START RITUAL PLACEMENT SCRIPT
						if (mobile.Map == Map.Trammel || mobile.Map == Map.Felucca)
						{
							if (mobile.Location.X >= 1853 && mobile.Location.X <= 1862 && mobile.Location.Y >= 870 && mobile.Location.Y <= 878)
							{
								//location compassion
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 4209 && mobile.Location.X <= 4215 && mobile.Location.Y >= 561 && mobile.Location.Y <= 566)
							{
								//location honesty
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1729 && mobile.Location.X <= 1732 && mobile.Location.Y >= 3526 && mobile.Location.Y <= 3529)
							{
								//location honor
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 4273 && mobile.Location.X <= 4276 && mobile.Location.Y >= 3693 && mobile.Location.Y <= 3700)
							{
								//location humility
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1297 && mobile.Location.X <= 1304 && mobile.Location.Y >= 629 && mobile.Location.Y <= 636)
							{
								//location justice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 3352 && mobile.Location.X <= 3357 && mobile.Location.Y >= 287 && mobile.Location.Y <= 295)
							{
								//location sacrifice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 3352 && mobile.Location.X <= 3357 && mobile.Location.Y >= 287 && mobile.Location.Y <= 295)
							{
								//location sacrifice
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 1593 && mobile.Location.X <= 1607 && mobile.Location.Y >= 2488 && mobile.Location.Y <= 2493)
							{
								//location spirituality
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
							else if (mobile.Location.X >= 2486 && mobile.Location.X <= 2495 && mobile.Location.Y >= 3926 && mobile.Location.Y <= 3936)
							{
								//location valor
								addon.MoveToWorld( new Point3D( p ), map );
								return;
							}
						}
						mobile.SendMessage("That is not the right place to permorm thy ritual.");
						//return;
					}

                    /*from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
					else if ( res == AddonFitResult.DoorsNotClosed )
                    from.SendMessage( "You must close all house doors before placing this." );
					else if ( res == AddonFitResult.DoorTooClose )
                    from.SendLocalizedMessage( 500271 ); // You cannot build near the door.
					else if ( res == AddonFitResult.NoWall )
                    from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.*/

                    if ( res == AddonFitResult.Valid )
					{
						m_Deed.Delete();
						house.Addons.Add( addon );
					}
					if ( res == AddonFitResult.NotInHouse )
					{
						m_Deed.Delete();
					}
					else
					{
						addon.Delete();
					}
                }
                else
                {
                    from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
                }
            }
        }
    }
}

Edit I may have found the solution
 
Last edited:
I still having the crash issue

Code:
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Items.ExodusAlterAddonDeed.InternalTarget.OnTarget(Mobile from, Object targeted)
   at Server.Targeting.Target.Invoke(Mobile from, Object targeted) in e:\UOEMU\ServUO\Server\Targeting\Target.cs:line 269
   at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc) in e:\UOEMU\ServUO\Server\Network\PacketHandlers.cs:line 1449
   at Server.Network.MessagePump.HandleReceive(NetState ns) in e:\UOEMU\ServUO\Server\Network\MessagePump.cs:line 318
   at Server.Network.MessagePump.Slice() in e:\UOEMU\ServUO\Server\Network\MessagePump.cs:line 123
   at Server.Core.Main(String[] args) in e:\UOEMU\ServUO\Server\Main.cs:line 571

I attaching the code for anyone willing to come in aid

Edit:
another probable error corrected...

but still have same crash

Updated my file
 

Attachments

  • ExodusAlterAddonNew.cs
    9 KB · Views: 7
Last edited:
what's wrong in this?

Code:
if ( m_Deed.IsChildOf( from.Backpack ) )
                {
                    BaseAddon addon = m_Deed.ExodusAlterAddon;
					
                    Server.Spells.SpellHelper.GetSurfaceTop( ref p );

		 addon.MoveToWorld( new Point3D( p ), map );
		}

Attempting to use MoveToWorld function over a BaseAddon like it crashes the server. Any workaround?

EDIT
WOW I did it! Just another step and I should be done with that
 
Last edited:
I am done with previously, everything fine now.

I need to know a trick to change map of this Point3D object.

Code:
public class ExodusTomeAltar : PeerlessAltar
    {
        [Constructable]
            public ExodusTomeAltar(): base(0x2259)//
        {
              
            Hue = 0;//2360;
            BossLocation = new Point3D(761, 641, 0);//Exodus city boss loc
            TeleportDest = new Point3D(924, 642, -78);//Exodus city stairs			
            ExitDest = new Point3D(946, 640, -80);	//Exodus city desert
        }
 
Point3D is exactly as the name suggests a point in 3d space. It contains coordinates for the x, y and z planes, that is it.

You use this point in another method such as movetoworld which includes the map parameter.
 
Actually this is over my capabilities, but the quest will work anyway, I made the manual workaround which ask the player to come back to ilshenar after ritual has been cleant :D
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back