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

Active Shards

  • Unchained
    Custom (Classic)
    • Players
    • 138 Online
    • 273 Peak
  • UO Eventine
    Custom (Classic)
    • Players
    • 90 Online
    • 137 Peak
  • The Crossroads
    Mondain's Legacy
    • Players
    • 87 Online
    • 190 Peak
  • Insane UO
    Endless Journey
    • Players
    • 83 Online
    • 105 Peak
  • UO: New Renaissance
    Custom (Classic)
    • Players
    • 33 Online
    • 85 Peak
  • CALYPSO
    Custom (Modern)
    • Players
    • 28 Online
    • 30 Peak
  • Arth
    Custom (Modern)
    • Players
    • 22 Online
    • 34 Peak
  • Heritage
    New Legacy
    • Players
    • 20 Online
    • 41 Peak
  • UO Phoenix
    Custom (Classic)
    • Players
    • 19 Online
    • 48 Peak
  • UO Enigma
    Custom (Modern)
    • Players
    • 19 Online
    • 172 Peak

Donations

Total amount
$0.00
Goal
$500.00
Back