Job Complete here is latest after many bugs has been solve thanks to ServUo members, and whoever made this pet bond potion deeds for helping to make this possible.
 

Attachments

  • altributeallpetpotion.rar
    15.5 KB · Views: 17
Last edited:
Please show us what you have done so far to try to accomplish this. While I am sure someone would have fun doing this for you, the point of this "Script Support" forum is to help people troubleshoot scripts that they are writing.
 
I found pet bond potion I tried to see if I can combine this with item attribute deeds to target pets, but it seem hard to do it.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;

namespace Server.Items
{
    public class PetBondingPotion : Item
    {
        public override int LabelNumber { get { return 1152921; } } // Pet Bonding Potion

        [Constructable]
        public PetBondingPotion() : base(0x0F04)
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
        }

        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendLocalizedMessage(1152922); // Target the pet you wish to bond with. Press ESC to cancel. This item is consumed on successful use, so choose wisely!
                from.Target = new BondingTarget(this);
            }
        }

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

    public class BondingTarget : Target
    {
        private PetBondingPotion m_Potion;

        public BondingTarget(PetBondingPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }

        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
                  
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;

                if (t.IsBonded == true)
                {
                    from.SendLocalizedMessage(1152925); // That pet is already bonded to you.
                }
                else if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    m_Potion.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
OK. I edited your post again. Remember, the button that looks like a plus sign with a box around it allows you to paste code into your post and retain formatting, syntax color, etc. Please use it whenever you post code unless it is a one liner or something. Thanks.
 
So, after looking further at what you are trying to do, I thought I would give a mini-tutorial in copying/modifying an existing script and show you how to construct it from the ground up, so to speak. Here is the first step.

1. Start with a copy of the key components of pretty much any script. They are included below:

Code:
using System;

// These two preprocessor directives will most likely be needed.
// We know this because the item we copied had the same requirements...
using Server.Mobiles;
using Server.Targeting;
//  ONE  //
// Your script has to reside in an appropriate namespace
namespace Server.Items
{
    //  TWO  //
    // It needs to have a unique name...
    public class PetBoostingDeed : Item
    {
        [Constructable]
        public PetBoostingDeed()
            //  THREE  //
            : base(0x0F04) // This number needs to match the graphic you want the deed to look like
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
           
            //  FOUR  //
            Name = "Pet Boosting Deed"; // Here you name the deed since there is no appropriate LabelNumber that would give us the name we need.
        }
        //  FIVE  //
        // This method is required by the Server...
        public PetBoostingDeed(Serial serial) : base(serial)
        {
        }
        //  SIX  //
        // These two methods are needed for EVERY item, to preserve World Save and Load stability...
        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();
        }
    }
}

2. Add the methods needed to make this item do what you need:

Code:
using System;

// These two preprocessor directives will most likely be needed.
// We know this because the item we copied had the same requirements...
using Server.Mobiles;
using Server.Targeting;
// Your script has to reside in an appropriate namespace
namespace Server.Items
{
    // It needs to have a unique name...
    public class PetBoostingDeed : Item
    {
        [Constructable]
        public PetBoostingDeed()
            : base(0x0F04) // This number needs to match the graphic you want the deed to look like
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
           
            Name = "Pet Boosting Deed"; // Here you name the deed since there is no appropriate LabelNumber that would give us the name we need.
        }
        // This method is required by the Server...
        public PetBoostingDeed(Serial serial) : base(serial)
        {
        }
       
        // ########## //
        // We add this method so that the deed does what we want it to do when they use it...
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                // We have to customize this message, since the Localization does not contain the text we need...
                from.SendMessage("Target the pet you wish to boost.");
                from.Target = new BoostingTarget(this);
            }
        }
        // These two methods are needed for EVERY item, to preserve World Save and Load stability...
        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();
        }
    }
}

3. Add the extra classes and other bits and pieces. This example should get you started:

Code:
using System;

// These two preprocessor directives will most likely be needed.
// We know this because the item we copied had the same requirements...
using Server.Mobiles;
using Server.Targeting;
// Your script has to reside in an appropriate namespace
namespace Server.Items
{
    // It needs to have a unique name...
    public class PetBoostingDeed : Item
    {
        [Constructable]
        public PetBoostingDeed()
            : base(0x0F04) // This number needs to match the graphic you want the deed to look like
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
           
            Name = "Pet Boosting Deed"; // Here you name the deed since there is no appropriate LabelNumber that would give us the name we need.
        }
        // This method is required by the Server...
        public PetBoostingDeed(Serial serial) : base(serial)
        {
        }
       
        // We add this method so that the deed does what we want it to do when they use it...
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                // We have to customize this message, since the Localization does not contain the text we need...
                from.SendMessage("Target the pet you wish to boost.");
                from.Target = new BoostingTarget(this);
            }
        }
        // These two methods are needed for EVERY item, to preserve World Save and Load stability...
        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();
        }
    }
   
    // ########## //
    public class BoostingTarget : Target
    {
        private PetBoostingDeed m_Deed;
        public BoostingTarget(PetBoostingDeed deed) : base(1, false, TargetFlags.None)
        {
            m_Deed = deed;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Deed == null || m_Deed.Deleted || !m_Deed.IsChildOf(from.Backpack))
                    return;
                 
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    // This is probably the hardest part. You need to create the method here that will do the effect you need...
                    DoTheBoostingThing(t, from, m_Deed);
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}

