[RUO 2.0 - SVN 269] Summoned Ore Elementals Spell

Anything regarding UO or Age of Valor
Locked
User avatar
Dumples
Posts: 484
Joined: Fri Jan 05, 2007 4:57 pm

[RUO 2.0 - SVN 269] Summoned Ore Elementals Spell

Post by Dumples »

[RunUO 2.0 - SVN 269]

This is a replacement for the Summon Earth Elemental spell. This spell allows the caster to summon random ore elementals based on the casters magery and level of ore elemental. Lower level ore elementals will get summoned more often if the right amount of caster magery is met.

Let me know if there are any problems or questions. It seems like a pretty straight forward and simple script.

Installation
In the following default location RunUO/Scripts/Spells/Eighth/
Find the file named EarthElemental.cs

Rename or backup that file.

Replace that script with this information:

Code: Select all

using System;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;

namespace Server.Spells.Eighth
{
	public class EarthElementalSpell : MagerySpell
	{
		private static SpellInfo m_Info = new SpellInfo(
				"Earth Elemental", "Kal Vas Xen Ylem",
				269,
				9020,
				false,
				Reagent.Bloodmoss,
				Reagent.MandrakeRoot,
				Reagent.SpidersSilk
			);

		public override SpellCircle Circle { get { return SpellCircle.Eighth; } }

		public EarthElementalSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
		{
		}

		public override bool CheckCast()
		{
			if ( !base.CheckCast() )
				return false;

			if ( (Caster.Followers + 2) > Caster.FollowersMax )
			{
				Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
				return false;
			}

			return true;
		}

