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!

[RunUO 2.0 RC1] Lucid's <<_Advanced Archery_>>

Remo82;666878 said:
I've been looking trying to figure out what is causing the issue with not being able to string the bows.

I do get the message that only a grandmaster can apply the string if someone with under 100 skill tries to apply the screen.

If someone with enough skill tries to string the bow (double click bow, target the stringer) no error message is given (no message at all actually) and the bow stays set to NoString and the stringer stays in your backpack.

Also, I was wondering about setting a default string to bows, because bows that drop or if you go and buy a bow from a vendor it is set to NoString and even when the issue with being able to string them is resolved it would mean anyone that wanted to train in archery (or started with a bow on a new char) would have to find a someone with atleast 100 skill to put a string on their bow before they could begin to use it.

Is there a way to set the bows to default to the weakest string that way they can atleast use the bow and upgrade the string later?

Anyone else had this issue or could offer some suggestions on how to fix either/both not being able to string the bows and bows having a default string of the weakest kind so that dropped bows / vendor bows / newb start bows can be used and you do not have to have atleast a GM bower online to put a string on it for you? :confused:

Any help is appreciated, Thanks :)

Yeah that's easy. BaseRanged.cs:

Under this line:
Code:
[SIZE=2]public BaseRanged( Serial serial ) : base( serial )[/SIZE]
[SIZE=2]{[/SIZE]

Add this:
Code:
this.HasBowString = true;
this.[SIZE=2]StringStrengthSelection = StringStrength.VeryWeak;[/SIZE]
[SIZE=2]this.[SIZE=2]PullWeightSelection = PoundsPerPull.Forty;[/SIZE]
[/SIZE]
 

Remo82

Wanderer
I put the code into the file, but it still does not attach a default string to a bow that is created and I cannot string the bow with any of the stringers.

Here is my Baseranged.cs file:

Code:
/*
    _________________________________
 -=(_)_______________________________)=-
   /   .   .   . ____  . ___      _/
  /~ /    /   / /     / /   )2006 /
 (~ (____(___/ (____ / /___/     (
  \ ----------------------------- \
   \    [email protected]    \
    \_     ===================      \
     \   -Owner of "The Conjuring"-  \
      \_     ===================     ~\
       )      Lucid's Mega Pack        )
      /~    The Mother Load v1.1     _/
    _/_______________________________/
 -=(_)_______________________________)=-

 */
using System;
using Server.Items;
using Server.Network;
using Server.Spells;
using Server.Mobiles;
using Server.Targeting;
using System.Collections;
using Server.Enums;
using Server.ACC.CM;
using Server.LucidNagual;


namespace Server.Items
{
	public abstract class BaseRanged : BaseMeleeWeapon
	{
		//--<<Advanced Archery Edit>>---------------------[Start 1/4]
		//SkillModule edit.
		private BaseRangedModule m_BaseRangedModule;
		
		[CommandProperty( AccessLevel.GameMaster )]
		public BaseRangedModule BaseRangedModule
		{
			get
			{
				BaseRangedModule existingModule = ( BaseRangedModule )CentralMemory.GetModule( this.Serial, typeof( BaseRangedModule ) );
				
				if ( existingModule == null )
				{
					CentralMemory.Flush();
					
					BaseRangedModule module = new BaseRangedModule( this.Serial );
					CentralMemory.AppendModule( this.Serial, module, true );
					
					return ( m_BaseRangedModule = module as BaseRangedModule );
				}
				else
				{
					if ( m_BaseRangedModule != null )
						return m_BaseRangedModule;
					
					return ( m_BaseRangedModule = existingModule as BaseRangedModule );
				}
			}
		}
		//SkillModule edit.
		
		public static int PlayerFreezeTimer = 2; 
		public static int NPCFreezeTimer = 2; 		
		
		public BoltType m_BoltType;
		public ArrowType m_ArrowType;
		public StringStrength m_Strength;
		public PoundsPerPull m_PullWeight;
		
		[CommandProperty(AccessLevel.GameMaster)]
		public ArrowType ArrowSelection	{ get { return m_BaseRangedModule.ArrowSelection; } set { m_BaseRangedModule.ArrowSelection = value; } }
		
		[CommandProperty(AccessLevel.GameMaster)]
		public BoltType BoltSelection { get { return m_BaseRangedModule.BoltSelection; } set { m_BaseRangedModule.BoltSelection = value; } }
		
		[CommandProperty(AccessLevel.GameMaster)]
		public StringStrength StringStrengthSelection { get { return m_BaseRangedModule.StringStrengthSelection; } set { m_BaseRangedModule.StringStrengthSelection = value; } }
		
		[CommandProperty(AccessLevel.GameMaster)]
		public PoundsPerPull PullWeightSelection { get { return m_BaseRangedModule.PullWeightSelection; } set { m_BaseRangedModule.PullWeightSelection = value; } }
		
		[CommandProperty( AccessLevel.GameMaster )]
		public bool HasBowString { get{ return m_BaseRangedModule.HasBowString; } set{ m_BaseRangedModule.HasBowString = value; } }		
		
		private static Mobile m_Mobile;
		private static BaseRanged BRanged;
		
		public static TimeSpan StringWarningDelay = TimeSpan.FromSeconds( 10.0 );
		public static DateTime m_NextStringWarning;
		public static TimeSpan AmmoWarningDelay = TimeSpan.FromSeconds( 10.0 );
		public static DateTime m_NextAmmoWarning;
		
		public static readonly TimeSpan PlayerFreezeDuration = TimeSpan.FromSeconds( 3.0 );
		public static readonly TimeSpan NPCFreezeDuration = TimeSpan.FromSeconds( 6.0 );
		//--<<Advanced Archery Edit>>---------------------[End 1/4]
		
		public abstract int EffectID{ get; }
		public abstract Type AmmoType{ get; }
		public abstract Item Ammo{ get; }
		
		public override int DefHitSound{ get{ return 0x234; } }
		public override int DefMissSound{ get{ return 0x238; } }
		
		public override SkillName DefSkill{ get{ return SkillName.Archery; } }
		public override WeaponType DefType{ get{ return WeaponType.Ranged; } }
		public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.ShootXBow; } }
		
		public override SkillName AccuracySkill{ get{ return SkillName.Archery; } }
		
		public BaseRanged( int itemID ) : base( itemID )
		{
		}
		
		public BaseRanged( Serial serial ) : base( serial )
		{
this.HasBowString = true;
this.StringStrengthSelection = StringStrength.VeryWeak;
this.PullWeightSelection = PoundsPerPull.Fourty;
			BRanged = this;
		}
		
		public static void Initialize()
		{
			Mobile from = m_Mobile;
			//Mobile m = (Mobile)parent;
			//BaseWeapon weapon = m.Weapon as BaseWeapon;
		}
		
		public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
		{
			WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
			
			// Make sure we've been standing still for .25/.5/1 second depending on Era
			if ( DateTime.Now > ( attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) )
			{
				bool canSwing = true;
				
				if ( Core.AOS )
				{
					canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
					
					if ( canSwing )
					{
						Spell sp = attacker.Spell as Spell;
						
						canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
					}
				}
				
				if ( canSwing && attacker.HarmfulCheck( defender ) )
				{
					attacker.DisruptiveAction();
					attacker.Send( new Swing( 0, attacker, defender ) );
					
					if ( OnFired( attacker, defender ) )
					{
						if ( CheckHit( attacker, defender ) )
							OnHit( attacker, defender );
						else
							OnMiss( attacker, defender );
					}
				}
				
				attacker.RevealingAction();
				
				return GetDelay( attacker );
			}
			else
			{
				attacker.RevealingAction();
				
				return TimeSpan.FromSeconds( 0.25 );
			}
		}
		
		public override void OnHit( Mobile attacker, Mobile defender )
		{
			//--<<Advanced Archery Edit>>---------------------[Start 2/4]
			if ( attacker == null || defender == null )
				return;
			
			MoreBaseRanged.CustomAmmoCheck( attacker, defender, AmmoType );
			
			if ( Ammo == null )
				attacker.SendMessage( "You are out of arrows, or may have to choose a different type of arrow by double clicking the bow." );
			//--<<Advanced Archery Edit>>---------------------[End 2/4]
			
			if ( attacker.Player && !defender.Player && ( defender.Body.IsAnimal || defender.Body.IsMonster ) && 0.4 >= Utility.RandomDouble() )
				defender.AddToBackpack( Ammo );
			
			base.OnHit( attacker, defender );
		}
		
		public override void OnMiss( Mobile attacker, Mobile defender )
		{
			if ( attacker.Player && 0.4 >= Utility.RandomDouble() )
				Ammo.MoveToWorld( new Point3D( defender.X + Utility.RandomMinMax( -1, 1 ), defender.Y + Utility.RandomMinMax( -1, 1 ), defender.Z ), defender.Map );
			
			base.OnMiss( attacker, defender );
		}
		
		public virtual bool OnFired( Mobile attacker, Mobile defender )
		{
			//--<<Advanced Archery Edit>>---------------------[Start 3/4]
			PlayerMobile a_pm = attacker as PlayerMobile;
			Container pack = attacker.Backpack;
			BaseQuiver quiver = attacker.FindItemOnLayer( Layer.MiddleTorso ) as BaseQuiver;
			//Container quiver = ( BaseQuiver )a_pm.Quiver;
			BaseRangedModule module = this.BaseRangedModule;

			if ( !module.HasBowString )
			{
				if ( DateTime.Now >= m_NextStringWarning )
				{
					m_NextStringWarning = DateTime.Now + StringWarningDelay;
					attacker.SendMessage( "You need a string to use this bow. See a local fletcher to apply the string." );
					return false;
				}
				else
					return false;
			}
			
			if ( Ammo == null )
			{
				if ( DateTime.Now >= m_NextAmmoWarning )
				{
					m_NextAmmoWarning = DateTime.Now + AmmoWarningDelay;
					attacker.SendMessage( "You are out of ammo." );
					return false;
				}
				else
					return false;
			}
			
			if( attacker.Player && quiver != null && quiver.LowerAmmoCost > Utility.Random( 100 ) )
			{
				attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
				return true;
			}
			
			if( attacker.Player &&
			   ( quiver == null || !quiver.ConsumeTotal( AmmoType, 1 ) ) &&
			   (   pack == null ||   !pack.ConsumeTotal( AmmoType, 1 ) ) )
				return false;
			
			attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
			return true;
			//--<<Advanced Archery Edit>>---------------------[End 3/4]
		}
		
		//--<<Advanced Archery Edit>>---------------------[Start 4/4]
		public override void OnDoubleClick( Mobile from )
		{
			BaseRangedModule module = this.BaseRangedModule;
			
			if ( IsChildOf( from.Backpack ) || Parent == from )
			{
				if ( module.HasBowString )
				{
					if ( this is Bow || this is CompositeBow || this is ElvenCompositeLongbow ||
					    this is MagicalShortbow || this is Yumi )
					{
						from.SendMessage( "Please choose which type of arrows you wish to use." );
						from.Target = new BowTarget( this );
					}
					
					if ( this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow )
					{
						from.SendMessage( "Please choose which type of bolts you wish to use." );
						from.Target = new CrossbowTarget( this );
					}
				}
				else
				{
					from.SendMessage( "You must string your bow. Please select a bow stringer." );
					from.Target = new StringerTarget( this );
				}
			}
			
			else
				return;
		}
		
		/*		public override void OnDelete()
		{
			BaseRangedModule module = ( BaseRangedModule )CentralMemory.GetModule( BRanged.Serial, typeof( BaseRangedModule ) );
			
			if ( module != null )
			{
				module.Delete();
			}
			
			base.OnDelete();
		}*/
		
		public override bool OnEquip( Mobile from )
		{
			m_Mobile = from;
			
			return true;
		}
		
		public override bool CanEquip( Mobile from )
		{
			BaseRangedModule module = this.BaseRangedModule;

			if ( from != null && !module.HasBowString )
			{
				from.SendMessage( "You cannot use that without a string." );
				return false;
			}
			
			base.CanEquip( from );
			
			return true;
		}
		
		public virtual Item AmmoArrowSelected()
		{
			BaseRangedModule module = this.BaseRangedModule;
			
			switch ( module.m_ArrowType )
			{
				case ArrowType.Normal:
					return new Arrow();
				case ArrowType.Poison:
					return new PoisonArrow();
				case ArrowType.Explosive:
					return new ExplosiveArrow();
				case ArrowType.ArmorPiercing:
					return new ArmorPiercingArrow();
				case ArrowType.Freeze:
					return new FreezeArrow();
				case ArrowType.Lightning:
					return new LightningArrow();
					
				default:
					return new Arrow();
			}
		}
		
		public virtual Type GetArrowSelected()
		{
			BaseRangedModule module = this.BaseRangedModule;
			
			switch ( module.m_ArrowType )
			{
				case ArrowType.Normal:
					return typeof( Arrow );
				case ArrowType.Poison:
					return typeof( PoisonArrow );
				case ArrowType.Explosive:
					return typeof( ExplosiveArrow );
				case ArrowType.ArmorPiercing:
					return typeof( ArmorPiercingArrow );
				case ArrowType.Freeze:
					return typeof( FreezeArrow );
				case ArrowType.Lightning:
					return typeof( LightningArrow );
					
				default:
					return typeof( Arrow );
			}
		}
		
		public virtual Item AmmoBoltSelected()
		{
			BaseRangedModule module = this.BaseRangedModule;
			
			switch ( module.m_BoltType )
			{
				case BoltType.Normal:
					return new Bolt();
				case BoltType.Poison:
					return new PoisonBolt();
				case BoltType.Explosive:
					return new ExplosiveBolt();
				case BoltType.ArmorPiercing:
					return new ArmorPiercingBolt();
				case BoltType.Freeze:
					return new FreezeBolt();
				case BoltType.Lightning:
					return new LightningBolt();
					
				default:
					return new Bolt();
			}
		}
		
		public virtual Type GetBoltSelected()
		{
			BaseRangedModule module = this.BaseRangedModule;
			
			switch ( module.m_BoltType )
			{
				case BoltType.Normal:
					return typeof( Bolt );
				case BoltType.Poison:
					return typeof( PoisonBolt );
				case BoltType.Explosive:
					return typeof( ExplosiveBolt );
				case BoltType.ArmorPiercing:
					return typeof( ArmorPiercingBolt );
				case BoltType.Freeze:
					return typeof( FreezeBolt );
				case BoltType.Lightning:
					return typeof( LightningBolt );
					
				default:
					return typeof( Bolt );
			}
		}
		
		public override void GetProperties( ObjectPropertyList list )
		{
			base.GetProperties(list);
			
			BaseRangedModule module = this.BaseRangedModule;
			
			if ( module != null )
			{
				ArrayList strings = new ArrayList();
				
				strings.Add( ( "---------------" ) );
				
				if ( this is Bow || this is CompositeBow || this is ElvenCompositeLongbow ||
				    this is MagicalShortbow || this is Yumi )
				{
					strings.Add( ( "Quiver Using: " + module.m_ArrowType ) );
				}
				
				if ( this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow )
				{
					strings.Add( ( "Quiver Using: " + module.m_BoltType ) );
				}
				
				strings.Add( ( "lbs per Pull: " + module.m_PullWeight ) );
				strings.Add( ( "String Str: "  + module.m_Strength ) );
				
				string toAdd = "";
				int amount = strings.Count;
				int current = 1;
				
				foreach ( string str in strings )
				{
					toAdd += str;
					
					if ( current != amount )
						toAdd += "\n";
					
					++current;
				}
				
				if ( toAdd != "" )
					list.Add( 1070722, toAdd );
			}
			else
			{
				return;
			}
		}
		//--<<Advanced Archery Edit>>---------------------[End 4/4]
		
		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 2 ); // version
		}
		
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
			
			switch ( version )
			{
				case 2:
				case 1:
					{
						break;
					}
				case 0:
					{
						/*m_EffectID =*/ reader.ReadInt();
						break;
					}
			}
			
			if ( version < 2 )
			{
				WeaponAttributes.MageWeapon = 0;
				WeaponAttributes.UseBestSkill = 0;
			}
		}
	}
}