For the last part, you will need to create the "DoTheBoostingThing" method. The definition of that will look like this:
Code:
DoTheBoostingThing(BaseCreature pet, Mobile from, PetBoostingDeed deed)
{
     // Etc. etc.
}
 
Nice ok let me see if I can get it to work. I also found this maybe we can use this too to help.


Code:
using System.Collections;
using System.Collections.Generic;
using Server;
using System;
using Server.Mobiles;
namespace Custom.Jerbal.Jako
{
    #region Enums
    [Flags]
    public enum JakoAttributesEnum
    {
        None = 0x00000000,
        Hits = 0x00000001,
        Stam = 0x00000002,
        Mana = 0x00000004,
        BonusPhysResist = 0x00000008,
        BonusFireResist = 0x00000010,
        BonusColdResist = 0x00000020,
        BonusEnerResist = 0x00000040,
        BonusPoisResist = 0x00000080
    }
    #endregion

    public class JakoAttributes
    {
        private Hashtable m_attributes = new Hashtable();
        public JakoAttributes()
        {
            m_attributes.Add(JakoAttributesEnum.Hits, new JakoHitsAttribute());
            m_attributes.Add(JakoAttributesEnum.Stam, new JakoStamAttribute());
            m_attributes.Add(JakoAttributesEnum.Mana, new JakoManaAttribute());
            m_attributes.Add(JakoAttributesEnum.BonusPhysResist, new JakoRPhyAttribute());
            m_attributes.Add(JakoAttributesEnum.BonusFireResist, new JakoRFirAttribute());
            m_attributes.Add(JakoAttributesEnum.BonusColdResist, new JakoRColAttribute());
            m_attributes.Add(JakoAttributesEnum.BonusEnerResist, new JakoREneAttribute());
            m_attributes.Add(JakoAttributesEnum.BonusPoisResist, new JakoRPoiAttribute());
        }


        public JakoBaseAttribute GetAttribute(JakoAttributesEnum value)
        {
            if (m_attributes.ContainsKey(value))
                return (JakoBaseAttribute)m_attributes[value];
            return null;
        }


        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute Hits
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.Hits);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute Stam
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.Stam);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute Mana
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.Mana);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute PhysicalResist
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.BonusPhysResist);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute FireResist
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.BonusFireResist);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute ColdResist
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.BonusColdResist);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute EnergyResist
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.BonusEnerResist);
            }
        }
        [CommandProperty(AccessLevel.GameMaster)]
        public virtual JakoBaseAttribute PoisonResist
        {
            get
            {
                return GetAttribute(JakoAttributesEnum.BonusPoisResist);
            }
        }


        /// <summary>
        /// Increase the given attribute byThis.</summary>
        /// <paramref name="att"/> Attribute by JakoAtributesEnum.</param>
        /// <param name="bc"/> The Creature we are increasing the stats for.</param>
        /// <param name="byThis"/> The int amount of the increase/decrease.</param>
        public void IncBonus(JakoAttributesEnum att, BaseCreature bc, int byThis)
        {
            GetAttribute(att).IncBonus(bc, (uint)byThis);
        }

        /// <summary>
        /// Sets the specified Bonus and the mobile's attribute accordingly.</summary>
        /// <paramref name="att"/> Attribute by JakoAttributes.</param>
        /// <param name="bc"/> The Creature we are increasing the stats for.</param>
        /// <paramref name="value"/> How much to increase or decrease the current attribute by.</param>
        public void SetBonus(JakoAttributesEnum att, BaseCreature bc, int value)
        {
            GetAttribute(att).SetBonus(bc, (uint)value);
        }


        #region Serial Functions/Flags
        private static void SetSaveFlag(ref JakoAttributesEnum flags, JakoAttributesEnum toSet, bool setIf)
        {
            if (setIf)
                flags |= toSet;
        }

        private static bool GetSaveFlag(JakoAttributesEnum flags, JakoAttributesEnum toGet)
        {
            return ((flags & toGet) != 0);
        }

        public virtual void Serialize(GenericWriter writer)
        {

            writer.Write(1);//Version

            JakoAttributesEnum flags = JakoAttributesEnum.None;
            SetSaveFlag(ref flags, JakoAttributesEnum.Hits, GetAttribute(JakoAttributesEnum.Hits).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.Stam, GetAttribute(JakoAttributesEnum.Stam).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.Mana, GetAttribute(JakoAttributesEnum.Mana).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.BonusPhysResist, GetAttribute(JakoAttributesEnum.BonusPhysResist).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.BonusFireResist, GetAttribute(JakoAttributesEnum.BonusFireResist).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.BonusColdResist, GetAttribute(JakoAttributesEnum.BonusColdResist).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.BonusEnerResist, GetAttribute(JakoAttributesEnum.BonusEnerResist).IncreasedBy != 0);
            SetSaveFlag(ref flags, JakoAttributesEnum.BonusPoisResist, GetAttribute(JakoAttributesEnum.BonusPoisResist).IncreasedBy != 0);
            writer.WriteEncodedInt((int)flags);

            if (GetSaveFlag(flags, JakoAttributesEnum.Hits))
                GetAttribute(JakoAttributesEnum.Hits).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.Stam))
                GetAttribute(JakoAttributesEnum.Stam).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.Mana))
                GetAttribute(JakoAttributesEnum.Mana).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.BonusPhysResist))
                GetAttribute(JakoAttributesEnum.BonusPhysResist).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.BonusFireResist))
                GetAttribute(JakoAttributesEnum.BonusFireResist).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.BonusColdResist))
                GetAttribute(JakoAttributesEnum.BonusColdResist).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.BonusEnerResist))
                GetAttribute(JakoAttributesEnum.BonusEnerResist).Serialize(writer);

            if (GetSaveFlag(flags, JakoAttributesEnum.BonusPoisResist))
                GetAttribute(JakoAttributesEnum.BonusPoisResist).Serialize(writer);


        }

        public virtual void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                    {
                        JakoAttributesEnum flags = (JakoAttributesEnum)reader.ReadEncodedInt();
                        if (GetSaveFlag(flags, JakoAttributesEnum.Hits))
                            GetAttribute(JakoAttributesEnum.Hits).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.Stam))
                            GetAttribute(JakoAttributesEnum.Stam).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.Mana))
                            GetAttribute(JakoAttributesEnum.Mana).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.BonusPhysResist))
                            GetAttribute(JakoAttributesEnum.BonusPhysResist).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.BonusFireResist))
                            GetAttribute(JakoAttributesEnum.BonusFireResist).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.BonusColdResist))
                            GetAttribute(JakoAttributesEnum.BonusColdResist).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.BonusEnerResist))
                            GetAttribute(JakoAttributesEnum.BonusEnerResist).Deserialize(reader);

                        if (GetSaveFlag(flags, JakoAttributesEnum.BonusPoisResist))
                            GetAttribute(JakoAttributesEnum.BonusPoisResist).Deserialize(reader);
                        break;
                    }

            }
        }
        #endregion

        public override string ToString()
        {
            return "...";
        }
    }
}
[doublepost=1521026128][/doublepost]Also found an another maybe we can use this cause it give us all the attribute that we can add.


