RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Stat Deeds help

Hammerhand

Knight
Stat Deeds help

I'm currently revamping my Dragonkin event pack using Kiasta's new upgradable Dragonkin weapons system. So far, so good, but.. it also comes with 47 custom ItemStatDeeds. What I'm wanting to do is add them to the Dragonkin loot in a bag of 5 with the deeds being random. Not exactly sure how to call them or even where to begin. Below is one of the deeds. Any help would be appreciated. Trying to call either BaseItemStatDeed or just ItemStatDeed got me errors of the "cant find it" type..
Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Targeting;
using Server;

namespace Server.Items
{
    public class AttackChanceTarget : Target
    {
        private AttackChanceDeed m_Deed;

        public AttackChanceTarget(AttackChanceDeed deed)
            : base(1, false, TargetFlags.None)
        {
            m_Deed = deed;
        }

        protected override void OnTarget(Mobile from, object target)
        {
            if (m_Deed.Deleted || m_Deed.RootParent != from)
            {
                from.SendMessage("You cannot add attack chance increase to that.");
                return;
            }
            if (target is BaseDragonkinWeapon)
            {
                BaseDragonkinWeapon item = (BaseDragonkinWeapon)target;
                if (item is BaseDragonkinWeapon)
                {
                    if (((BaseDragonkinWeapon)item).Attributes.AttackChance >= 100)
                    {
                        from.SendMessage("That item has max attack chance increase.");
                    }
                    else
                    {
                        ((BaseDragonkinWeapon)item).Attributes.AttackChance += 5;
                        from.SendMessage("Attack chance increase successfully added to item.");
                        m_Deed.Delete();
                    }
                }
            }
            else if (target is BaseDragonkinArmor)
            {
                BaseDragonkinArmor item = (BaseDragonkinArmor)target;
                if (item is BaseDragonkinArmor)
                {
                    if (((BaseDragonkinArmor)item).Attributes.AttackChance >= 100)
                    {
                        from.SendMessage("That item has max attack chance increase.");
                    }
                    else
                    {
                        ((BaseDragonkinArmor)item).Attributes.AttackChance += 5;
                        from.SendMessage("Attack chance increase successfully added to item.");
                        m_Deed.Delete();
                    }
                }
            }
            else if (target is BaseDragonkinShield)
            {
                BaseDragonkinShield item = (BaseDragonkinShield)target;
                if (item is BaseDragonkinShield)
                {
                    if (((BaseDragonkinShield)item).Attributes.AttackChance >= 100)
                    {
                        from.SendMessage("That item has max attack chance increase.");
                    }
                    else
                    {
                        ((BaseDragonkinShield)item).Attributes.AttackChance += 5;
                        from.SendMessage("Attack chance increase successfully added to item.");
                        m_Deed.Delete();
                    }
                }
            }
            else if (target is BaseDragonkinClothing)
            {
                BaseDragonkinClothing item = (BaseDragonkinClothing)target;
                if (item is BaseDragonkinClothing)
                {
                    if (((BaseDragonkinClothing)item).Attributes.AttackChance >= 100)
                    {
                        from.SendMessage("That item has max attack chance increase.");
                    }
                    else
                    {
                        ((BaseDragonkinClothing)item).Attributes.AttackChance += 5;
                        from.SendMessage("Attack chance increase successfully added to item.");
                        m_Deed.Delete();
                    }
                }
            }
            else if (target is BaseDragonkinJewel)
            {
                BaseDragonkinJewel item = (BaseDragonkinJewel)target;
                if (item is BaseDragonkinJewel)
                {
                    if (((BaseDragonkinJewel)item).Attributes.AttackChance >= 100)
                    {
                        from.SendMessage("That item has max attack chance increase.");
                    }
                    else
                    {
                        ((BaseDragonkinJewel)item).Attributes.AttackChance += 5;
                        from.SendMessage("Attack chance increase successfully added to item.");
                        m_Deed.Delete();
                    }
                }
            }
            else
            {
                from.SendMessage("You cannot put attack chance increase on that.");
            }
        }
    }

    public class AttackChanceDeed : BaseItemStatDeed
    {
        [Constructable]
        public AttackChanceDeed()
            : base(0x14F0)
        {
            LootType = LootType.Blessed;
            Name = "a attack chance increase deed";
            Hue = 1150;
            Weight = 1.0;
        }

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

        public override void OnDoubleClick(Mobile from)
        {
            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("The item needs to be in your pack");
            }
            else
            {
                from.SendMessage("Which item would you like to add attack chance increase to?");
                from.Target = new AttackChanceTarget(this);
            }
        }
    }
}
 

Hammerhand