Any ideas on how to fix this?
 
Remo82;666941 said:
I put the code into the file, but it still does not attach a default string to a bow that is created and I cannot string the bow with any of the stringers.

Here is my Baseranged.cs file:

Code:
/*
    _________________________________
 -=(_)_______________________________)=-
   /   .   .   . ____  . ___      _/
  /~ /    /   / /     / /   )2006 /
 (~ (____(___/ (____ / /___/     (
  \ ----------------------------- \
   \    [email protected]    \
    \_     ===================      \
     \   -Owner of "The Conjuring"-  \
      \_     ===================     ~\
       )      Lucid's Mega Pack        )
      /~    The Mother Load v1.1     _/
    _/_______________________________/
 -=(_)_______________________________)=-
 
 */
using System;
using Server.Items;
using Server.Network;
using Server.Spells;
using Server.Mobiles;
using Server.Targeting;
using System.Collections;
using Server.Enums;
using Server.ACC.CM;
using Server.LucidNagual;
 
 
namespace Server.Items
{
    public abstract class BaseRanged : BaseMeleeWeapon
    {
        //--<<Advanced Archery Edit>>---------------------[Start 1/4]
        //SkillModule edit.
        private BaseRangedModule m_BaseRangedModule;
 
        [CommandProperty( AccessLevel.GameMaster )]
        public BaseRangedModule BaseRangedModule
        {
            get
            {
                BaseRangedModule existingModule = ( BaseRangedModule )CentralMemory.GetModule( this.Serial, typeof( BaseRangedModule ) );
 
                if ( existingModule == null )
                {
                    CentralMemory.Flush();
 
                    BaseRangedModule module = new BaseRangedModule( this.Serial );
                    CentralMemory.AppendModule( this.Serial, module, true );
 
                    return ( m_BaseRangedModule = module as BaseRangedModule );
                }
                else
                {
                    if ( m_BaseRangedModule != null )
                        return m_BaseRangedModule;
 
                    return ( m_BaseRangedModule = existingModule as BaseRangedModule );
                }
            }
        }
        //SkillModule edit.
 