Code:
using System;
using Server;
using Server.Mobiles;

namespace Server
{
    public class PetLeveling
    {
        public static void DoDeathCheck( BaseCreature from )
        {
            Mobile cm = from.ControlMaster;

            if ( cm != null && from.Controlled == true && from.Tamable == true )
            {
                if ( from.IsBonded == true )
                {
                    if ( Utility.Random( 100 ) < 5 )
                    {
                        int strloss = from.Str / 20;
                        int dexloss = from.Dex / 20;
                        int intloss = from.Int / 20;
                        int hitsloss = from.Hits / 20;
                        int stamloss = from.Stam / 20;
                        int manaloss = from.Mana / 20;
                        int physloss = from.PhysicalResistance / 20;
                        int fireloss = from.FireResistance / 20;
                        int coldloss = from.ColdResistance / 20;
                        int energyloss = from.EnergyResistance / 20;
                        int poisonloss = from.PoisonResistance / 20;
                        int dminloss = from.DamageMin / 20;
                        int dmaxloss = from.DamageMax / 20;

                        if ( from.Str > strloss )
                            from.Str -= strloss;

                        if ( from.Str > dexloss )
                            from.Dex -= dexloss;

                        if ( from.Str > intloss )
                            from.Int -= intloss;
                       
                        if ( from.HitsMaxSeed > hitsloss )
                            from.HitsMaxSeed -= hitsloss;
                        if ( from.StamMaxSeed > stamloss )
                            from.StamMaxSeed -= stamloss;
                        if ( from.ManaMaxSeed > manaloss )
                            from.ManaMaxSeed -= manaloss;

                        if ( from.PhysicalResistanceSeed > physloss )
                            from.PhysicalResistanceSeed -= physloss;
                        if ( from.FireResistSeed > fireloss )
                            from.FireResistSeed -= fireloss;
                        if ( from.ColdResistSeed > coldloss )
                            from.ColdResistSeed -= coldloss;
                        if ( from.EnergyResistSeed > energyloss )
                            from.EnergyResistSeed -= energyloss;
                        if ( from.PoisonResistSeed > poisonloss )
                            from.PoisonResistSeed -= poisonloss;

                        if ( from.DamageMin > dminloss )
                            from.DamageMin -= dminloss;

                        if ( from.DamageMax > dmaxloss )
                            from.DamageMax -= dmaxloss;

                        cm.SendMessage( 38, "Your pet has suffered a 5% stat lose due to its untimely death." );
                    }

                    cm.SendMessage( 64, "Your pet has been killed!" );
                }
                else
                {
                    cm.SendMessage( 64, "Your pet has been killed!" );
                }
            }
        }