		public override void OnCast()
		{
			if ( CheckSequence() )
			{
				TimeSpan duration = TimeSpan.FromSeconds( (2 * Caster.Skills.Magery.Fixed) / 5 );

                double chance = Utility.RandomDouble();

                if (chance <= .60)
                    SpellHelper.Summon(new SummonedEarthElemental(), Caster, 0x217, duration, false, false);
                else if (chance <= .65)
                {
                    if (Caster.Skills.Magery.Value >= 85)
                        SpellHelper.Summon(new DullCopperElemental(), Caster, 0x217, duration, false, false);
                }

                else if (chance <= .70)
                {
                    if (Caster.Skills.Magery.Value >= 90)
                        SpellHelper.Summon(new ShadowIronElemental(), Caster, 0x217, duration, true, true);
                }
                else if (chance <= .75)
                {
                    if (Caster.Skills.Magery.Value >= 95)
                        SpellHelper.Summon(new CopperElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .80)
                {
                    if (Caster.Skills.Magery.Value >= 100)
                        SpellHelper.Summon(new BronzeElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .85)
                {
                    if (Caster.Skills.Magery.Value >= 105)
                        SpellHelper.Summon(new GoldenElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .90)
                {
                    if (Caster.Skills.Magery.Value >= 110)
                        SpellHelper.Summon(new AgapiteElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .95)
                {
                    if (Caster.Skills.Magery.Value >= 115)
                        SpellHelper.Summon(new VeriteElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .98)
                {
                    if (Caster.Skills.Magery.Value >= 120)
                        SpellHelper.Summon(new ValoriteElemental(), Caster, 0x217, duration, false, false);
                }
			}

			FinishSequence();
		}
	}
}


Extra, but not required step:
Open up your Ore Elemental files and add the a controlslots line to add balance to how many can be summoned.

Code: Select all

ControlSlots = 3;
I would suggest leaving the earth elemental at 2 slots. Make all the rest except the valorite 3 slots. Make the valorite 4 or 5 slots.

Archived topic from AOV, old topic ID:1863, old post ID:12098
Image
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

[RUO 2.0 - SVN 269] Summoned Ore Elementals Spell

Post by Red Squirrel »

Think this script could possibly cause to summon nothing, since theres a chance that all ifs return false.

What you should do is:

else if (chance <= .65 && Caster.Skills.Magery.Value >= 85)
{
SpellHelper.Summon(new DullCopperElemental(), Caster, 0x217, duration, false, false);
}

And so on. Then the last one could be just a regular else, and default to regular if none make it. You could also incorporate the magery into chance.

So

int chance = Utility.Random(Caster.Skills.Magery.Value);

Then

if(chance>120) and so on.


I like the concept behind this though.

Archived topic from AOV, old topic ID:1863, old post ID:12099
Honk if you love Jesus, text if you want to meet Him!
User avatar
Dumples
Posts: 484
Joined: Fri Jan 05, 2007 4:57 pm

[RUO 2.0 - SVN 269] Summoned Ore Elementals Spell

Post by Dumples »

I see what you mean with the regular one being at the end as a fail over. My mistake. I like the seperate magery test the way I have it for now. It seems to make more sense to me, and seems like it leaves flexibility to be changed later. I dunno.

I took your other suggestion and changed it to this:

Code: Select all

using System;
using Server.Mobiles;
using Server.Network;
using Server.Targeting;

namespace Server.Spells.Eighth
{
	public class EarthElementalSpell : MagerySpell
	{
		private static SpellInfo m_Info = new SpellInfo(
				"Earth Elemental", "Kal Vas Xen Ylem",
				269,
				9020,
				false,
				Reagent.Bloodmoss,
				Reagent.MandrakeRoot,
				Reagent.SpidersSilk
			);

		public override SpellCircle Circle { get { return SpellCircle.Eighth; } }

		public EarthElementalSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
		{
		}

		public override bool CheckCast()
		{
			if ( !base.CheckCast() )
				return false;

			if ( (Caster.Followers + 2) > Caster.FollowersMax )
			{
				Caster.SendLocalizedMessage( 1049645 ); // You have too many followers to summon that creature.
				return false;
			}

			return true;
		}

		public override void OnCast()
		{
			if ( CheckSequence() )
			{
				TimeSpan duration = TimeSpan.FromSeconds( (2 * Caster.Skills.Magery.Fixed) / 5 );

                double chance = Utility.RandomDouble();


                
                
                if (chance <= .60) //This has to be there so that everything under 65% are regular earth elementals
                {
                	if (Caster.Skills.Magery.Value >= 85)
                    SpellHelper.Summon(new SummonedEarthElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .65)
                {
                	if (Caster.Skills.Magery.Value >= 85)
                        SpellHelper.Summon(new DullCopperElemental(), Caster, 0x217, duration, false, false);
                }

                else if (chance <= .70)
                {
                    if (Caster.Skills.Magery.Value >= 90)
                        SpellHelper.Summon(new ShadowIronElemental(), Caster, 0x217, duration, true, true);
                }
                else if (chance <= .75)
                {
                    if (Caster.Skills.Magery.Value >= 95)
                        SpellHelper.Summon(new CopperElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .80)
                {
                    if (Caster.Skills.Magery.Value >= 100)
                        SpellHelper.Summon(new BronzeElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .85)
                {
                    if (Caster.Skills.Magery.Value >= 105)
                        SpellHelper.Summon(new GoldenElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .90)
                {
                    if (Caster.Skills.Magery.Value >= 110)
                        SpellHelper.Summon(new AgapiteElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .95)
                {
                    if (Caster.Skills.Magery.Value >= 115)
                        SpellHelper.Summon(new VeriteElemental(), Caster, 0x217, duration, false, false);
                }
                else if (chance <= .99)
                {
                    if (Caster.Skills.Magery.Value >= 120)
                        SpellHelper.Summon(new ValoriteElemental(), Caster, 0x217, duration, false, false);
                }
                else  //This is a fail over in case any of the IF statements fail.  A regular summon will occur
                    SpellHelper.Summon(new SummonedEarthElemental(), Caster, 0x217, duration, false, false);
			}

			FinishSequence();
		}
	}
}
Archived topic from AOV, old topic ID:1863, old post ID:12117
Image
Locked