Hello,

I am having a couple issues with the Archery Butte.

I am using the script from the Repo without any modification.

When I use the archery butte with an archery weapon it crashes, however with a throwing weapon it works.

At first when i used an archery weapon I would get the message "You must practice with ranged weapons on this."

On line around line 137 I found this line :
Code:
 if (bow == null || trow == null)

Since you cannot equip both a archery and a throwing weapon at the same time, in my mind this will always evaluate to true.
Yet throwing weapons seem to work. I am hoping someone out there can help me understand why.

Anyway I went ahead and changed it to what I suspect is correct.
Code:
 if (bow == null && trow == null)

After making this change the throwing weapons still work and now the Archery weapons also can get past this statement.

However the sever crashes. Through the process of commenting out lines I have determined my issue is around line 208
Code:
if (!from.CheckSkill(bow.Skill, this.m_MinSkill, this.m_MaxSkill))

Specifically the error is related to !from.CheckSkill(bow.Skill
I substituted the values from earlier in the file in place of the m_Min and Max skills. and it still crashes.

Puzzling to me is that around line 224 is a nearly identical line for Throwing instead of Archery.
And as I said the throwing weapons work.

I have attached my file but as I said it is same as in the Repo.

Here is the crash log:
Code:
RunUO Version 0.5, Build 5232.35213
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.18444
Time: 5/9/2014 3:32:38 AM
Mobiles: 24395
Items: 211455
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.Items.ArcheryButte.Fire(Mobile from)
  at Server.Items.ArcheryButte.OnDoubleClick(Mobile from)
  at Server.Mobile.Use(Item item) in c:\UO\ServUO\Server\Mobile.cs:line 4455
  at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
  at Server.Network.MessagePump.HandleReceive(NetState ns) in c:\UO\ServUO\Server\Network\MessagePump.cs:line 303
  at Server.Network.MessagePump.Slice() in c:\UO\ServUO\Server\Network\MessagePump.cs:line 121
  at Server.Core.Main(String[] args) in c:\UO\ServUO\Server\Main.cs:line 622

Clients:
- Count: 1
+ 127.0.0.1: (account = Jeffry) (mobile = 0x4 'jgh')

Please any help and or guidance will be greatly appreciated.
 

Attachments

  • ArcheryButteAddon.cs
    13 KB · Views: 2
Hi Jeff, I'm unable to load up a live copy of a server right now however if memory serves me right, BaseThrown is a sub class of BaseRanged
Looking at the script you provided, bow is declared as BaseRanged and trow (which should surely be throw!!??)as BaseThrown which is why throwing weapons pass the first check and not archery weapons.

I applied the fix for that and ran my server in debug mode, to give a more detailed crash log, fired a cyclone all worked fine... fired a bow and crash - report is below

Code:
Server Crash Report
===================

RunUO Version 0.5, Build 5241.15818
Operating System: Microsoft Windows NT 6.2.9200.0
.NET Framework: 4.0.30319.34014
Time: 09/05/2014 08:05:01
Mobiles: 1
Items: 42
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
  at Server.Items.ArcheryButte.Fire(Mobile from) in c:\Git\Exordus - Copy (2)\Scripts\Items\Addons\ArcheryButteAddon.cs:line 224
  at Server.Items.ArcheryButte.OnDoubleClick(Mobile from) in c:\Git\Exordus - Copy (2)\Scripts\Items\Addons\ArcheryButteAddon.cs:line 113
  at Server.Mobile.Use(Item item) in c:\Git\Exordus - Copy (2)\Server\Mobile.cs:line 4463
  at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc) in c:\Git\Exordus - Copy (2)\Scripts\Services\XmlSpawner 2\XmlEngines\XmlAttach\XmlAttach.cs:line 1909
  at Server.Network.MessagePump.HandleReceive(NetState ns) in c:\Git\Exordus - Copy (2)\Server\Network\MessagePump.cs:line 314
  at Server.Network.MessagePump.Slice() in c:\Git\Exordus - Copy (2)\Server\Network\MessagePump.cs:line 121
  at Server.Core.Main(String[] args) in c:\Git\Exordus - Copy (2)\Server\Main.cs:line 622

Problem is on line 224 because an object reference is null where one was expected
Line 224:
Code:
            else if (!from.CheckSkill(trow.Skill, this.m_MinSkill, this.m_MaxSkill))

So it crashes because it's checking for throw skill on an archery weapon, which means earlier in the code it checked for archery skill on a throwing weapon, which is passed because of the derived class but I'm assuming it shouldn't do.

What I did is swapped the bow check and the throw check on lines 208 and 224 around so that the throw check was first. I then put a check before the throwing skill section to check if it from.weapon was trow then did an else if for the bow skill section, therefore the bow section is only executed if it's not a throwing weapon and it is an archery weapon.

Here is the section edited and I have attached the full script below, now works like a charm!
Code:
          if (from.Weapon == trow)
            {
                if (!from.CheckSkill(trow.Skill, this.m_MinSkill, this.m_MaxSkill))
                {
                    from.PlaySound(trow.MissSound);

                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.

                    se.Record(0);

                    if (se.Count == 1)
                        this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
                    else
                        this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));

                    return;
                }
            }
            else if (from.Weapon == bow)
            {
                if (!from.CheckSkill(bow.Skill, this.m_MinSkill, this.m_MaxSkill))
                {
                    from.PlaySound(bow.MissSound);

                    this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.

                    se.Record(0);

                    if (se.Count == 1)
                        this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
                    else
                        this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));

                    return;
                }
            }
 

Attachments

  • ArcheryButteAddon.cs
    13.7 KB · Views: 10
I wanted to thank you for your help.
You changes did indeed fix my issue.
Sorry it took me so long to test and report back.

Someone should be sure the update makes it to the repo.


Thanks again !!!
 
Back