        public static void DoBioDeath( BaseCreature from )
        {
            Mobile cm = from.ControlMaster;

            if ( cm != null && from.Controlled == true && from.Tamable == true )
            {
                if ( from.IsBonded == true )
                {
                    if ( Utility.Random( 100 ) < 25 )
                    {
                        int strloss = from.Str / 20;
                        int dexloss = from.Dex / 20;
                        int intloss = from.Int / 20;
                        int hitsloss = from.Hits / 20;
                        int stamloss = from.Stam / 20;
                        int manaloss = from.Mana / 20;
                        int physloss = from.PhysicalResistance / 20;
                        int fireloss = from.FireResistance / 20;
                        int coldloss = from.ColdResistance / 20;
                        int energyloss = from.EnergyResistance / 20;
                        int poisonloss = from.PoisonResistance / 20;
                        int dminloss = from.DamageMin / 20;
                        int dmaxloss = from.DamageMax / 20;

                        if ( from.Str > strloss )
                            from.Str -= strloss;

                        if ( from.Str > dexloss )
                            from.Dex -= dexloss;

                        if ( from.Str > intloss )
                            from.Int -= intloss;
                       
                        if ( from.HitsMaxSeed > hitsloss )
                            from.HitsMaxSeed -= hitsloss;
                        if ( from.StamMaxSeed > stamloss )
                            from.StamMaxSeed -= stamloss;
                        if ( from.ManaMaxSeed > manaloss )
                            from.ManaMaxSeed -= manaloss;

                        if ( from.PhysicalResistanceSeed > physloss )
                            from.PhysicalResistanceSeed -= physloss;
                        if ( from.FireResistSeed > fireloss )
                            from.FireResistSeed -= fireloss;
                        if ( from.ColdResistSeed > coldloss )
                            from.ColdResistSeed -= coldloss;
                        if ( from.EnergyResistSeed > energyloss )
                            from.EnergyResistSeed -= energyloss;
                        if ( from.PoisonResistSeed > poisonloss )
                            from.PoisonResistSeed -= poisonloss;

                        if ( from.DamageMin > dminloss )
                            from.DamageMin -= dminloss;

                        if ( from.DamageMax > dmaxloss )
                            from.DamageMax -= dmaxloss;

                        cm.SendMessage( 38, "Your pet has suffered a 5% stat lose due to its untimely death." );
                    }

                    cm.SendMessage( 64, "Your pet has been killed!" );
                }
                else
                {
                    cm.SendMessage( 64, "Your pet has been killed!" );
                }
            }
        }

        public static void DoEvoCheck( BaseCreature attacker )
        {
            if ( attacker.Str >= 20 )
                attacker.Str += attacker.Str / 20;
            else
                attacker.Str += 1;

            if ( attacker.Dex >= 20 )
                attacker.Dex += attacker.Dex / 20;
            else
                attacker.Dex += 1;

            if ( attacker.Int >= 20 )
                attacker.Int += attacker.Int / 20;
            else
                attacker.Int += 1;
        }

        public static void DoLevelBonus( BaseCreature attacker )
        {
            int chance = Utility.Random( 100 );
           
            if ( chance < 35 )
            {
                attacker.Str += Utility.RandomMinMax( 1, 3 );
                attacker.Dex += Utility.RandomMinMax( 1, 3 );
                attacker.Int += Utility.RandomMinMax( 1, 3 );
            }
        }

        public static void CheckLevel( Mobile defender, BaseCreature attacker, int count )
        {
            bool nolevel = false;
            Type typ = attacker.GetType();
            string nam = attacker.Name;

            foreach ( string check in FSATS.NoLevelCreatures )
            {
                  if ( check == nam )
                        nolevel = true;
            }

            if ( nolevel != false )
                return;

            int expgainmin, expgainmax;


            if ( defender is BaseCreature )
            {
                if ( attacker.Controlled == true && attacker.ControlMaster != null && attacker.Summoned == false )
                {
                    BaseCreature bc = (BaseCreature)defender;

                    expgainmin = bc.HitsMax * 6; //25
                    expgainmax = bc.HitsMax * 17; // 50

                    int xpgain = Utility.RandomMinMax( expgainmin, expgainmax );
                   
                    if ( count > 1 )
                        xpgain = xpgain / count;

                    if ( attacker.Level <= attacker.MaxLevel - 1 )
                    {
                        attacker.Exp += xpgain;
                        attacker.ControlMaster.SendMessage( "Your pet has gained {0} experience points.", xpgain );
                    }
           
                    int nextLevel = attacker.NextLevel * attacker.Level;

                    if ( attacker.Exp >= nextLevel && attacker.Level <= attacker.MaxLevel - 1 )
                    {
                        DoLevelBonus( attacker );

                        Mobile cm = attacker.ControlMaster;
                        attacker.Level += 1;
                        attacker.Exp = 0;
                        attacker.FixedParticles( 0x373A, 10, 15, 5012, EffectLayer.Waist );
                        attacker.PlaySound( 503 );
                        cm.SendMessage( 38, "Your pets level has increased to {0}.", attacker.Level );

                        int gain = Utility.RandomMinMax( 10, 50 );

                        attacker.AbilityPoints += gain;

                        if ( attacker.ControlMaster != null )
                        {
                            attacker.ControlMaster.SendMessage( 38, "Your pet {0} has gained some ability points.", gain );
                        }

                        if ( attacker.Level == 9 )
                        {
                            attacker.AllowMating = true;
                            cm.SendMessage( 1161, "Your pet is now at the level to mate." );
                        }
                        if ( attacker.Evolves == true )
                        {
                            if ( attacker.UsesForm1 == true && attacker.F0 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form1;
                                attacker.BaseSoundID = attacker.Sound1;
                                attacker.F1 = true;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm1 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm2 == true && attacker.F1 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form2;
                                attacker.BaseSoundID = attacker.Sound2;
                                attacker.F1 = false;
                                attacker.F2 = true;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm2 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm3 == true && attacker.F2 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form3;
                                attacker.BaseSoundID = attacker.Sound3;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = true;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm3 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm4 == true && attacker.F3 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form4;
                                attacker.BaseSoundID = attacker.Sound4;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = true;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm4 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm5 == true && attacker.F4 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form5;
                                attacker.BaseSoundID = attacker.Sound5;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = true;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm5 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm6 == true && attacker.F5 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form6;
                                attacker.BaseSoundID = attacker.Sound6;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = true;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm6 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm7 == true && attacker.F6 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form7;
                                attacker.BaseSoundID = attacker.Sound7;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = true;
                                attacker.F8 = false;
                                attacker.F9 = false;
                                attacker.UsesForm7 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm8 == true && attacker.F7 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form8;
                                attacker.BaseSoundID = attacker.Sound8;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = true;
                                attacker.F9 = false;
                                attacker.UsesForm8 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }
                            else if ( attacker.UsesForm9 == true && attacker.F8 == true )
                            {
                                DoEvoCheck( attacker );

                                attacker.BodyValue = attacker.Form9;
                                attacker.BaseSoundID = attacker.Sound9;
                                attacker.F1 = false;
                                attacker.F2 = false;
                                attacker.F3 = false;
                                attacker.F4 = false;
                                attacker.F5 = false;
                                attacker.F6 = false;
                                attacker.F7 = false;
                                attacker.F8 = false;
                                attacker.F9 = true;
                                attacker.UsesForm9 = false;
                                cm.SendMessage( 64, "Your pet has evoloved." );
                            }   
                        }
                    }
                }
            }
        }
    }
}
 
