1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issues with Archery Butte

Discussion in 'Script Support' started by jeff, May 9, 2014.

  1. jeff
    Offline

    jeff New Member

    Joined:
    Feb 3, 2014
    Messages:
    12
    Likes Received:
    1
    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 (C#):
    1.  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 (C#):
    1.  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 (C#):
    1. 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 (C#):
    1. RunUO Version 0.5, Build 5232.35213
    2. Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
    3. .NET Framework: 4.0.30319.18444
    4. Time: 5/9/2014 3:32:38 AM
    5. Mobiles: 24395
    6. Items: 211455
    7. Exception:
    8. System.NullReferenceException: Object reference not set to an instance of an object.
    9.   at Server.Items.ArcheryButte.Fire(Mobile from)
    10.   at Server.Items.ArcheryButte.OnDoubleClick(Mobile from)
    11.   at Server.Mobile.Use(Item item) in c:\UO\ServUO\Server\Mobile.cs:line 4455
    12.   at Server.Engines.XmlSpawner2.XmlAttach.UseReq(NetState state, PacketReader pvSrc)
    13.   at Server.Network.MessagePump.HandleReceive(NetState ns) in c:\UO\ServUO\Server\Network\MessagePump.cs:line 303
    14.   at Server.Network.MessagePump.Slice() in c:\UO\ServUO\Server\Network\MessagePump.cs:line 121
    15.   at Server.Core.Main(String[] args) in c:\UO\ServUO\Server\Main.cs:line 622
    16.  
    17. Clients:
    18. - Count: 1
    19. + 127.0.0.1: (account = Jeffry) (mobile = 0x4 'jgh')
    Please any help and or guidance will be greatly appreciated.
     

    Attached Files:

  2. Ce Jayce
    Offline

    Ce Jayce Member

    Joined:
    Jan 24, 2014
    Messages:
    140
    Likes Received:
    14
    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 (C#):
    1. Server Crash Report
    2. ===================
    3.  
    4. RunUO Version 0.5, Build 5241.15818
    5. Operating System: Microsoft Windows NT 6.2.9200.0
    6. .NET Framework: 4.0.30319.34014
    7. Time: 09/05/2014 08:05:01
    8. Mobiles: 1
    9. Items: 42
    10. Exception:
    11. System.NullReferenceException: Object reference not set to an instance of an object.
    12.   at Server.Items.ArcheryButte.Fire(Mobile from) in c:\Git\Exordus - Copy (2)\Scripts\Items\Addons\ArcheryButteAddon.cs:line 224
    13.   at Server.Items.ArcheryButte.OnDoubleClick(Mobile from) in c:\Git\Exordus - Copy (2)\Scripts\Items\Addons\ArcheryButteAddon.cs:line 113
    14.   at Server.Mobile.Use(Item item) in c:\Git\Exordus - Copy (2)\Server\Mobile.cs:line 4463
    15.   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
    16.   at Server.Network.MessagePump.HandleReceive(NetState ns) in c:\Git\Exordus - Copy (2)\Server\Network\MessagePump.cs:line 314
    17.   at Server.Network.MessagePump.Slice() in c:\Git\Exordus - Copy (2)\Server\Network\MessagePump.cs:line 121
    18.   at Server.Core.Main(String[] args) in c:\Git\Exordus - Copy (2)\Server\Main.cs:line 622
    19.  
    Problem is on line 224 because an object reference is null where one was expected
    Line 224:
    Code (C#):
    1.             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 (C#):
    1.           if (from.Weapon == trow)
    2.             {
    3.                 if (!from.CheckSkill(trow.Skill, this.m_MinSkill, this.m_MaxSkill))
    4.                 {
    5.                     from.PlaySound(trow.MissSound);
    6.  
    7.                     this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.
    8.  
    9.                     se.Record(0);
    10.  
    11.                     if (se.Count == 1)
    12.                         this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
    13.                     else
    14.                         this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
    15.  
    16.                     return;
    17.                 }
    18.             }
    19.             else if (from.Weapon == bow)
    20.             {
    21.                 if (!from.CheckSkill(bow.Skill, this.m_MinSkill, this.m_MaxSkill))
    22.                 {
    23.                     from.PlaySound(bow.MissSound);
    24.  
    25.                     this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 500604, from.Name); // You miss the target altogether.
    26.  
    27.                     se.Record(0);
    28.  
    29.                     if (se.Count == 1)
    30.                         this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1062719, se.Total.ToString());
    31.                     else
    32.                         this.PublicOverheadMessage(MessageType.Regular, 0x3B2, 1042683, String.Format("{0}\t{1}", se.Total, se.Count));
    33.  
    34.                     return;
    35.                 }
    36.             }
     

    Attached Files:

  3. jeff
    Offline

    jeff New Member

    Joined:
    Feb 3, 2014
    Messages:
    12
    Likes Received:
    1
    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 !!!
     
    • Like Like x 1
  4. Ce Jayce
    Offline

    Ce Jayce Member

    Joined:
    Jan 24, 2014
    Messages:
    140
    Likes Received:
    14
Similar Threads: Issues Archery
Forum Title Date
Bug Reports New Covetous - Some other issues. Dec 4, 2017
Archived Bug Reports Stealth Issues (Yes, Again.) Nov 20, 2017
Archived Bug Reports Issues with Poison Mastery Nov 20, 2017
Archived Bug Reports Issues With Assassin Honed Nov 20, 2017
Archived Bug Reports Shield Issues with FC Malus Nov 20, 2017
Archived Bug Reports Mirror Image Issues Nov 19, 2017
Archived Bug Reports Issues with Parry Nov 19, 2017