Build #103: Weapons breaking can throw exception

Report specific bugs in Daggerfall Unity. Please read guidelines before posting.
Post Reply
User avatar
Hazelnut
Posts: 706
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Build #103: Weapons breaking can throw exception

Post by Hazelnut » Sat Mar 24, 2018 7:39 pm

WHen a bow breaks and is auto-unequipped, FPSWeapon.Update() can throw an index out of range exception which prevents and further use of weapons. I assume this happens with other weapons, but only seen it with bows because they break so quickly. I had a quick look and don't feel I know enough about this code to fix it correctly. I think it depends on where the animation is since is a coroutine, so it doesn't always happen.

Code: Select all

IndexOutOfRangeException: Array index is out of range.
DaggerfallWorkshop.Game.FPSWeapon.UpdateWeapon () (at Assets/Scripts/Game/FPSWeapon.cs:239)
DaggerfallWorkshop.Game.FPSWeapon+<AnimateWeapon>c__Iterator0.MoveNext () (at Assets/Scripts/Game/FPSWeapon.cs:398)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

User avatar
Interkarma
Posts: 3340
Joined: Sun Mar 22, 2015 1:51 am

Re: Build #103: Weapons breaking can throw exception

Post by Interkarma » Sat Mar 24, 2018 10:13 pm

Thanks for the report. :)

R.D.
Posts: 234
Joined: Fri Oct 07, 2016 10:41 am

Re: Build #103: Weapons breaking can throw exception

Post by R.D. » Sat Aug 25, 2018 2:06 pm

I can't reproduce this. I thought maybe it was somehow fixed by https://github.com/Interkarma/daggerfall-unity/pull/821, but even when reverting to the code before that PR was accepted, I can't get the exception to happen.

I modified the code slightly to make weapons break immediately on any attack, rather than testing with normal gameplay, but I don't think that would matter. I tried probably around 15 times in a row (counting both with the latest code and before the above PR) having my bow break, but no exceptions.

User avatar
Hazelnut
Posts: 706
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Build #103: Weapons breaking can throw exception

Post by Hazelnut » Mon Sep 03, 2018 5:20 pm

I just tried this with latest codebase and the bow is now auto-unequipped when it breaks. This has successfully avoided the problem with animation I think. I should have mentioned that it was different frequencies on a Linux laptop with intel gfx and a windows pc with a 1050Ti. On the laptop it always happened, but on windows pc it was much rarer and difficult to repro. Thats why I was sure it was to do with the animation coroutine.

User avatar
Hazelnut
Posts: 706
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Build #103: Weapons breaking can throw exception

Post by Hazelnut » Mon Oct 01, 2018 9:04 pm

I just had this happen - first time in ages. Bit different as it still occurred when weapon was auto-unequipped. Hand was mid animation and unusable as was any weapon I equipped.

Post Reply