O.K. I did some work on it, and it work fine no error, but it still bonding the pet, and not add physical resist bonus on the pet. I can't seem to figure out how it is bonding.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetPhysicalResistanceBonusPotion : Item
    {
        public override int LabelNumber { get { return 1152921; } } // Pet Bonding Potion
        [Constructable]
        public PetPhysicalResistanceBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendLocalizedMessage(1152922); // Target the pet you wish to bond with. Press ESC to cancel. This item is consumed on successful use, so choose wisely!
                from.Target = new PhysicalResistanceSeed(this);
            }
        }
        public PetPhysicalResistanceBonusPotion(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();
        }
    }
    public class PhysicalResistanceSeed : Target
    {
        private PetPhysicalResistanceBonusPotion m_Potion;
        public PhysicalResistanceSeed(PetPhysicalResistanceBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
             
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.IsBonded == true)
                {
                    from.SendLocalizedMessage(1152925); // That pet is already bonded to you.
                }
                else if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    m_Potion.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
Thats how
Code:
protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
            
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.IsBonded == true)
                {
                    from.SendLocalizedMessage(1152925); // That pet is already bonded to you.
                }
                else if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    m_Potion.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
 
O.K. well how do we make it work to add PhysicalResistanceSeed to plus 1?

I know it need some work, but it's very small work, and if anybody would want to help I'd appreciate it a lot.
 
Code:
                    t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    t.PhysicalResistanceSeed += 1;
                    from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
                    m_Potion.Delete();
 
Had error on line 67.

if (t.PhysicalResistanceSeed == true)

https://gyazo.com/ff776a837dd20c789c277579dd312881

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetPhysicalResistanceBonusPotion : Item
    {
        public override int LabelNumber { get { return 1152921; } } // Pet Bonding Potion
        [Constructable]
        public PetPhysicalResistanceBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendLocalizedMessage(1152922); // Target the pet you wish to bond with. Press ESC to cancel. This item is consumed on successful use, so choose wisely!
                from.Target = new PhysicalResistanceSeed(this);
            }
        }
        public PetPhysicalResistanceBonusPotion(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();
        }
    }
    public class PhysicalResistanceSeed : Target
    {
        private PetPhysicalResistanceBonusPotion m_Potion;
        public PhysicalResistanceSeed(PetPhysicalResistanceBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
                
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.PhysicalResistanceSeed == true)
                {
                    from.SendLocalizedMessage(1152925); // That pet is already bonded to you.
                }
                else if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                     t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    t.PhysicalResistanceSeed += 1;
                    from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
                    m_Potion.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
Right it work perfect, but the problem is once the pet bond it doesn't work anymore. I tried to turn bond to False it took off the bond, and then it stop working also. Now I am trying to figure out how to remove that.

BaseCreature t = (BaseCreature)target;
if (t.IsBonded == true)

I tried to change that to false it took off the bond, and, if it on true it will not add the bonus.

https://gyazo.com/1671ae3d2e212d0ae92cf92e72dbcddc


Code:
 if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.IsBonded == true)
                {
                    from.SendLocalizedMessage(1152925); // That pet is already bonded to you.
                }
                else if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                      t.IsBonded = !t.IsBonded;
                    from.SendLocalizedMessage(1049666); // Your pet has bonded with you!
                    t.PhysicalResistanceSeed += 1;
                    from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
                    m_Potion.Delete();
 
