My server crashes when I try to target something using the attached item. Any suggestions for a fix would be appreciated.

Code:
Server Crash Report
===================

RunUO Version 2.6, Build 0.13549
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.42000
Time: 7/23/2017 6:55:20 PM
Mobiles: 17118
Items: 144722
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Items.DarkSkullOfInfusion.InfuseVanqTarget.OnTarget(Mobile from, Object targeted)
   at Server.Targeting.Target.Invoke(Mobile from, Object targeted) in C:\Users\Tom\Desktop\RunUO-2.6 + Distro151\RunUO-2.6 + Distro151\RunUO-2.6\Server\Targeting\Target.cs:line 291
   at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc) in C:\Users\Tom\Desktop\RunUO-2.6 + Distro151\RunUO-2.6 + Distro151\RunUO-2.6\Server\Network\PacketHandlers.cs:line 1200
   at Server.Network.MessagePump.HandleReceive(NetState ns) in C:\Users\Tom\Desktop\RunUO-2.6 + Distro151\RunUO-2.6 + Distro151\RunUO-2.6\Server\Network\MessagePump.cs:line 260
   at Server.Network.MessagePump.Slice() in C:\Users\Tom\Desktop\RunUO-2.6 + Distro151\RunUO-2.6 + Distro151\RunUO-2.6\Server\Network\MessagePump.cs:line 127
   at Server.Core.Main(String[] args) in C:\Users\Tom\Desktop\RunUO-2.6 + Distro151\RunUO-2.6 + Distro151\RunUO-2.6\Server\Main.cs:line 532
 

Attachments

  • DarkSkullOfInfusion.cs
    4.3 KB · Views: 3
Try this:

Code:
        public class InfuseVanqTarget : Target
        {
            private DarkSkullOfInfusion m_skull;

            public InfuseVanqTarget(DarkSkullOfInfusion skull) : base(1, false, TargetFlags.None)
            {
                m_skull = m_skull;
            }

            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_skull == null || m_skull.Deleted || !m_skull.IsChildOf(from.Backpack))
                    return;

                m_skull.EndCombine(from, targeted);
            }
        }
 
Ok now I have a new problem - I've gone back to the drawing board to try and get this script to work now that it stopped crashing (ty @Dexter_Lexia) but for some reason it doesn't actually do anything. What I'd like to be able to do is double click the skull, target a weapon of vanquishing and have it increment the number of infused by 1 and delete the targeted weapon. I've attached the most recent version of the script.
 

Attachments

  • DarkSkullOfInfusion.cs
    4.4 KB · Views: 1
Back