Can't figure out how to add bond to player on pickup

Dvdci84

Gold Donator
Jan 2, 2020
59
3
8
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:

Dvdci84

Gold Donator
Jan 2, 2020
59
3
8
I'll check it out. I have figured out the blessitem deed however I want the item to bind on pick up.

I'll mess around and see if I can make it work, or until I break something.
 
  • Like
Reactions: Ozzer2016

Ozzer2016

Rookie
Jul 2, 2016
91
19
8
46
you could give the item from a npc and have the item not movable, so it's stuck in their backpack.
 

Visam

Squire
Mar 19, 2015
310
75
28
47
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#:
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;
        }
    }
}
 
  • Like
Reactions: Dvdci84

Visam

Squire
Mar 19, 2015
310
75
28
47
Didn't think about trading. This will stop them from being able to be traded.
C#:
        public override bool AllowSecureTrade( Mobile from, Mobile to, Mobile newOwner, bool accepted )
        {
            return false;
        }
 
  • Like
Reactions: Dvdci84