Last edited:
I think you do not need to impose a Bonded property in this script.
Use next:
Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetPhysicalResistanceBonusPotion : Item
    {
        [Constructable]
        public PetPhysicalResistanceBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Physical Resistance Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate"); 
                from.Target = new PhysicalResistanceSeed(this);
            }
        }
        public PetPhysicalResistanceBonusPotion(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();
        }
    }
    public class PhysicalResistanceSeed : Target
    {
        private PetPhysicalResistanceBonusPotion m_Potion;
        public PhysicalResistanceSeed(PetPhysicalResistanceBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
              
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;

                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    t.PhysicalResistanceSeed += 1;
                    from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
                    m_Potion.Delete();
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
What is needed is a max value for the resist seed else they get to 100 and dont get damage anymore
 
This script has it how can we borrow this cap limit, and put it in the other one?

int AttackChanceAdd = 1; //Amount of Attack Chance to be added
int AttackChanceCap = 1000; //Limit of Attack Chance that an item can have

Code:
//Add AttackChance to an item
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server;

namespace Server.Items
{
    public class AttackChanceIncreaseTarget : Target
    {           
        private AttackChanceIncreaseDeed m_Deed;

        public AttackChanceIncreaseTarget( AttackChanceIncreaseDeed deed ) : base( 1, false, TargetFlags.None )
        {
            m_Deed = deed;
        }
       
        protected override void OnTarget( Mobile from, object target )
        {
            int AttackChanceAdd = 1; //Amount of Attack Chance to be added
            int AttackChanceCap = 1000; //Limit of Attack Chance that an item can have
           
            //Change to false if you don't want it to be used on any of these items
      bool allowWeapon = true;
            bool allowArmor = false;
            bool allowJewel = false;
            bool allowClothing = false;
            bool allowSpellbook = true;
            bool allowTalisman = false;
            bool allowQuiver = false;
           
            if ( target is BaseWeapon && allowWeapon)
            {
                Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseWeapon)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseWeapon)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
                    return;
            }
            else if ( target is BaseArmor && allowArmor )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseArmor)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseArmor)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
               
            }
            else if ( target is BaseClothing && allowClothing )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseClothing)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseClothing)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
            }
            else if ( target is BaseTalisman && allowTalisman )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseTalisman)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseTalisman)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
            }
            else if ( target is BaseJewel && allowJewel )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseJewel)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseJewel)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
            }
            else if ( target is Spellbook && allowSpellbook )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((Spellbook)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((Spellbook)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
            }
            else if ( target is BaseQuiver && allowQuiver )
            {
                    Item item = (Item)target;
                    if( item.RootParent != from )
                    {
                        from.SendMessage( "You cannot add Attack Chance to that item there!" );
                    }
                    else
                    {
                        AttackChanceAdd = AttackChanceToAdd(((BaseQuiver)item).Attributes.AttackChance, AttackChanceAdd, AttackChanceCap, from);
                        if( AttackChanceAdd > 0 )
                        {
                            ((BaseQuiver)item).Attributes.AttackChance += AttackChanceAdd;
                            m_Deed.Delete();
                        }
                    }
            }
            else
            {
                from.SendMessage( "You cannot use this deed on that!" );
            }
        }
       
        public int AttackChanceToAdd(int itemAttackChance, int AttackChanceAdd ,int AttackChanceCap, Mobile from)
        {
            int ret = 0;
            if(itemAttackChance < AttackChanceCap)
            {
                if( (itemAttackChance + AttackChanceAdd ) > AttackChanceCap )
                {
                    ret = AttackChanceAdd - ( (itemAttackChance + AttackChanceAdd ) - AttackChanceCap );
                    from.SendMessage("You increase the Attack Chance on the item and it has now reached it's max. +"+ret+" Attack Chance has been added.");
                }
                else{
                    from.SendMessage( "You increase the Attack Chance on the item. +"+AttackChanceAdd+" Attack Chance has been added." );
                    ret = AttackChanceAdd;
                }
            }
            else
            {
                from.SendMessage( "That item has reached the maximum amount of Attack Chance." );
            }
           
            return ret;
        }
    }

    public class AttackChanceIncreaseDeed : Item
    {
        [Constructable]
        public AttackChanceIncreaseDeed() : base( 0x14F0 )
        {
            Weight = 1.0;
            Name = "+1 Attack Chance Increase Deed";
            LootType = LootType.Blessed;
        }

        public AttackChanceIncreaseDeed( 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 );
            LootType = LootType.Blessed;

            int version = reader.ReadInt();
        }

        public override bool DisplayLootType{ get{ return false; } }

        public override void OnDoubleClick( Mobile from )
        {
            if ( !IsChildOf( from.Backpack ) )
            {
                 from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Which item would you like to increase Attack Chance?"  );
                from.Target = new AttackChanceIncreaseTarget( this );
            }
        }   
    }
}
 
This script has it how can we borrow this cap limit, and put it in the other one?
Change:
Code:
t.PhysicalResistanceSeed += 1; 
from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
m_Potion.Delete();
to:
Code:
if (t.PhysicalResistanceSeed < 70)
{
t.PhysicalResistanceSeed += 1; 
from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
m_Potion.Delete();
}
else
{
from.SendMessage("Your pet have a maximum physical resistance.");
return;
}
 