        public static int PlayerFreezeTimer = 2; 
        public static int NPCFreezeTimer = 2;         
 
        public BoltType m_BoltType;
        public ArrowType m_ArrowType;
        public StringStrength m_Strength;
        public PoundsPerPull m_PullWeight;
 
        [CommandProperty(AccessLevel.GameMaster)]
        public ArrowType ArrowSelection    { get { return m_BaseRangedModule.ArrowSelection; } set { m_BaseRangedModule.ArrowSelection = value; } }
 
        [CommandProperty(AccessLevel.GameMaster)]
        public BoltType BoltSelection { get { return m_BaseRangedModule.BoltSelection; } set { m_BaseRangedModule.BoltSelection = value; } }
 
        [CommandProperty(AccessLevel.GameMaster)]
        public StringStrength StringStrengthSelection { get { return m_BaseRangedModule.StringStrengthSelection; } set { m_BaseRangedModule.StringStrengthSelection = value; } }
 
        [CommandProperty(AccessLevel.GameMaster)]
        public PoundsPerPull PullWeightSelection { get { return m_BaseRangedModule.PullWeightSelection; } set { m_BaseRangedModule.PullWeightSelection = value; } }
 
        [CommandProperty( AccessLevel.GameMaster )]
        public bool HasBowString { get{ return m_BaseRangedModule.HasBowString; } set{ m_BaseRangedModule.HasBowString = value; } }        
 
