Problem on armor set giving props.

Discussion in 'Script Support' started by rome1982, Feb 7, 2018.

  1. rome1982

    rome1982 Sorceror

    Joined:
    Feb 10, 2009
    Messages:
    93
    Likes Received:
    6
    Hi guys,im testing a variation of an armor set of virtues found here:

    http://www.runuo.com/community/threads/virtue-armor-set-runuo-2-0-easy-simple.496343/

    On the version im working on,the set give some props like ssi,str,and lmc when equip full set,but the problem is:

    When i equip the full set,each part display +5 str(6 parts = 30str),but just giving 5 str in total,and when removed the set,str dont decays,example:

    Character with 100 str equip the full set = 105 str.
    Character unequip a piece,or full set = 105 str.
    Character equip the full set one more time = 110 str.

    And not sure if the set parts are giving ssi lmc bonus.
    Here the code of a full part:

    Code:
    using System;
    using Server.Items;
    using Server.Mobiles;
    
    namespace Server.Items
    {
        //[FlipableAttribute(0x2B0A, 0x2B0B)]
        public class ArmsOfBaal : PlateArms
        {
            public override int BasePhysicalResistance { get { return 8; } }
            public override int BaseFireResistance { get { return 11; } }
            public override int BaseColdResistance { get { return 6; } }
            public override int BasePoisonResistance { get { return 8; } }
            public override int BaseEnergyResistance { get { return 7; } }
    
            public override int InitMinHits { get { return 255; } }
            public override int InitMaxHits { get { return 255; } }
    
            public override int AosStrReq { get { return 60; } }
            public override int OldStrReq { get { return 60; } }
    
            public override int OldDexBonus { get { return -2; } }
    
            public override int ArmorBase { get { return 30; } }
            public override int RevertArmorBase { get { return 4; } }
    
            public override ArmorMaterialType MaterialType { get { return ArmorMaterialType.Bone; } }
            public override CraftResource DefaultResource { get { return CraftResource.RegularLeather; } }
    
            [Constructable]
            public ArmsOfBaal()
                //: base(0x2B0A)
            {
                Name = "Arms of Baal";
                Attributes.LowerManaCost = 5;
                Attributes.WeaponDamage = 5;
                Weight = 2.0;
                Hue = 1389;
                 Movable = false;
            }
            public override void GetProperties(ObjectPropertyList list)
                {
     
                base.GetProperties(list);
                
                list.Add("Demon skin [Apocalypse] [6 pieces based set]");
                }
            public override bool OnEquip(Mobile from)
    
            {
                if (from.FindItemOnLayer(Layer.Gloves) != null && from.FindItemOnLayer(Layer.Gloves) is GauntletsOfBaal
                  && from.FindItemOnLayer(Layer.Helm) != null && from.FindItemOnLayer(Layer.Helm) is HelmOfBaal
                  //&& from.FindItemOnLayer(Layer.Shoes) != null && from.FindItemOnLayer(Layer.Shoes) is SolaretesOfBaal
                  //&& from.FindItemOnLayer(Layer.Cloak) != null && from.FindItemOnLayer(Layer.Cloak) is CloakOfBaal
                  && from.FindItemOnLayer(Layer.Neck) != null && from.FindItemOnLayer(Layer.Neck) is GorgetOfBaal
                  && from.FindItemOnLayer(Layer.Pants) != null && from.FindItemOnLayer(Layer.Pants) is LegsOfBaal
                  && from.FindItemOnLayer(Layer.InnerTorso) != null && from.FindItemOnLayer(Layer.InnerTorso) is BreastplateOfBaal)
                {
                    Hue = 2176;
                    Attributes.BonusStr = 5;
                    Attributes.WeaponSpeed = 10;
                    Attributes.WeaponDamage = 5;
                    Attributes.AttackChance = 5;
                    ColdBonus = 8;
                    FireBonus = 8;
                    PhysicalBonus = 8;
                    EnergyBonus = 8;
                    PoisonBonus = 8;
                    Effects.SendBoltEffect(from);
    
                    //Modification of An Corp Wis Weed's Script by Warmaster
                    GauntletsOfBaal gloves = from.FindItemOnLayer(Layer.Gloves) as GauntletsOfBaal;
                    gloves.Hue = 2176;
                    gloves.Attributes.BonusStr = 5;
                    gloves.ColdBonus = 8;
                    gloves.FireBonus = 8;
                    gloves.PhysicalBonus = 8;
                    gloves.EnergyBonus = 8;
                    gloves.PoisonBonus = 8;
                    gloves.Attributes.WeaponSpeed = 10;
                    gloves.Attributes.AttackChance = 5;
                    gloves.Attributes.WeaponDamage = 5;
    
                    HelmOfBaal hat = from.FindItemOnLayer(Layer.Helm) as HelmOfBaal;
                    hat.Hue = 2176;
                    hat.Attributes.BonusStr = 5;
                    hat.ColdBonus = 8;
                    hat.FireBonus = 8;
                    hat.PhysicalBonus = 8;
                    hat.EnergyBonus = 8;
                    hat.PoisonBonus = 8;
                    hat.Attributes.WeaponSpeed = 10;
                    hat.Attributes.AttackChance = 5;
                    hat.Attributes.WeaponDamage = 5;
    
                    //SolaretesOfBaal shoe = from.FindItemOnLayer(Layer.Shoes) as SolaretesOfBaal;
                    //shoe.Hue = 0;
    
                    //CloakOfBaal cape = from.FindItemOnLayer(Layer.Cloak) as CloakOfBaal;
                    //cape.Hue = 0;
    
                    GorgetOfBaal gorge = from.FindItemOnLayer(Layer.Neck) as GorgetOfBaal;
                    gorge.Hue = 2176;
                    gorge.Attributes.BonusStr = 5;
                    gorge.ColdBonus = 8;
                    gorge.FireBonus = 8;
                    gorge.PhysicalBonus = 8;
                    gorge.EnergyBonus = 8;
                    gorge.PoisonBonus = 8;
                    gorge.Attributes.WeaponSpeed = 10;
                    gorge.Attributes.AttackChance = 5;
                    gorge.Attributes.WeaponDamage = 5;
    
                    LegsOfBaal legs = from.FindItemOnLayer(Layer.Pants) as LegsOfBaal;
                    legs.Hue = 2176;
                    legs.Attributes.BonusStr = 5;
                    legs.ColdBonus = 8;
                    legs.FireBonus = 8;
                    legs.PhysicalBonus = 8;
                    legs.EnergyBonus = 8;
                    legs.PoisonBonus = 8;
                    legs.Attributes.WeaponSpeed = 10;
                    legs.Attributes.AttackChance = 5;
                    legs.Attributes.WeaponDamage = 5;
    
                    BreastplateOfBaal tunic = from.FindItemOnLayer(Layer.InnerTorso) as BreastplateOfBaal;
                    tunic.Hue = 2176;
                    tunic.Attributes.BonusStr = 5;
                    tunic.ColdBonus = 8;
                    tunic.FireBonus = 8;
                    tunic.PhysicalBonus = 8;
                    tunic.EnergyBonus = 8;
                    tunic.PoisonBonus = 8;
                    tunic.Attributes.WeaponSpeed = 10;
                    tunic.Attributes.AttackChance = 5;
                    tunic.Attributes.WeaponDamage = 5;
                    //End of Mod.
                }
                return base.OnEquip(from);
            }
     
            public override void OnRemoved(object parent)
            {
                if (parent is PlayerMobile)
                {
                    Mobile pm = (Mobile)parent;//line added by Warmaster
    
                    Hue = 1389;
                    Attributes.BonusStr -= 5;
                    Attributes.WeaponSpeed = 0;
                    Attributes.WeaponDamage = 0;
                    Attributes.AttackChance = 0;
                    ColdBonus = 0;
                    FireBonus = 0;
                    PhysicalBonus = 0;
                    EnergyBonus = 0;
                    PoisonBonus = 0;
                    ArmorAttributes.SelfRepair = 0;
                    //Warmaster's Edit begins
                    if (pm.FindItemOnLayer(Layer.Gloves) != null && pm.FindItemOnLayer(Layer.Gloves) is GauntletsOfBaal
                  && pm.FindItemOnLayer(Layer.Helm) != null && pm.FindItemOnLayer(Layer.Helm) is HelmOfBaal
                 // && pm.FindItemOnLayer(Layer.Shoes) != null && pm.FindItemOnLayer(Layer.Shoes) is SolaretesOfBaal
                 // && pm.FindItemOnLayer(Layer.Cloak) != null && pm.FindItemOnLayer(Layer.Cloak) is CloakOfBaal
                  && pm.FindItemOnLayer(Layer.Neck) != null && pm.FindItemOnLayer(Layer.Neck) is GorgetOfBaal
                  && pm.FindItemOnLayer(Layer.Pants) != null && pm.FindItemOnLayer(Layer.Pants) is LegsOfBaal
                  && pm.FindItemOnLayer(Layer.InnerTorso) != null && pm.FindItemOnLayer(Layer.InnerTorso) is BreastplateOfBaal)
                    {
                        GauntletsOfBaal gloves = pm.FindItemOnLayer(Layer.Gloves) as GauntletsOfBaal;
                        gloves.Hue = 1389;
                        gloves.Attributes.BonusStr -= 5;
                        gloves.Attributes.WeaponSpeed = 0;
                        gloves.Attributes.AttackChance = 0;
                        gloves.Attributes.WeaponDamage = 0;
                        gloves.ColdBonus = 0;
                    gloves.FireBonus = 0;
                    gloves.PhysicalBonus = 0;
                    gloves.EnergyBonus = 0;
                    gloves.PoisonBonus = 0;
    
                        HelmOfBaal hat = pm.FindItemOnLayer(Layer.Helm) as HelmOfBaal;
                        hat.Hue = 1389;
                        hat.Attributes.BonusStr -= 5;
                        hat.Attributes.WeaponSpeed = 0;
                        hat.Attributes.AttackChance = 0;
                        hat.Attributes.WeaponDamage = 0;
                        hat.ColdBonus = 0;
                    hat.FireBonus = 0;
                    hat.PhysicalBonus = 0;
                    hat.EnergyBonus = 0;
                    hat.PoisonBonus = 0;
    
                        //SolaretesOfBaal shoe = pm.FindItemOnLayer(Layer.Shoes) as SolaretesOfBaal;
                        //shoe.Hue = 1389;
    
                        //CloakOfBaal cape = pm.FindItemOnLayer(Layer.Cloak) as CloakOfBaal;
                        //cape.Hue = 1389;
    
                        GorgetOfBaal gorge = pm.FindItemOnLayer(Layer.Neck) as GorgetOfBaal;
                        gorge.Hue = 1389;
                        gorge.Attributes.BonusStr -= 5;
                        gorge.Attributes.WeaponSpeed = 0;
                        gorge.Attributes.AttackChance = 0;
                        gorge.Attributes.WeaponDamage = 0;
                        gorge.ColdBonus = 0;
                    gorge.FireBonus = 0;
                    gorge.PhysicalBonus = 0;
                    gorge.EnergyBonus = 0;
                    gorge.PoisonBonus = 0;
    
                        LegsOfBaal legs = pm.FindItemOnLayer(Layer.Pants) as LegsOfBaal;
                        legs.Hue = 1389;
                        legs.Attributes.BonusStr -= 5;
                        legs.Attributes.WeaponSpeed = 0;
                        legs.Attributes.AttackChance = 0;
                        legs.Attributes.WeaponDamage = 0;
                        legs.ColdBonus = 0;
                    legs.FireBonus = 0;
                    legs.PhysicalBonus = 0;
                    legs.EnergyBonus = 0;
                    legs.PoisonBonus = 0;
    
                        BreastplateOfBaal tunic = pm.FindItemOnLayer(Layer.InnerTorso) as BreastplateOfBaal;
                        tunic.Hue = 1389;
                        tunic.Attributes.BonusStr -= 5;
                        tunic.Attributes.WeaponSpeed = 0;
                        tunic.Attributes.AttackChance = 0;
                        tunic.Attributes.WeaponDamage = 0;
                        tunic.ColdBonus = 0;
                    tunic.FireBonus = 0;
                    tunic.PhysicalBonus = 0;
                    tunic.EnergyBonus = 0;
                    tunic.PoisonBonus = 0;
                        //End of Edit by Warmaster.
                    }
                }
                return;
            }
      
            public ArmsOfBaal(Serial serial)
                : base(serial)
            {
            }
    
            public override void Serialize(GenericWriter writer)
            {
                base.Serialize(writer);
                writer.Write((int)0);
    
                if (Weight == 1.0)
                    Weight = 2.0;
            }
    
            public override void Deserialize(GenericReader reader)
            {
                base.Deserialize(reader);
                int version = reader.ReadInt();
            }
        }
    }
    Thanks in advance for the help!!!
     
  2. Enroq

    Enroq Sorceror

    Joined:
    Jan 28, 2011
    Messages:
    1,970
    Likes Received:
    245
    For the first part of not obtaining the strength bonuses.. this is most likely because OnEquip is what applies these bonuses and they're already equipped.

    https://github.com/runuo/runuo/blob/master/Scripts/Items/Armor/BaseArmor.cs#L1243

    You should call OnEquip for each of these items after you change the attributes.

    Code:
    tunic.OnEquip(from);
    The second issue is likely because OnRemove is an override method which means it's not calling the OnRemove method from the inherited class, BaseArmor.

    https://github.com/runuo/runuo/blob/master/Scripts/Items/Armor/BaseArmor.cs#L1268

    You should be able to fix this by adding a call to the base method before you remove the attributes in the OnRemove override.

    Code:
    base.OnRemove(parent)
     
    maybeshewill and rome1982 like this.
  3. rome1982

    rome1982 Sorceror

    Joined:
    Feb 10, 2009
    Messages:
    93
    Likes Received:
    6
    Solved,there is a problem with the gorget individual file.
    Thank you so much for your help!!!
     
    #3 rome1982, Feb 11, 2018
    Last edited: Feb 11, 2018

Share This Page