Opywang

Member
Hi there I've been looking for ways to make artifacts rare throughout the game, and I found something from some where then I edit, and transform it into Heart of the Lion, and I am happy with the work I did, but I want to make it more stronger, but it is not rare enough for it to be stronger.

I was hoping somebody can help me fix this to make it give mods like in chance 1 in some number would be great, or if anybody can think of an idea how to make it super rare for a very good pieces?

Here is a video this will give you an idea what this script does, and I am pleased with how it does, but I want to make it more stronger due to rarity, and at the moment it is not rare enough to make it any stronger than what it have.

https://gyazo.com/7d93d02b048078374765e62fd1ad69cb

Code:
// Scripted by Thor86
using System;
using Server;

namespace Server.Items
{
    public class HeartOfTheLion : PlateChest
	{
        //public override int ArtifactRarity{ get{ return 6; } }
        //public override int ArtifactRarity { get { return Utility.RandomMinMax(1, 10); } }

        public override int BasePhysicalResistance{ get{ return 0; } }
		public override int BaseFireResistance{ get{ return 0; } } 
		public override int BaseColdResistance{ get{ return 0; } }
		public override int BasePoisonResistance{ get{ return 0; } }
		public override int BaseEnergyResistance{ get{ return 0; } }

        public override bool AllowMaleWearer { get { return true; } }
	 	public override int InitMinHits{ get{ return 255; } }
	 	public override int InitMaxHits{ get{ return 255; } }

        private static string[] m_Names = new string[]
		{
                  // names based off past expanions
			"Heart of the Lion",
		};

	 	[Constructable]
	 	public HeartOfTheLion()
	 	{
            Name = m_Names[Utility.Random(m_Names.Length)];
            //Hue = Utility.RandomMinMax(5, 3000);
            // Name = "Artifact Arms";

            // random chance to get diffent resist %
			PhysicalBonus = Utility.RandomMinMax(15, 25);
            FireBonus = Utility.RandomMinMax( 10, 20);
            ColdBonus = Utility.RandomMinMax(10, 20);
            PoisonBonus = Utility.RandomMinMax(10, 20);
            EnergyBonus = Utility.RandomMinMax(10, 20);
			Hue = 0x501;
			Attributes.Luck = 95;
            Attributes.DefendChance = 15;
            ArmorAttributes.LowerStatReq = 100;
            ArmorAttributes.MageArmor = 1;
           

            // id it shows item as
            switch (Utility.Random(1))
            {
                //case 0: ItemID = 5141; break; //
				//case 1: ItemID = 5141; break;//ringmail
                //case 2: ItemID = 5141; break;//virute
                case 0: ItemID = 5141; break;//platemail
                //case 4: ItemID = 5141; break;//leather 
            }
            // random chance to get these stats added to item ,chance of one stat per switch
            switch (Utility.Random(5))
            {
                case 0: Attributes.RegenHits = Utility.RandomMinMax(1, 4); break;
                case 1: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 2: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 3: Attributes.DefendChance = Utility.RandomMinMax(15, 45); break;
                case 4: Attributes.AttackChance = Utility.RandomMinMax(1, 20); break;
				
            }
            switch (Utility.Random(6))
            {
                case 0: Attributes.BonusStr = Utility.RandomMinMax(1, 5); break;
                case 1: Attributes.BonusDex = Utility.RandomMinMax(1, 5); break;
                case 2: Attributes.BonusInt = Utility.RandomMinMax(1, 5); break;
                case 3: Attributes.BonusHits = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.BonusStam = Utility.RandomMinMax(1, 20); break;
                case 5: Attributes.BonusMana = Utility.RandomMinMax(1, 20); break;
            }
            switch (Utility.Random(8))
            {
                case 0: Attributes.WeaponDamage = Utility.RandomMinMax(1, 25); break;
                case 1: Attributes.WeaponSpeed = Utility.RandomMinMax(1, 10); break;
                case 2: Attributes.SpellDamage = Utility.RandomMinMax(1, 25); break;
                case 3: Attributes.CastRecovery = Utility.RandomMinMax(1, 2); break;
                case 4: Attributes.CastSpeed = Utility.RandomMinMax(1, 2); break;
            }
            switch (Utility.Random(6))
            {
                case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
                case 5: Attributes.NightSight = 1; break;
            }
            switch (Utility.Random(8))
            {
                case 0: Attributes.WeaponDamage = Utility.RandomMinMax(1, 50); break;
                case 1: Attributes.WeaponSpeed = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.SpellDamage = Utility.RandomMinMax(1, 50); break;
                case 3: Attributes.CastRecovery = Utility.RandomMinMax(1, 6); break;
                case 4: Attributes.CastSpeed = Utility.RandomMinMax(1, 4); break;
            }
            //Disadvantages
            // can be brittle 
            switch (Utility.Random(2))
            {
                case 0: Attributes.Brittle = 1; break;
            }
            // can be cursed 
            switch (Utility.Random(2)) { case 0: LootType = LootType.Cursed; break; }

            // can be unlucky
            switch (Utility.Random(2))
            {
                case 0: Attributes.Luck = 95; break;
            }
        }
	 	public HeartOfTheLion(Serial serial) : base( serial )
	 	{
	 	}
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
 
Last edited:
Oh interesting! Nice thank you
[doublepost=1527006511][/doublepost]I tried it, and got error I am not sure where I am suppose to put it, and I use this, and this is my error.