        private static Mobile m_Mobile;
        private static BaseRanged BRanged;
 
        public static TimeSpan StringWarningDelay = TimeSpan.FromSeconds( 10.0 );
        public static DateTime m_NextStringWarning;
        public static TimeSpan AmmoWarningDelay = TimeSpan.FromSeconds( 10.0 );
        public static DateTime m_NextAmmoWarning;
 
        public static readonly TimeSpan PlayerFreezeDuration = TimeSpan.FromSeconds( 3.0 );
        public static readonly TimeSpan NPCFreezeDuration = TimeSpan.FromSeconds( 6.0 );
        //--<<Advanced Archery Edit>>---------------------[End 1/4]
 
        public abstract int EffectID{ get; }
        public abstract Type AmmoType{ get; }
        public abstract Item Ammo{ get; }
 
        public override int DefHitSound{ get{ return 0x234; } }
        public override int DefMissSound{ get{ return 0x238; } }
 
        public override SkillName DefSkill{ get{ return SkillName.Archery; } }
        public override WeaponType DefType{ get{ return WeaponType.Ranged; } }
        public override WeaponAnimation DefAnimation{ get{ return WeaponAnimation.ShootXBow; } }
 
        public override SkillName AccuracySkill{ get{ return SkillName.Archery; } }
 
