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_>>

jax70

Wanderer
+ Items/Weapons/Ranged/BaseRanged.cs:
CS0246: Line 69: The type or namespace name 'ArrowType' could not be found (
are you missing a using directive or an assembly reference?)
CS0246: Line 72: The type or namespace name 'BoltType' could not be found (a
re you missing a using directive or an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

i get this error how can i fix it? please help....:(
 

datguy

Sorceror
Using SVN 187 I get this error

RunUO - [www.runuo.com] Version 2.0, Build 2702.22364
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Custom/Advanced Archery/Scripts/Items/Weapons/Ranged/BaseRanged.cs:
CS0506: Line 171: 'Server.Items.BaseRanged.OnHit(Server.Mobile, Server.Mobil
e)': cannot override inherited member 'Server.Items.BaseWeapon.OnHit(Server.Mobi
le, Server.Mobile)' because it is not marked virtual, abstract, or override
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
This is Line 171
public override void OnHit( Mobile attacker, Mobile defender )
if I change it to
public override void OnHit( Mobile attacker, Mobile defender, double damagebonus )
server startsup no errors, but when I shoot an arrow, the arrow hits & server hard crashes
/*
_________________________________
-=(_)_______________________________)=-
/ . . . ____ . ___ _/
/~ / / / / / / )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 )
{
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;

private bool m_IsLevelable;

[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; } }

[CommandProperty( AccessLevel.GameMaster )]
public bool IsLevelable { get{ return m_IsLevelable; } set{ m_IsLevelable = 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;
//--<<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 )
{
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;
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 = this.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;
}
}
}
}

What can I do?
 

Ednyved

Sorceror
I think I found a fix for this. It seems to work well, but I've not tested thoroughly.

Line 172, I changed to:
Code:
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )

It'll take someone smarter than myself to tell why this works, but it seems to do the trick. :eek:

Edit: Upon further investigation, this method results in a warning:
Code:
 CS0114: Line 172: 'Server.Items.BaseRanged.OnHit(Server.Mobile, Server.Mobile, double)' hides the inherited member 'Server.Items.BaseWeapon.OnHit(Server.Mobile, Server.Mobile, double)'.  To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

I also get unreachable code warnings in BaseQuiver.cs at lines 73, 114, 155, 222,and 240, as well as the following error regarding line 133 in StringerTarget.cs:
Code:
 The variable 'skillCode' is declared but never used

So, as I alluded to earlier, it's going to take someone smarter than me to get this truly fixed, but at least now there's no freeze? :)
 
Ednyved;701349 said:
I think I found a fix for this. It seems to work well, but I've not tested thoroughly.

Line 172, I changed to:
Code:
public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )

It'll take someone smarter than myself to tell why this works, but it seems to do the trick. :eek:

Edit: Upon further investigation, this method results in a warning:
Code:
 CS0114: Line 172: 'Server.Items.BaseRanged.OnHit(Server.Mobile, Server.Mobile, double)' hides the inherited member 'Server.Items.BaseWeapon.OnHit(Server.Mobile, Server.Mobile, double)'.  To make the current member override that implementation, add the override keyword. Otherwise add the new keyword.

I also get unreachable code warnings in BaseQuiver.cs at lines 73, 114, 155, 222,and 240, as well as the following error regarding line 133 in StringerTarget.cs:
Code:
 The variable 'skillCode' is declared but never used

So, as I alluded to earlier, it's going to take someone smarter than me to get this truly fixed, but at least now there's no freeze? :)

Yes but that problem is caused from SVN. Comment out the skillcode line and warning will vanish.
 

AodhanW

Wanderer
I got this fully installed and it seems to be working perfectly with the exception of one detail:

I cannot get the stringers to do anything, I click on them, but get no option to use them. Am I doing something wrong?

A couple other things I'd suggest:

1. Can you make the arrows become 'regular' arrows on the corpse, or preferably, have the explosive arrows not appear at all?

2. PPP, can you make this have a base increase to damage as well as contributing to the overall 'Perfect Shot' damage? This would make more sense and thus appeal to realism.

3. Is there any way to 'craft' the tubs for arrows? Would be quite interesting to add '*blank* venom' as an item type usable in crafting poison tubs. Even better if different critters poisons could contribute to different type of poisoned arrows. And lets not forget 'vegetable' and 'mineral' poisons.

(Is a scary man who could make an art form out of complicating a simple system)

If you feel up to it mate, I'd be happy to provide a set of potential ingredients for crafting items.
 

Rosey1

Wanderer
you're supposed to use the fletcher scissors to get the string off your bow and then double click the bow and then click on the stringer and you have restrung your bow.

the rest you can script. For the tubs being craftable, you can just look at the craft menus and add them where you want.

The rest is interesting but more complicated.
 

AodhanW

Wanderer
Rosey1;702462 said:
you're supposed to use the fletcher scissors to get the string off your bow and then double click the bow and then click on the stringer and you have restrung your bow.

the rest you can script. For the tubs being craftable, you can just look at the craft menus and add them where you want.

The rest is interesting but more complicated.

Ok, that makes sense with the scissors and such.. Will try that tomorrow when I reboot the server.

But.. I'm not sure how to use the crafting menus? Would you mind helpin' me out with this?

More specifically, I'm just learning how to use this, and therefor am unsure as to where to modify the crafting menus. Your help is much appreciated.
 

Rosey1

Wanderer
just look at the craftmenu and then just copy and paste and change what you need.

Like the blacksmithing one Engines > Craft > DefBlacksmithy.cs

Code:
AddCraft( typeof( RingmailGloves ), 1011076, 1025099, 12.0, 62.0, typeof( IronIngot ), 1044036, 10, 1044037 );

I'm copying and pasting what in mine as far as syntax goes:

Code:
Synthax for a SIMPLE craft item
			AddCraft( ObjectType, Group, MinSkill, MaxSkill, RessourceType, Amount, Message )
			
			ObjectType		: The type of the object you want to add to the build list.
			Group			: The group in wich the object will be showed in the craft menu.
			MinSkill		: The minimum of skill value
			MaxSkill		: The maximum of skill value
			RessourceType	: The type of the ressource the mobile need to create the item
			Amount			: The amount of the RessourceType it need to create the item
			Message			: String or Int for Localized.  The message that will be sent to the mobile, if the specified ressource is missing.

For more than one skill or item, just poke around at the crafting menus and you'll figure it out :)
 

AodhanW

Wanderer
Rosey1;702473 said:
just look at the craftmenu and then just copy and paste and change what you need.

Like the blacksmithing one Engines > Craft > DefBlacksmithy.cs

Code:
AddCraft( typeof( RingmailGloves ), 1011076, 1025099, 12.0, 62.0, typeof( IronIngot ), 1044036, 10, 1044037 );

I'm copying and pasting what in mine as far as syntax goes:

Code:
Synthax for a SIMPLE craft item
			AddCraft( ObjectType, Group, MinSkill, MaxSkill, RessourceType, Amount, Message )
			
			ObjectType		: The type of the object you want to add to the build list.
			Group			: The group in wich the object will be showed in the craft menu.
			MinSkill		: The minimum of skill value
			MaxSkill		: The maximum of skill value
			RessourceType	: The type of the ressource the mobile need to create the item
			Amount			: The amount of the RessourceType it need to create the item
			Message			: String or Int for Localized.  The message that will be sent to the mobile, if the specified ressource is missing.

For more than one skill or item, just poke around at the crafting menus and you'll figure it out :)

Alright, I understand the way that works.. But I'm a little confused about the sheer 'length' of the SKILL number.

Code:
AddCraft( typeof( RingmailGloves ), 1011076, 1025099, 12.0, 62.0, typeof( IronIngot ), 1044036, 10, 1044037 );

If I understand correctly, the above would plug into the below as follows:

Code:
Synthax for a SIMPLE craft item
			AddCraft( ObjectType, Group, MinSkill, MaxSkill, RessourceType, Amount, Message )
			
			ObjectType		: Ringmail
			Group			: Gloves
			MinSkill		: 12.0
			MaxSkill		: 62.0
			RessourceType	: Ironingot
			Amount			: 10
			Message			: 1044037

Everything makes sense to me up until the 'message'.

And, of course, the fact that there are those other numbers in there. "1011076, 1025099" and "1044036"... Whats up with those?
 

AodhanW

Wanderer
Code:
AddCraft( typeof( RingmailGloves ), 1011076, 1025099, 12.0, 62.0, typeof( IronIngot ), 1044036, 10, 1044037 );

If I understand correctly, the above would plug into the below as follows:

Code:
Synthax for a SIMPLE craft item
			AddCraft( ObjectType, Group, MinSkill, MaxSkill, RessourceType, Amount, Message )
			
			ObjectType		: Ringmail
			Group			: Gloves
			MinSkill		: 12.0
			MaxSkill		: 62.0
			RessourceType	: Ironingot
			Amount			: 10
			Message			: 1044037

Everything makes sense to me up until the 'message'.

And, of course, the fact that there are those other numbers in there. "1011076, 1025099" and "1044036"... Whats up with those?[/QUOTE]

Alright, I'm sure others already know this, but I want to mention it anyway.

Those 7 digit numbers are calls to the cliloc for system messages, and are part of the display for the Crafting Gump. Since I didn't recieve a response, I thought I'd give one instead.
 

flinn

Wanderer
Wanted to ask, I cannot get skill bonus in attributes to work, archery does not reflect +3, any ideas why?, Or has anyone had this issue?
The system works fine, except for this minor set back??
Thankyou for any response in advance.
 
Please Help :(

PHP:
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Engines/BulkOrders/BODModule.cs:
    CS0101: Line 18: The namespace 'Server.ACC.CM' already contains a definition
 for 'MyPlayerFlag'


This is the error we are getting we have tried everything worked for hours on this and keep going in circles we end up always with in the end this same error what do we do?
 
I'm Back

I apologize for my absence.

I have a butt load of IM's and emails to sort through. A lot of people have submitted their ideas and fixes. I would like to take the time to thank those people.... thank you everyone :)

I am currently rescripting this system. For those that don't know... I have been scripting for another game to get an idea of what it is like to script outside of RunUO. I learned a wealth of information. I have matured. I have had many problems in my life recently and it has caused me to look at things differently. I am currently changing jobs and will be enrolling into school soon. My plans are to take 4 years of schooling for software engineering. I'm afraid that when I start school I will have no time for my current hobbies, so the time is now. Let's start fixing these systems and blowing new life into them.

My first problem is my server is broke down. I will be doing this without a server and that sukz. I will have to setup my main comp to test these systems. That will take some time. I already use it for several other things.

Second, I lost everything I was working on. I can't retrieve it and that blowz. I had some nice foundations set into place for the Mega Pack. But maybe that is a good thing. Maybe this is a new beginning for us ...full of fresh new ideas.

Third, I'm far behind. I've been gone too long and need to update myself with what is going on currently. I don't even know what EA Games has done with UO recently.

...

I'm looking over the scripts at the moment. This is the time to speak up. What are u'r ideas for the new release?
 

GhostRiderGrey

Sorceror
Lucid, I installed this package today and absolutely love it. Thank you for creating it. On my shard, we use Fenn's Storage Keys, which can also be used to store arrows. I have attempted to modify BaseRanged.cs to pull arrows from both the quiver or storage keys (BaseStoreKey.Consumed). I have it working from the keys, but it no longer pulls from the Quiver. Here is the relevant OnHit section of the code:
Code:
		{
			//--<<Advanced Archery Edit>>---------------------[Start 3/4]
			PlayerMobile a_pm = attacker as PlayerMobile;
			Container pack = attacker.Backpack;
			BaseQuiver quiver = attacker.FindItemOnLayer( Layer.MiddleTorso ) as BaseQuiver;
			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;
			}
			
			[COLOR="Teal"]if( attacker.Player &&
			   ( quiver == null || !quiver.ConsumeTotal( AmmoType, 1 ) ) &&
			   (   pack == null || ( !pack.ConsumeTotal( AmmoType, 1 ) && !BaseStoreKey.Consume( pack, AmmoType, 1 ) ) ) )
				return false;[/COLOR]
			
			attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
			return true;
			//--<<Advanced Archery Edit>>---------------------[End 3/4]
		}
I suppose, being a novice coder ;), that it's just a small problem below the if(attacker.Player && area, but I'm stuck and thought I ask. If anyone has any thoughts, I would appreciate hearing them.

Thanks,
-GhostRiderGrey
 

Ednyved

Sorceror
Here is our OnFired. See if it helps. :)

Code:
        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;
            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;
            */

            //only consume ammo if you're a player - monster archers have unlimited ammo
            if (attacker.Player)
            {
                //if they don't have a backpack, or they don't have arrows/bolts in their pack, or they dont have arrows/bolts in
                //their keys, then return false

                if ((pack == null || (!pack.ConsumeTotal(AmmoType, 1))) && (!BaseStoreKey.Consume(pack, AmmoType, 1)) && (quiver == null || !quiver.ConsumeTotal(AmmoType, 1)))
                {
                    return false;
                }
            }
            //---------------------------------------------------- BaseStoreKey ammo END-----------------------------------



            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
            return true;
            //--<<Advanced Archery Edit>>---------------------[End 3/4]
        }
 

GhostRiderGrey

Sorceror
Thanks Ednyved!!, that did allow arrows to be taken from the quiver.

However, now when the arrows run out, the archer can still fire them, even though he is physically out of arrows (no arrows in quiver,pack or keys)? There is a longer delay, but if you keep attacking, eventually you will fire another arrow. Is this happening for anyone else? Any solutions?

Thanks,
-GhostRiderGrey
 
Top