BelfortUO

Member
ServUO-- 🙂

Hi I have a little custom ingot that I am trying to figure out how to bind the the player on pickup.

I will be adding it to a mob as a random drop for a quest turn in.

Below is the code the code. Without any of my random tests.

using System;

namespace Server.Items
{
public class FrostIngot : Item
{
public override bool IsArtifact { get { return true; } }
[Constructable]
public FrostIngot()
: base(0x1bf2)
{
Weight = 1.0;
Name = "Ingot of Frost";
Hue = 2212;
}

public FrostIngot(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();
}
}
}
 
Last edited:
This will make it where the first person that picks it up will be the only person that can ever pick it up. It will also change the name to: Name's Ingot of Frost

C#:
Expand Collapse Copy
using System;

namespace Server.Items
{
    public class FrostIngot : Item
    {
        public override bool IsArtifact { get { return true; } }
        private Mobile m_Owner;

        [Constructable]
        public FrostIngot() : base(0x1bf2)
        {
            Weight = 1.0;
            Name = "Ingot of Frost";
            Hue = 2212;
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version

            writer.Write(m_Owner);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Owner = reader.ReadMobile();
        }
        
        public override bool OnDragLift(Mobile from)
        {
            if (m_Owner == null)
            {
                m_Owner = from;
                this.Name = m_Owner.Name.ToString() + "'s Ingot of Frost";
                return base.OnDragLift(from);
            }
            else if (m_Owner == from)
                return base.OnDragLift(from);
            else
                from.SendMessage("The freezing cold causes you to drop the ingot.");

            return false;
        }
    }
}
 
Didn't think about trading. This will stop them from being able to be traded.
C#:
Expand Collapse Copy
        public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
        {
            return false;
        }
 

Donations

Total amount
$50.00
Goal
$500.00

Shards

Back