        public BaseRanged( int itemID ) : base( itemID )
        {
        }
 
        public BaseRanged( Serial serial ) : base( serial )
        {
this.HasBowString = true;
this.StringStrengthSelection = StringStrength.VeryWeak;
this.PullWeightSelection = PoundsPerPull.Fourty;
            BRanged = this;
        }
 
        public static void Initialize()
        {
            Mobile from = m_Mobile;
            //Mobile m = (Mobile)parent;
            //BaseWeapon weapon = m.Weapon as BaseWeapon;
        }
 
        public override TimeSpan OnSwing( Mobile attacker, Mobile defender )
        {
            WeaponAbility a = WeaponAbility.GetCurrentAbility( attacker );
 
            // Make sure we've been standing still for .25/.5/1 second depending on Era
            if ( DateTime.Now > ( attacker.LastMoveTime + TimeSpan.FromSeconds( Core.SE ? 0.25 : (Core.AOS ? 0.5 : 1.0) )) || (Core.AOS && WeaponAbility.GetCurrentAbility( attacker ) is MovingShot) )
            {
                bool canSwing = true;
 
                if ( Core.AOS )
                {
                    canSwing = ( !attacker.Paralyzed && !attacker.Frozen );
 
                    if ( canSwing )
                    {
                        Spell sp = attacker.Spell as Spell;
 
                        canSwing = ( sp == null || !sp.IsCasting || !sp.BlocksMovement );
                    }
                }
 
                if ( canSwing && attacker.HarmfulCheck( defender ) )
                {
                    attacker.DisruptiveAction();
                    attacker.Send( new Swing( 0, attacker, defender ) );
 
                    if ( OnFired( attacker, defender ) )
                    {
                        if ( CheckHit( attacker, defender ) )
                            OnHit( attacker, defender );
                        else
                            OnMiss( attacker, defender );
                    }
                }
 
                attacker.RevealingAction();
 
                return GetDelay( attacker );
            }
            else
            {
                attacker.RevealingAction();
 
                return TimeSpan.FromSeconds( 0.25 );
            }
        }
 
        public override void OnHit( Mobile attacker, Mobile defender )
        {
            //--<<Advanced Archery Edit>>---------------------[Start 2/4]
            if ( attacker == null || defender == null )
                return;
 
            MoreBaseRanged.CustomAmmoCheck( attacker, defender, AmmoType );
 
            if ( Ammo == null )
                attacker.SendMessage( "You are out of arrows, or may have to choose a different type of arrow by double clicking the bow." );
            //--<<Advanced Archery Edit>>---------------------[End 2/4]
 
            if ( attacker.Player && !defender.Player && ( defender.Body.IsAnimal || defender.Body.IsMonster ) && 0.4 >= Utility.RandomDouble() )
                defender.AddToBackpack( Ammo );
 
            base.OnHit( attacker, defender );
        }
 
        public override void OnMiss( Mobile attacker, Mobile defender )
        {
            if ( attacker.Player && 0.4 >= Utility.RandomDouble() )
                Ammo.MoveToWorld( new Point3D( defender.X + Utility.RandomMinMax( -1, 1 ), defender.Y + Utility.RandomMinMax( -1, 1 ), defender.Z ), defender.Map );
 
            base.OnMiss( attacker, defender );
        }
 
        public virtual bool OnFired( Mobile attacker, Mobile defender )
        {
            //--<<Advanced Archery Edit>>---------------------[Start 3/4]
            PlayerMobile a_pm = attacker as PlayerMobile;
            Container pack = attacker.Backpack;
            BaseQuiver quiver = attacker.FindItemOnLayer( Layer.MiddleTorso ) as BaseQuiver;
            //Container quiver = ( BaseQuiver )a_pm.Quiver;
            BaseRangedModule module = this.BaseRangedModule;
 
            if ( !module.HasBowString )
            {
                if ( DateTime.Now >= m_NextStringWarning )
                {
                    m_NextStringWarning = DateTime.Now + StringWarningDelay;
                    attacker.SendMessage( "You need a string to use this bow. See a local fletcher to apply the string." );
                    return false;
                }
                else
                    return false;
            }
 
            if ( Ammo == null )
            {
                if ( DateTime.Now >= m_NextAmmoWarning )
                {
                    m_NextAmmoWarning = DateTime.Now + AmmoWarningDelay;
                    attacker.SendMessage( "You are out of ammo." );
                    return false;
                }
                else
                    return false;
            }
 
            if( attacker.Player && quiver != null && quiver.LowerAmmoCost > Utility.Random( 100 ) )
            {
                attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
                return true;
            }
 
            if( attacker.Player &&
               ( quiver == null || !quiver.ConsumeTotal( AmmoType, 1 ) ) &&
               (   pack == null ||   !pack.ConsumeTotal( AmmoType, 1 ) ) )
                return false;
 
            attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
            return true;
            //--<<Advanced Archery Edit>>---------------------[End 3/4]
        }
 