Knight
I actually got the error part to stop when I changed this
Code:
    public class AttackChanceDeed : [COLOR="Red"]BaseItemStatDeed[/COLOR]
    {
        [Constructable]
        public AttackChanceDeed()
            : base(0x14F0)
to this
Code:
    public class AttackChanceDeed : [COLOR="Blue"]Item[/COLOR]
    {
        [Constructable]
        public AttackChanceDeed()
            : base(0x14F0)
It compiles fine now, but while I can add it using [add deed and then scrolling to it, the bag it spawns in for loot shows 1 item, but is empty. Its like it doesnt construct itself. I even removed the LootType = Blessed.
The error was saying type or namespace couldnt be found.
I put it in the monster script like so.. taken from Juka Lord for testing purposes.
Code:
            Container pack = new Backpack();

            pack.DropItem(new AttackChanceDeed(Utility.RandomMinMax(2, 5)));
            PackItem(pack);
 

Hammerhand

Knight
I've gotten them to drop with no changes to the deed scripts with this.
Code:
            Container pack = new Backpack();
            pack.DropItem(new BonusDexDeed());
            pack.DropItem(new AttackChanceDeed());
            pack.DropItem(new WeaponSpeedDeed());
            pack.DropItem(new HitLightningDeed());
            pack.DropItem(new BlessDeed());
            PackItem(pack);
Drops one of each with no problems, but that isnt quite what I was wanting. Even with a random setup, it would require all of them to be in the script. I've been looking at the LootPack.cs with how it has the different level of scrolls listed and I'm wondering if that might be the answer. Either adding them into the LootPack.cs or creating one just for the Dragonkin system. This is the area I'm looking at.
Code:
	public class LootPackItem
	{
		private Type m_Type;
		private int m_Chance;

		public Type Type
		{
			get{ return m_Type; }
			set{ m_Type = value; }
		}

		public int Chance
		{
			get{ return m_Chance; }
			set{ m_Chance = value; }
		}

		private static Type[]   m_BlankTypes = new Type[]{ typeof( BlankScroll ) };
		private static Type[][] m_NecroTypes = new Type[][]
			{
				new Type[] // low
				{
					typeof( AnimateDeadScroll ),		typeof( BloodOathScroll ),		typeof( CorpseSkinScroll ),	typeof( CurseWeaponScroll ),
					typeof( EvilOmenScroll ),			typeof( HorrificBeastScroll ),	typeof( MindRotScroll ),	typeof( PainSpikeScroll ),
					typeof( SummonFamiliarScroll ),		typeof( WraithFormScroll )
				},
Lists the scrolls by "level" for the LootPack drop chance. If we can get that to work out, then the random drop should work.
 

Hammerhand

Knight
I've been working on the LootPack.cs as well, but so far have 1 error I cant get gone. However... I have also copied & modified the Loot.cs. See if this helps. Removed all the original types & such and just added in the stat deeds. Name is DragonkinLoot.cs I'm headed to work, so I'll check back tonight.
Code:
using System;
using System.IO;
using System.Reflection;
using Server;
using Server.Items;

namespace Server
{
	public class DragonkinLoot
	{
		#region List definitions

		private static Type[] m_ItemStatDeedTypes = new Type[]
			{
				typeof( AttackChanceDeed ),  typeof( BlessDeed ),  typeof( BonusDexDeed ),  typeof( BonusHitsDeed ),
				typeof( BonusIntDeed ),  typeof( BonusManaDeed ),  typeof( BonusStamDeed ),  typeof( BonusStrDeed ),
				typeof( DefenseChanceDeed ),  typeof( DurabilityBonusDeed ),  typeof( EnhancePotionsDeed ),  typeof( CastSpeedDeed ),
				typeof( CastRecoveryDeed ),  typeof( HitColdAreaDeed ),  typeof( HitDispelDeed ),  typeof( HitEnergyAreaDeed ),
				typeof( HitFireAreaDeed ),  typeof( HitFireballDeed ),  typeof( HitHarmDeed ),  typeof( HitLifeLeechDeed ),
				typeof( HitLightningDeed ),  typeof( HitLowerAttackDeed ),  typeof( HitMagicArrowDeed ),  typeof( HitManaLeechDeed ),
				typeof( HitPhysicalAreaDeed ), typeof( HitPoisonAreaDeed ),  typeof( HitStamLeechDeed ),  typeof( LowerManaCostDeed ),
				typeof( LowerRegCostDeed ),  typeof( LuckDeed ),  typeof( NightSightDeed ),  typeof( ReflectPhysicalDeed ),
				typeof( RegenHitsDeed ),  typeof( RegenManaDeed ),  typeof( RegenStamDeed ),  typeof( ResistColdBonusDeed ),
				typeof( ResistEnergyBonusDeed ),  typeof( ResistFireBonusDeed ),  typeof( ResistPhysicalBonusDeed ),  typeof( ResistPoisonBonusDeed ),
				typeof( SelfRepairDeed ),  typeof( SpellChannelingDeed ),  typeof( SpellDamageDeed ),  typeof( WeaponSpeedDeed ),
				typeof( UseBestSkillDeed ),	typeof( WeaponDamageDeed )		
			};


		#endregion

		#region Accessors


		public static ItemStatDeed RandomDeed( int minIndex, int maxIndex, ItemStatDeedType type )
		{
			Type[] types;

			switch ( type )
			{
				default:
				case ItemStatType.Regular: types = m_ItemStatDeedTypes; break;
			}

			return Construct( types, Utility.RandomMinMax( minIndex, maxIndex ) ) as ItemStatDeed;
		}
		#endregion

		#region Construction methods
		public static Item Construct( Type type )
		{
			try
			{
				return Activator.CreateInstance( type ) as Item;
			}
			catch
			{
				return null;
			}
		}

		public static Item Construct( Type[] types )
		{
			if ( types.Length > 0 )
				return Construct( types, Utility.Random( types.Length ) );

			return null;
		}

		public static Item Construct( Type[] types, int index )
		{
			if ( index >= 0 && index < types.Length )
				return Construct( types[index] );

			return null;
		}

		public static Item Construct( params Type[][] types )
		{
			int totalLength = 0;

			for ( int i = 0; i < types.Length; ++i )
				totalLength += types[i].Length;

			if ( totalLength > 0 )
			{
				int index = Utility.Random( totalLength );

				for ( int i = 0; i < types.Length; ++i )
				{
					if ( index >= 0 && index < types[i].Length )
						return Construct( types[i][index] );

					index -= types[i].Length;
				}
			}

			return null;
		}
		#endregion
	}
}
 

Hammerhand

Knight
Looks like we were heading in the same general direction for the most part. All I was intending to do was put the deeds in the lootpack. The armor, weapons & jewelry were going on the Dragonkin monsters I had created, like so. This is from my Dragonkin WarriorLord. I just need to change the loot drop itself and its good.
Code:
            AddLoot(LootPack.ItemStatDeeds, 3);

            switch (Utility.Random(25)) 
            {
                case 0: PackItem(new DragonkinCuirass());
                    break;
            }
            switch (Utility.Random(25))  
            {
                case 1: PackItem(new DragonkinPauldrons());
                    break;
            }
            switch (Utility.Random(25))
            {
                case 2: PackItem(new DragonkinGreaves());
                    break;
            }
            switch (Utility.Random(25))
            {
                case 3: PackItem(new DragonkinBlade());
                    break;
            }
            switch (Utility.Random(25))
            {
                case 4: PackItem(new DragonkinGauntlets());
                    break;
            }
            switch (Utility.Random(25))
            {
                case 5: PackItem(new DragonkinHelm());
                    break;
            }
            switch (Utility.Random(25))
            {
                case 6: PackItem(new DragonkinShield());
                    break;
            }
Other "levels" of Dragonkin would be getting less armor & weapons to randomly drop. With some mage types for the jewelry. WarriorLords also ride swamp dragons. Figure this way, the armor, weapons & jewelry become "rares" and players will be buying, selling & trading deeds because those arent nearly as rare. Whatcha think? :D
 

Hammerhand

Knight
Thats some old stuff from when I was first trying scripting. I dug it out and am in the process of changing it. My old Dragonkin invasion event pack. I'm revamping it using Kiasta's upgradable weapon system. I've added the deeds for it into the lootpack/loot scripts to drop a random 3 at a time out of the 47 total deeds and am adding the armor, weapons & jewelry into the scripts for the Dragonkin monsters themselves. So far its working fine. The current setup for the Dragonkin WarriorLord is as follows.
Code:
            AddLoot(LootPack.ItemStatDeeds, 3);
        }
            public override bool OnBeforeDeath()
        {
            switch (Utility.Random(21)) 
            {
                case 0: PackItem(new DragonkinCuirass());
                    break;
                case 1: PackItem(new DragonkinPauldrons());
                    break;
                case 2: PackItem(new DragonkinGreaves());
                    break;
                case 3: PackItem(new DragonkinBlade());
                    break;
                case 4: PackItem(new DragonkinGauntlets());
                    break;
                case 5: PackItem(new DragonkinHelm());
                    break;
                case 6: PackItem(new DragonkinShield());
                    break;
            }
            return base.OnBeforeDeath();
Look better?
 

Hammerhand

Knight
I've got it working fine. Deeds only drop on the Dragonkin mobs, which have a chance to drop a piece of the armor or weapons & in the case of the mages, the jewelry. I also removed all instances of the base clothing since it wasnt working, and applied the resists to the armor & shield on the deeds as well. Not much point having resists on weapons and not on the armor. Basically, once I had time after way to long at work, I had fun. The different levels of mobs drop different amounts of deeds and they dont spawn in the packs until death.
 
Hammerhand;835287 said:
I've got it working fine. Deeds only drop on the Dragonkin mobs, which have a chance to drop a piece of the armor or weapons & in the case of the mages, the jewelry. I also removed all instances of the base clothing since it wasnt working, and applied the resists to the armor & shield on the deeds as well. Not much point having resists on weapons and not on the armor. Basically, once I had time after way to long at work, I had fun. The different levels of mobs drop different amounts of deeds and they dont spawn in the packs until death.

yeap, I understand more my Dragonkin mobs now. I don't often use them well !
_____________________
Baby blankets
 
not sure how to get it to spawn. and I never found a read me file at all? any way you could tell me what im over looking... thanks
 
Top