Last edited:
O.K. I tried to copy, but I must have put it in the wrong place, or something it had Error at line 81, and I am not able to get it right. Here I have the working script if anybody wouldn't mind fixing them for me please, and thank you.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetPhysicalResistanceBonusPotion : Item
    {
        [Constructable]
        public PetPhysicalResistanceBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Physical Resistance Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new PhysicalResistanceSeed(this);
            }
        }
        public PetPhysicalResistanceBonusPotion(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();
        }
    }
    public class PhysicalResistanceSeed : Target
    {
        private PetPhysicalResistanceBonusPotion m_Potion;
        public PhysicalResistanceSeed(PetPhysicalResistanceBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
            
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.PhysicalResistanceSeed < 70)
{
t.PhysicalResistanceSeed += 1;
from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
m_Potion.Delete();
}
else
{
from.SendMessage("Your pet have a maximum physical resistance.");
return;
}
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
Added the missing brackets, now it should work
Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetPhysicalResistanceBonusPotion : Item
    {
        [Constructable]
        public PetPhysicalResistanceBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
            Name = "Pet Physical Resistance Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new PhysicalResistanceSeed(this);
            }
        }
        public PetPhysicalResistanceBonusPotion(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();
        }
    }
    public class PhysicalResistanceSeed : Target
    {
        private PetPhysicalResistanceBonusPotion m_Potion;
        public PhysicalResistanceSeed(PetPhysicalResistanceBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
          
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.PhysicalResistanceSeed < 70)
                    {
                        t.PhysicalResistanceSeed += 1;
                        from.SendMessage("You have reinforced your pet by 1 point of physical resistance. Total: [{0}]", t.PhysicalResistanceSeed);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet have a maximum physical resistance.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
HAHA yea anyway I need more help I need to make one that does a reduction. I am trying to make pet followers that can go all the way to zero.

I tried to change this, and it did not work when I put it on Minus, and even change < to > it still not work.

Code:
if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.ControlSlots < 0)
                    {
                        t.ControlSlots += 1;
                        from.SendMessage("You have reduce your pet by 1 point of Control Slots . Total: [{0}]", t.ControlSlots);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet control slots can't get any lower.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
[doublepost=1521713273][/doublepost]O.K. Imaging having 10 greater dragon with 0 followers, and 20,000 hit point each with fire breath, and even add pack instinct.

But there is a catch it cost 2.5 million a point, and probably 20 million per followers reduction which would cost 100 million to get followers to 0, and it would cost over 20 billion, or more to max out Greater dragon.

Average calculation cost per one side like max out resist is 250 point which is 625 million, plus add 5 side which would be over 1,000 point then total cost per pet is 2.5 billion average.

It's insane, but it's easy to upgrade maybe 1 point a day, and it take 365 days a year so 365 point added to the pet, and it would take 10 years to get all 10 pet perfect, but the stronger the pet the faster you can farm so it'll probably be fast, but the reward is still worth it, and balance.
 
Change:
Code:
 if (t.ControlSlots < 0)
to
Code:
 if (t.ControlSlots > 0)
and:
Code:
t.ControlSlots += 1;
to:
Code:
t.ControlSlots -= 1;
 
haha yes that what I did, and it didn't work, but I will try again.
[doublepost=1521713897][/doublepost]Oh Duh! I accident put 0 followers on my pet that is why lol.

O.K. thank you it work lol.
[doublepost=1521714557][/doublepost]O.K. I want to share the hard work we all did, and want to say thank you, and here they are it has resist, damage, min, max, hits, mana, stam, and control slot.

I can add more like pack instinct, fire breath, but I do not think I need it if I am missing anything let me know.
 

Attachments

  • altributeallpetpotion.rar
    15.5 KB · Views: 5
I found a bug for min damage it will pass max damage can anybody help fix that to make it where it cannot pass max damage for me please?

I will share two CS one for min, and one for max that way you can look through both of them.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetDamageMinBonusPotion : Item
    {
        [Constructable]
        public PetDamageMinBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Damage Min Point Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new DamageMin(this);
            }
        }
        public PetDamageMinBonusPotion(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();
        }
    }
    public class DamageMin : Target
    {
        private PetDamageMinBonusPotion m_Potion;
        public DamageMin(PetDamageMinBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
      
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.DamageMin < 1000000)
                    {
                        t.DamageMin += 1;
                        from.SendMessage("You have reinforced your pet by 1 point of DamageMin. Total: [{0}]", t.DamageMin);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet have a maximum DamageMin.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetDamageMaxBonusPotion : Item
    {
        [Constructable]
        public PetDamageMaxBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Damage Max Point Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new DamageMax(this);
            }
        }
        public PetDamageMaxBonusPotion(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();
        }
    }
    public class DamageMax : Target
    {
        private PetDamageMaxBonusPotion m_Potion;
        public DamageMax(PetDamageMaxBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
       
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.DamageMax < 1000000)
                    {
                        t.DamageMax += 1;
                        from.SendMessage("You have reinforced your pet by 1 point of Damage Max. Total: [{0}]", t.DamageMax);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet have a maximum Damage Max.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
O.K. It work here is latest deeds. Thank you for your hard work!
 

Attachments

  • altributeallpetpotion.rar
    15.5 KB · Views: 6
I found a bug on pet stamina bonus attribute deeds. The hit point bonus works fine, but stamina when I use it twice it reset to 1 stamina for some reason.

Here is screenshot.

https://gyazo.com/2ba7efc6239a4e5c6a1b76b16c490e54

Here is the bug scripts.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetStamPointBonusPotion : Item
    {
        [Constructable]
        public PetStamPointBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Stam Point Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new StamMaxSeed(this);
            }
        }
        public PetStamPointBonusPotion(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();
        }
    }
    public class StamMaxSeed : Target
    {
        private PetStamPointBonusPotion m_Potion;
        public StamMaxSeed(PetStamPointBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
        
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.StamMaxSeed < 1000000)
                    {
                        t.StamMaxSeed += 1;
                        from.SendMessage("You have reinforced your pet by 1 point of stamina point. Total: [{0}]", t.StamMaxSeed);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet have a maximum stamina point.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}

This one is hits point this one works fine no problem, but it is the same as stamina, but not sure why it is resetting them to 1 after 2nd potion.

Code:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetHitsPointBonusPotion : Item
    {
        [Constructable]
        public PetHitsPointBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
Name = "Pet Hits Point Bonus Potion";
            LootType = LootType.Blessed;
            Hue = 2629;
        }
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you with to upgrate");
                from.Target = new HitsMaxSeed(this);
            }
        }
        public PetHitsPointBonusPotion(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();
        }
    }
    public class HitsMaxSeed : Target
    {
        private PetHitsPointBonusPotion m_Potion;
        public HitsMaxSeed(PetHitsPointBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
        
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.HitsMaxSeed < 1000000)
                    {
                        t.HitsMaxSeed += 1;
                        from.SendMessage("You have reinforced your pet by 1 point of hits point. Total: [{0}]", t.HitsMaxSeed);
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet have a maximum hits point.");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
O.K. I tried it on the horse, and I do not know if I modified basecreature.

Screen shot of horse.

https://gyazo.com/728c2e27fffac5c7b275b84c158f8daf

O.K. it is a weird bug.

When you use it first time it reset back to 1 then after it reset it go on forever none stop after it reset first time.

I have no idea why it reset, but once it reset then it work normal.

I check two servuo, and both run the same, and work the same so I will share the basecreature script just in case you need

I tried to copy, and paste the Base Creature CS in here it was too long so I can't do it.
 
Last edited:
if you not set stam for creature, stam based on dex and his StamMaxSeed for default = -1;
and if u gain StemMaxSeed +1 - his start sum stamina with 0.

try use next:
Code:
                    if (t.StamMaxSeed < 1000000)
                    {
                          t.StamMaxSeed = t.Stam + 1;
                        from.SendMessage("You have reinforced your pet by 1 point of stamina point. Total: [{0}]", t.StamMaxSeed);
                        m_Potion.Delete();
                    }
 
Awesome ideas! Just wondering how you can use the Pet Stam Point Bonus Potion more than once? I tested this on a chicken with 15 Stam. First use: it boosted the Stam by 1 from 15 to 16. Second use: It sayed I applied the potion but the Stam stilled stayed at 16. If i'm looking at the script right it suppossed to be able to be used until the pet reaches 1000000 pts in Stamina. Here's the script that I used:
C#:
using System;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
    public class PetStamPointBonusPotion : Item
    {
        [Constructable]
        public PetStamPointBonusPotion() : base(0x0F04)
        {
            Weight = 1.0;
            Name = "a Stamina Potion";
            LootType = LootType.Blessed;
            Stackable = false;            
            
            Hue = 437;
        }

        public override void OnSingleClick( Mobile from )
        {
            base.OnSingleClick( from );

            LabelTo( from, "+1 Pet Bonus" );
        }
        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add( "+1 Pet Bonus"  );
        }
                
        public override void OnDoubleClick(Mobile from) // Override double click of the deed to call our target
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            else
            {
                from.SendMessage("Target the pet you wish to pour the potion over!");
                from.Target = new StamMaxSeed(this);
            }
        }
        public PetStamPointBonusPotion(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();
        }
    }
    public class StamMaxSeed : Target
    {
        private PetStamPointBonusPotion m_Potion;
        public StamMaxSeed(PetStamPointBonusPotion potion) : base(1, false, TargetFlags.None)
        {
            m_Potion = potion;
        }
        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Potion == null || m_Potion.Deleted || !m_Potion.IsChildOf(from.Backpack))
                    return;
         
            if (target is BaseCreature)
            {
                BaseCreature t = (BaseCreature)target;
                if (t.ControlMaster != from)
                {
                    from.SendLocalizedMessage(1114368); // This is not your pet!
                }
                else
                {
                    if (t.StamMaxSeed < 1000000)
                    {
                        t.StamMaxSeed = t.Stam + 1;
                        from.SendMessage("Total: [{0}]", t.StamMaxSeed);
                        from.Say( "I applied 1 point to your Base Stamina!" );    
                        from.PlaySound(665);                        
                                                                    
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet has reached it's maximum amount of Stamina points!");
                        return;
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(1152924);  // That is not a valid pet.
            }
        }
    }
}
 
Try this:

C#:
                else
                {
                    if (t.StamMaxSeed < 1000000)
                    {
                        t.StamMaxSeed = t.StamMaxSeed + 1;
                        t.Stam = t.Stam + 1;
                        from.SendMessage("Total: [{0}]", t.StamMaxSeed);
                        from.Say( "I applied 1 point to your Base Stamina!" );  
                        from.PlaySound(665);                      
                                                                   
                        m_Potion.Delete();
                    }
                    else
                    {
                        from.SendMessage("Your pet has reached it's maximum amount of Stamina points!");
                        return;
                    }
 
First, it took the Stam all the way to 0 :(... which was a bummer. Then everyone of them thereafter worked by added them back by appling them... which did work.
 
Last edited:
Back