        //--<<Advanced Archery Edit>>---------------------[Start 4/4]
        public override void OnDoubleClick( Mobile from )
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            if ( IsChildOf( from.Backpack ) || Parent == from )
            {
                if ( module.HasBowString )
                {
                    if ( this is Bow || this is CompositeBow || this is ElvenCompositeLongbow ||
                        this is MagicalShortbow || this is Yumi )
                    {
                        from.SendMessage( "Please choose which type of arrows you wish to use." );
                        from.Target = new BowTarget( this );
                    }
 
                    if ( this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow )
                    {
                        from.SendMessage( "Please choose which type of bolts you wish to use." );
                        from.Target = new CrossbowTarget( this );
                    }
                }
                else
                {
                    from.SendMessage( "You must string your bow. Please select a bow stringer." );
                    from.Target = new StringerTarget( this );
                }
            }
 
            else
                return;
        }
 
        /*        public override void OnDelete()
        {
            BaseRangedModule module = ( BaseRangedModule )CentralMemory.GetModule( BRanged.Serial, typeof( BaseRangedModule ) );
 
            if ( module != null )
            {
                module.Delete();
            }
 
            base.OnDelete();
        }*/
 
        public override bool OnEquip( Mobile from )
        {
            m_Mobile = from;
 
            return true;
        }
 
        public override bool CanEquip( Mobile from )
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            if ( from != null && !module.HasBowString )
            {
                from.SendMessage( "You cannot use that without a string." );
                return false;
            }
 
            base.CanEquip( from );
 
            return true;
        }
 
        public virtual Item AmmoArrowSelected()
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            switch ( module.m_ArrowType )
            {
                case ArrowType.Normal:
                    return new Arrow();
                case ArrowType.Poison:
                    return new PoisonArrow();
                case ArrowType.Explosive:
                    return new ExplosiveArrow();
                case ArrowType.ArmorPiercing:
                    return new ArmorPiercingArrow();
                case ArrowType.Freeze:
                    return new FreezeArrow();
                case ArrowType.Lightning:
                    return new LightningArrow();
 
                default:
                    return new Arrow();
            }
        }
 
        public virtual Type GetArrowSelected()
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            switch ( module.m_ArrowType )
            {
                case ArrowType.Normal:
                    return typeof( Arrow );
                case ArrowType.Poison:
                    return typeof( PoisonArrow );
                case ArrowType.Explosive:
                    return typeof( ExplosiveArrow );
                case ArrowType.ArmorPiercing:
                    return typeof( ArmorPiercingArrow );
                case ArrowType.Freeze:
                    return typeof( FreezeArrow );
                case ArrowType.Lightning:
                    return typeof( LightningArrow );
 
                default:
                    return typeof( Arrow );
            }
        }
 
        public virtual Item AmmoBoltSelected()
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            switch ( module.m_BoltType )
            {
                case BoltType.Normal:
                    return new Bolt();
                case BoltType.Poison:
                    return new PoisonBolt();
                case BoltType.Explosive:
                    return new ExplosiveBolt();
                case BoltType.ArmorPiercing:
                    return new ArmorPiercingBolt();
                case BoltType.Freeze:
                    return new FreezeBolt();
                case BoltType.Lightning:
                    return new LightningBolt();
 
                default:
                    return new Bolt();
            }
        }
 
        public virtual Type GetBoltSelected()
        {
            BaseRangedModule module = this.BaseRangedModule;
 
            switch ( module.m_BoltType )
            {
                case BoltType.Normal:
                    return typeof( Bolt );
                case BoltType.Poison:
                    return typeof( PoisonBolt );
                case BoltType.Explosive:
                    return typeof( ExplosiveBolt );
                case BoltType.ArmorPiercing:
                    return typeof( ArmorPiercingBolt );
                case BoltType.Freeze:
                    return typeof( FreezeBolt );
                case BoltType.Lightning:
                    return typeof( LightningBolt );
 
                default:
                    return typeof( Bolt );
            }
        }
 
        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties(list);
 
            BaseRangedModule module = this.BaseRangedModule;
 
            if ( module != null )
            {
                ArrayList strings = new ArrayList();
 
                strings.Add( ( "---------------" ) );
 
                if ( this is Bow || this is CompositeBow || this is ElvenCompositeLongbow ||
                    this is MagicalShortbow || this is Yumi )
                {
                    strings.Add( ( "Quiver Using: " + module.m_ArrowType ) );
                }
 
                if ( this is Crossbow || this is HeavyCrossbow || this is RepeatingCrossbow )
                {
                    strings.Add( ( "Quiver Using: " + module.m_BoltType ) );
                }
 
                strings.Add( ( "lbs per Pull: " + module.m_PullWeight ) );
                strings.Add( ( "String Str: "  + module.m_Strength ) );
 
                string toAdd = "";
                int amount = strings.Count;
                int current = 1;
 
                foreach ( string str in strings )
                {
                    toAdd += str;
 
                    if ( current != amount )
                        toAdd += "\n";
 
                    ++current;
                }
 
                if ( toAdd != "" )
                    list.Add( 1070722, toAdd );
            }
            else
            {
                return;
            }
        }
        //--<<Advanced Archery Edit>>---------------------[End 4/4]
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
            writer.Write( (int) 2 ); // version
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();
 
            switch ( version )
            {
                case 2:
                case 1:
                    {
                        break;
                    }
                case 0:
                    {
                        /*m_EffectID =*/ reader.ReadInt();
                        break;
                    }
            }
 
            if ( version < 2 )
            {
                WeaponAttributes.MageWeapon = 0;
                WeaponAttributes.UseBestSkill = 0;
            }
        }
    }
}

