Hello!I have a colore tub,but need help doing the player can choose the hue on firt double click,example:
Character receive dye tub with standard hue,he double click the hue,and he able to select the hue he want.
When the hue is not standard hue,on double click the tub just show the target with hue.
Here my dye tub script:

C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Server.Items;
using Server.Multis;
using Server.Targeting;

namespace Server
{
    public class ArmorDyeTub : DyeTub
    {
       
        [Constructable]
        public ArmorDyeTub() : base()
        {
           
            Name = "Dye Tub [Armor]";
            Hue = Utility.RandomMinMax(1, 2999);
            m_Date = DateTime.UtcNow;
        }

        [Constructable]
        public ArmorDyeTub(int hue, int uses) : base()
        {
           
            DyedHue = hue;
            Name = "Dye Tub [Armor]";
        }

       

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

        public override void OnDoubleClick(Mobile from)
        {
           if (!IsChildOf(from.Backpack))
            {
            from.SendLocalizedMessage(1042001);
            return; // That must be in your pack for you to use it.
            }

           from.Target = new InternalTarget(this);
        }

       

       

        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

         
        }

       

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

        private class InternalTarget : Target
        {
            private readonly ArmorDyeTub m_Tub;

            public InternalTarget(ArmorDyeTub tub)
                : base(1, false, TargetFlags.None)
            {
                m_Tub = tub;
            }

       

        protected override void OnTarget( Mobile from, object target )
        {
            if ( target is BaseArmor || target is BaseShield  )
            {
                Item item = (Item)target;

                if (item.RootParent == from) // Make sure its in their pack or they are wearing it
                {
                    item.Hue = m_Tub.Hue;
                    from.PlaySound(0x23E);
                   
                }
                else
                    from.SendMessage("You can only dye armors that are in your backpack or on your person!");
            }

           
            else
                from.SendMessage("This tub is only for armors.");
        }
        }
    }
}

Thank you so much for helping!
 
Last edited:
Back