  • if (Utility.RandomDouble() > 0.1) // 10% chance
  • {
  • Attributes.BonusMana = Utility.RandomMinMax(20, 20); break;
  • {

Here is error


Errors:
+ Items/Artifacts/Equipment/Armor/HeartOfTheLion.cs:
CS1519: Line 118: Invalid token 'case' in class, struct, or interface member declaration
CS1519: Line 118: Invalid token '=' in class, struct, or interface member declaration
astatic_wireclub_com_i_VB3ouEanSgSYkiDu0_70_4_21_.jpg Opywang
astatic.wireclub.com_content_images_icons_chat_powers.png_5e1f15b6b06c4b6cc29ea86fae840200.pngastatic.wireclub.com_content_images_icons_chat_drink.png_5e1f15b6b06c4b6cc29ea86fae840200.png
[doublepost=1527042400][/doublepost]O.K. I manage to get it where it has no error, but it is not adding the property so I will copy, and paste the entire code for you to check it out.

I put your code in line 100, and this is what I have it is not adding any property at all. I made it 1.0 for 100% chance.

  1. if (Utility.RandomDouble() > 1.0) // 10% chance
  2. {
  3. Attributes.ReflectPhysical = Utility.RandomMinMax(99, 100);
  4. }

Code:
// Scripted by Thor86
using System;
using Server;

namespace Server.Items
{
    public class HeartOfTheLion : PlateChest
    {
        //public override int ArtifactRarity{ get{ return 6; } }
        //public override int ArtifactRarity { get { return Utility.RandomMinMax(1, 10); } }

        public override int BasePhysicalResistance{ get{ return 0; } }
        public override int BaseFireResistance{ get{ return 0; } }
        public override int BaseColdResistance{ get{ return 0; } }
        public override int BasePoisonResistance{ get{ return 0; } }
        public override int BaseEnergyResistance{ get{ return 0; } }

        public override bool AllowMaleWearer { get { return true; } }
         public override int InitMinHits{ get{ return 255; } }
         public override int InitMaxHits{ get{ return 255; } }

        private static string[] m_Names = new string[]
        {
                  // names based off past expanions
            "Heart of the Lion",
        };

         [Constructable]
         public HeartOfTheLion()
         {
            Name = m_Names[Utility.Random(m_Names.Length)];
            //Hue = Utility.RandomMinMax(5, 3000);
            // Name = "Artifact Arms";

            // random chance to get diffent resist %
            PhysicalBonus = Utility.RandomMinMax(15, 20);
            FireBonus = Utility.RandomMinMax( 10, 15);
            ColdBonus = Utility.RandomMinMax(10, 15);
            PoisonBonus = Utility.RandomMinMax(10, 15);
            EnergyBonus = Utility.RandomMinMax(10, 15);
            Hue = 0x501;
            Attributes.Luck = 95;
            Attributes.DefendChance = 15;
            ArmorAttributes.LowerStatReq = 100;
            ArmorAttributes.MageArmor = 1;
         
            // id it shows item as
            switch (Utility.Random(1))
            {
                //case 0: ItemID = 5141; break; //
                //case 1: ItemID = 5141; break;//ringmail
                //case 2: ItemID = 5141; break;//virute
                case 0: ItemID = 5141; break;//platemail
                //case 4: ItemID = 5141; break;//leather
            }
            // random chance to get these stats added to item ,chance of one stat per switch
            switch (Utility.Random(5))
            {
                case 0: Attributes.RegenHits = Utility.RandomMinMax(1, 4); break;
                case 1: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 2: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 3: Attributes.DefendChance = Utility.RandomMinMax(15, 45); break;
                case 4: Attributes.AttackChance = Utility.RandomMinMax(1, 20); break;
             
            }
            switch (Utility.Random(8))
            {
                case 0: Attributes.BonusStr = Utility.RandomMinMax(1, 5); break;
                case 1: Attributes.BonusDex = Utility.RandomMinMax(1, 5); break;
                case 2: Attributes.BonusInt = Utility.RandomMinMax(1, 5); break;
                case 3: Attributes.BonusHits = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.BonusStam = Utility.RandomMinMax(1, 20); break;
                case 5: Attributes.BonusMana = Utility.RandomMinMax(1, 20); break;
            } 
                switch (Utility.Random(6))
            {
                case 0: Attributes.WeaponDamage = Utility.RandomMinMax(1, 25); break;
                case 1: Attributes.WeaponSpeed = Utility.RandomMinMax(1, 10); break;
                case 2: Attributes.SpellDamage = Utility.RandomMinMax(1, 25); break;
                case 3: Attributes.CastRecovery = Utility.RandomMinMax(1, 2); break;
                case 4: Attributes.CastSpeed = Utility.RandomMinMax(1, 2); break;
            }
            switch (Utility.Random(6))
            {
                case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
                case 5: Attributes.NightSight = 1; break;
            }
            switch (Utility.Random(8))
            {
                case 0: Attributes.WeaponDamage = Utility.RandomMinMax(1, 50); break;
                case 1: Attributes.WeaponSpeed = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.SpellDamage = Utility.RandomMinMax(1, 50); break;
                case 3: Attributes.CastRecovery = Utility.RandomMinMax(1, 6); break;
                case 4: Attributes.CastSpeed = Utility.RandomMinMax(1, 4); break;
            }
            if (Utility.RandomDouble() > 1.0) // 10% chance
            {
            Attributes.ReflectPhysical = Utility.RandomMinMax(99, 100);
            }
        }
            //Disadvantages
            // can be brittle
            //switch (Utility.Random(2))
            //{
            //    case 0: Attributes.Brittle = 1; break;
            //}
            // can be cursed
            //switch (Utility.Random(2)) { case 0: LootType = LootType.Cursed; break; }

            // can be unlucky
            //switch (Utility.Random(2))
            //{
              //  case 0: Attributes.Luck = 95; break;
            //}
        //}
         public HeartOfTheLion(Serial serial) : base( serial )
         {
         }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
[doublepost=1527045092][/doublepost]O.K. success I had to use other that I had before, and it works.

Code:
}
            double chance = Utility.RandomDouble();
            if (chance < 0.5) // 5% chance for drop
            {
            Attributes.Luck = 950;
            }
        }
[doublepost=1527074341][/doublepost]Hey I am trying to make multiple one any idea how I can make more than one?

I want to make a few level of grade like common, good, rare, and epic for each one.

Or maybe it'll have random chance?
 
Last edited:
Code:
           double chance = Utility.RandomDouble();
           if (chance < 0.5) // 50% chance for drop          
{
  
switch (Utility.Random(6))
            {
                case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
                case 5: Attributes.NightSight = 1; break;
}
}

0.5 - it's 50% chance. If you need 5% - use 0.05
 
There was a bracket, and is this bracket {?

There was a bracket there it just saying it's not working, or something.

If you wouldn't mind fixing this is what I have, and it doesn't work.

Here is latest error

CS1513: Line 107: } expected

Code:
// Scripted by Thor86
using System;
using Server;

namespace Server.Items
{
    public class HeartOfTheLion : PlateChest
    {
        //public override int ArtifactRarity{ get{ return 6; } }
        //public override int ArtifactRarity { get { return Utility.RandomMinMax(1, 10); } }

        public override int BasePhysicalResistance{ get{ return 0; } }
        public override int BaseFireResistance{ get{ return 0; } }
        public override int BaseColdResistance{ get{ return 0; } }
        public override int BasePoisonResistance{ get{ return 0; } }
        public override int BaseEnergyResistance{ get{ return 0; } }

        public override bool AllowMaleWearer { get { return true; } }
         public override int InitMinHits{ get{ return 255; } }
         public override int InitMaxHits{ get{ return 255; } }

        private static string[] m_Names = new string[]
        {
                  // names based off past expanions
            "Heart of the Lion",
        };

         [Constructable]
         public HeartOfTheLion()
         {
            Name = m_Names[Utility.Random(m_Names.Length)];
            //Hue = Utility.RandomMinMax(5, 3000);
            // Name = "Artifact Arms";

            // random chance to get diffent resist %
            PhysicalBonus = Utility.RandomMinMax(15, 20);
            FireBonus = Utility.RandomMinMax( 10, 15);
            ColdBonus = Utility.RandomMinMax(10, 15);
            PoisonBonus = Utility.RandomMinMax(10, 15);
            EnergyBonus = Utility.RandomMinMax(10, 15);
            Hue = 0x501;
            Attributes.DefendChance = 15;
            Attributes.Luck = 95;
            ArmorAttributes.LowerStatReq = 100;
            ArmorAttributes.MageArmor = 1;
         
            // id it shows item as
            switch (Utility.Random(1))
            {
                //case 0: ItemID = 5141; break; //
                //case 1: ItemID = 5141; break;//ringmail
                //case 2: ItemID = 5141; break;//virute
                case 0: ItemID = 5141; break;//platemail
                //case 4: ItemID = 5141; break;//leather
            }
            // random chance to get these stats added to item ,chance of one stat per switch
            switch (Utility.Random(5))
            {
                case 0: Attributes.RegenHits = Utility.RandomMinMax(1, 4); break;
                case 1: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 2: Attributes.RegenStam = Utility.RandomMinMax(1, 4); break;
                case 3: Attributes.DefendChance = Utility.RandomMinMax(15, 45); break;
                case 4: Attributes.AttackChance = Utility.RandomMinMax(1, 20); break;
             
            }
            switch (Utility.Random(8))
            {
                case 0: Attributes.BonusStr = Utility.RandomMinMax(1, 5); break;
                case 1: Attributes.BonusDex = Utility.RandomMinMax(1, 5); break;
                case 2: Attributes.BonusInt = Utility.RandomMinMax(1, 5); break;
                case 3: Attributes.BonusHits = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.BonusStam = Utility.RandomMinMax(1, 20); break;
                case 5: Attributes.BonusMana = Utility.RandomMinMax(1, 20); break;
            } 
                switch (Utility.Random(6))
            {
                //case 0: Attributes.WeaponDamage = Utility.RandomMinMax(1, 25); break;
                //case 0: Attributes.WeaponSpeed = Utility.RandomMinMax(1, 10); break;
                case 0: Attributes.SpellDamage = Utility.RandomMinMax(1, 25); break;
                case 1: Attributes.CastRecovery = Utility.RandomMinMax(1, 2); break;
                case 2: Attributes.CastSpeed = Utility.RandomMinMax(1, 2); break;
            }
            switch (Utility.Random(6))
            {
                case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.Luck = Utility.RandomMinMax(95, 200); break;
                case 5: Attributes.NightSight = 1; break;
            }
         
            switch (Utility.Random(8))
         double chance = Utility.RandomDouble();
           if (chance < 0.5) // 50% chance for drop       
{
switch (Utility.Random(6))
            {
                case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
                case 5: Attributes.NightSight = 1; break;
}
}
     
 
     
 
            //Disadvantages
            // can be brittle
            //switch (Utility.Random(2))
            //{
            //    case 0: Attributes.Brittle = 1; break;
            //}
            // can be cursed
            //switch (Utility.Random(2)) { case 0: LootType = LootType.Cursed; break; }

            // can be unlucky
            //switch (Utility.Random(2))
            //{
              //  case 0: Attributes.Luck = 95; break;
            //}
        //}
         public HeartOfTheLion(Serial serial) : base( serial )
         {
         }
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)0);
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
        }
    }
}
 
Last edited:
Replace this:
  • switch (Utility.Random(8))
  • double chance = Utility.RandomDouble();
  • if (chance < 0.5) // 50% chance for drop
  • {
  • switch (Utility.Random(6))
  • {
  • case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
  • case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
  • case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
  • case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
  • case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
  • case 5: Attributes.NightSight = 1; break;
  • }
  • }
to:
Code:
            double chance = Utility.RandomDouble();
            if (chance < 0.5) // 50% chance for drop     
            {
                switch (Utility.Random(6))
                {
                    case 0: Attributes.LowerManaCost = Utility.RandomMinMax(1, 10); break;
                    case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
                    case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
                    case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
                    case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
                    case 5: Attributes.NightSight = 1; break;
                }
            }
        }
 
Wow it work! Thank you so much!
[doublepost=1527203549][/doublepost]Ok I am trying to make more than one with diffrent % drop chance how can I add more than 1?

double chance = Utility.RandomDouble();
if (chance < 0.5) // 50% chance for drop
{
switch (Utility.Random(6))
{
case 0: Attributes.DefendChance = 15;
Attributes.LowerManaCost = Utility.RandomMinMax(1, 10);
Attributes.EnhancePotions = Utility.RandomMinMax(1, 20);break;
case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
case 5: Attributes.NightSight = 1; break;
}
}
}

{
switch (Utility.Random(6))
{
case 0: Attributes.DefendChance = 15;
Attributes.LowerManaCost = Utility.RandomMinMax(1, 10);
Attributes.EnhancePotions = Utility.RandomMinMax(1, 20);break;
case 1: Attributes.LowerRegCost = Utility.RandomMinMax(1, 20); break;
case 2: Attributes.ReflectPhysical = Utility.RandomMinMax(1, 20); break;
case 3: Attributes.EnhancePotions = Utility.RandomMinMax(1, 20); break;
case 4: Attributes.Luck = Utility.RandomMinMax(95, 475); break;
case 5: Attributes.NightSight = 1; break;
}
}
}
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back