Any ideas on how to fix this?

Did you try deleting the existing bow and recreating a new one?
 

Remo82

Wanderer
Yes, I have tried deleting and creating a new bows.. still for some reason does not work.

The lbs per pull is also still set to zero, but im guessing that is from no string attached to bow.

I also looked at every type of bow / crossbow and they are all still string less and it will not apply a string to any of them for some reason.

:confused:
 

Remo82

Wanderer
I have looked through the code in this version and the one prior to this, trying to piece them together and see if anything is different. code is split into new files in this version... i was unable to really find anything.

This might help, I am not sure... Even when I goto props on a bow and manually try to set HasBowString or PullWeightSelection or StringStrengthSelection it will not change... stays at the settings of False for HasBowString, Zero for PullWeightSelection and NoString for StringStrengthSelection.

If you have any suggestions, please let me know. If I somehow figure out how to fix it I will let you know. If I can find out anything else that may be helpful I will post back.

Thanks
 
Remo82;667266 said:
I have looked through the code in this version and the one prior to this, trying to piece them together and see if anything is different. code is split into new files in this version... i was unable to really find anything.

This might help, I am not sure... Even when I goto props on a bow and manually try to set HasBowString or PullWeightSelection or StringStrengthSelection it will not change... stays at the settings of False for HasBowString, Zero for PullWeightSelection and NoString for StringStrengthSelection.

If you have any suggestions, please let me know. If I somehow figure out how to fix it I will let you know. If I can find out anything else that may be helpful I will post back.

Thanks

Please gimme some more time to work on this. I have soo many personal problems that I have a hard time getting this stuff done now :(
 
Remo82;666878 said:
I've been looking trying to figure out what is causing the issue with not being able to string the bows.

I do get the message that only a grandmaster can apply the string if someone with under 100 skill tries to apply the screen.

If someone with enough skill tries to string the bow (double click bow, target the stringer) no error message is given (no message at all actually) and the bow stays set to NoString and the stringer stays in your backpack.

Also, I was wondering about setting a default string to bows, because bows that drop or if you go and buy a bow from a vendor it is set to NoString and even when the issue with being able to string them is resolved it would mean anyone that wanted to train in archery (or started with a bow on a new char) would have to find a someone with atleast 100 skill to put a string on their bow before they could begin to use it.

Is there a way to set the bows to default to the weakest string that way they can atleast use the bow and upgrade the string later?

Anyone else had this issue or could offer some suggestions on how to fix either/both not being able to string the bows and bows having a default string of the weakest kind so that dropped bows / vendor bows / newb start bows can be used and you do not have to have atleast a GM bower online to put a string on it for you? :confused:

Any help is appreciated, Thanks :)

Change some of your BaseRangedModule code to this:
Code:
[B][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#191970]BaseRangedModule[/B][/COLOR][/SIZE][SIZE=2][COLOR=#006400]( [/COLOR][/SIZE][SIZE=2]Serial serial [/SIZE][SIZE=2][COLOR=#006400]) [/COLOR][/SIZE][SIZE=2]: [B]base[/B][/SIZE][SIZE=2][COLOR=#006400]( [/COLOR][/SIZE][SIZE=2]serial [/SIZE][SIZE=2][COLOR=#006400])
{
[/COLOR][/SIZE][SIZE=2]HasBowString [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][B][SIZE=2][COLOR=#008b8b]true[/B][/COLOR][/SIZE][SIZE=2][COLOR=#006400];
[/COLOR][/SIZE][SIZE=2]StringStrengthSelection [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]StringStrength[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]VeryWeak[/SIZE][SIZE=2][COLOR=#006400];
[/COLOR][/SIZE][SIZE=2]PullWeightSelection [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2]PoundsPerPull[/SIZE][SIZE=2][COLOR=#006400].[/COLOR][/SIZE][SIZE=2]Fourty[/SIZE][SIZE=2][COLOR=#006400];

[/COLOR][/SIZE][SIZE=2]m_MaxLevel [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]100[/COLOR][/SIZE][SIZE=2][COLOR=#006400];
[/COLOR][/SIZE][SIZE=2]m_AttributeCap [/SIZE][SIZE=2][COLOR=#006400]= [/COLOR][/SIZE][SIZE=2][COLOR=#00008b]20[/COLOR][/SIZE][SIZE=2][COLOR=#006400];
}
[/COLOR][/SIZE]
 

Remo82

Wanderer
K, I added this change to the file.

I will let you know if it works as soon as I get these new cs files to compile. I have the question posted over in the script support, hopefully get an answer soon and get back with you.
 
Attention:

Updated to v[3].0.1 (d)

Fixes include:
  • Moved the fletcher scissor sound to the MoreBaseRanged.cs.
  • Modified the cut string method.
  • Fixed the StringTarget.cs so that the string and string info are applied properly.
  • Modified the BaseRangedModule so that the default setting creates a bow with a 40 lb pull string and with the string strength set at VeryWeak.
  • Have started to add a debug mode setting for Advanced Archery. The setting can be found in the DataCenter.cs.
 

Remo82

Wanderer
Lucid Nagual;668995 said:
Updated to v[3].0.1 (d)

Fixes include:
  • Moved the fletcher scissor sound to the MoreBaseRanged.cs.
  • Modified the cut string method.
  • Fixed the StringTarget.cs so that the string and string info are applied properly.
  • Modified the BaseRangedModule so that the default setting creates a bow with a 40 lb pull string and with the string strength set at VeryWeak.
  • Have started to add a debug mode setting for Advanced Archery. The setting can be found in the DataCenter.cs.


Finally got the other scripts sorted out and installed your new version, everything seems to work fine now, I will get everyone on my server to test it out and let you know if anything comes up.

The bows start with string now and the scissors and stringers work from what has been tested so far.

Thanks :)
 
Remo82;669253 said:
Finally got the other scripts sorted out and installed your new version, everything seems to work fine now, I will get everyone on my server to test it out and let you know if anything comes up.

The bows start with string now and the scissors and stringers work from what has been tested so far.

Thanks :)

Did you find any issues?
 

un4g1v3n

Wanderer
Hi!

I also tested it, found that if adding a new string to the bow and got more than 1 string in bag it takes 2 strings.

Sorry 4 my bad english :(
 

sabray1

Wanderer
Odd Error

I just installed your Advanced Archery system and ran into this problem. I'm kinda new to working with code, but I'm trying.

Server Crash Report
===================

RunUO Version 2.0, Build 2511.22471
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 4/26/2007 10:00:50 AM
Mobiles: 33805
Items: 830031
Exception:
System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at System.Net.Sockets.TcpListener.Start()
at System.Runtime.Remoting.Channels.ExclusiveTcpListener.Start(Boolean exclusiveAddressUse)
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StartListening(Object data)
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.SetupChannel()
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel..ctor(Int32 port)
at System.Runtime.Remoting.Channels.Tcp.TcpChannel..ctor(Int32 port)
at Server.Engines.OrbRemoteServer.OrbServer.Run(Object o)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

Clients:
- Count: 0
 

Malaperth

Wanderer
All the threads I've seen about this seem to say that you have more than one instance of the server trying to run at once, or two things (in this case OrbServer) at once. Do a search for "System.Net.Sockets.SocketException" and you can see what is said about that error.
 

sabray1

Wanderer
Ok, fixed that issue and now I have this one.

Server Crash Report
===================

RunUO Version 2.0, Build 2511.22471
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 4/26/2007 4:17:14 PM
Mobiles: 34294
Items: 832067
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.LucidNagual.MoreBaseRanged.ApplyString(Mobile from, BaseRanged rang, BaseRangedModule module)
at Server.Targeting.StringerTarget.CheckSkill(Mobile from, BaseRanged rang, BaseRangedModule module)
at Server.Targeting.StringerTarget.OnTarget(Mobile from, Object targeted)
at Server.Targeting.Target.Invoke(Mobile from, Object targeted)
at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)
 
sabray1;677952 said:
Ok, fixed that issue and now I have this one.

Server Crash Report
===================

RunUO Version 2.0, Build 2511.22471
Operating System: Microsoft Windows NT 5.1.2600 Service Pack 2
.NET Framework: 2.0.50727.42
Time: 4/26/2007 4:17:14 PM
Mobiles: 34294
Items: 832067
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Server.LucidNagual.MoreBaseRanged.ApplyString(Mobile from, BaseRanged rang, BaseRangedModule module)
at Server.Targeting.StringerTarget.CheckSkill(Mobile from, BaseRanged rang, BaseRangedModule module)
at Server.Targeting.StringerTarget.OnTarget(Mobile from, Object targeted)
at Server.Targeting.Target.Invoke(Mobile from, Object targeted)
at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc)
at Server.Network.MessagePump.HandleReceive(NetState ns)
at Server.Network.MessagePump.Slice()
at Server.Core.Main(String[] args)

I no longer have that method in the MoreBaseRanged.cs.
 

sabray1

Wanderer
Lucid Nagual;677953 said:
I no longer have that method in the MoreBaseRanged.cs.

The Advanced Archery system works well so far. :D Great Job on the scripts. :D The only part that doen't work for me is trying to apply a new stringer to the bow, (crashes shard). :( And when you click on the bow then click on any of the gears, it says "that is not a gear" :( Are the stringers and gears work in progress, or do I have something that is not happy?
 
Top