[0.10.27] NullReferenceException with DaggerfallMissile

Locked
User avatar
jefetienne
Posts: 170
Joined: Thu Jan 16, 2020 8:14 pm
Location: Gallomont, Wayrest
Contact:

[0.10.27] NullReferenceException with DaggerfallMissile

Post by jefetienne »

While working on a mod, I stumbled upon a runtime error whenever the player steps or clicks on one of the MultiTrigger levers in the final dungeon.

Steps to reproduce:

1. Load attached save
2. Step or click on lever in front of player
3. Observe Error

Code: Select all

NullReferenceException: Object reference not set to an instance of an object
DaggerfallWorkshop.Game.DaggerfallMissile.DoTouch () (at Assets/Scripts/Game/DaggerfallMissile.cs:406)
DaggerfallWorkshop.Game.DaggerfallMissile.Update () (at Assets/Scripts/Game/DaggerfallMissile.cs:258)
If you step/click on the lever behind you, it will work fine because it is CasterOnly, wheras the one giving the error is ByTouch.

I tracked down where this is all coming from: The 'caster' in DaggerfallMissile is set to null in the Start() method because the payload.CasterEntityBehaviour is null. The payload gets created under DaggerfallAction.CastSpell(), but the CasterEntityBehaviour is unassigned. I think a simple fix would just be to simply set it to the PlayerEntityBehavior in the CastSpell method, but would a better fix be to set it as whatever stepped on it? If the latter, I'm not sure how much reworking that would entail.
Attachments
bad_lever.zip
(129.2 KiB) Downloaded 89 times
El jefe, Etienne
Nexus Mods | GitHub

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

Re: [0.10.27] NullReferenceException with DaggerfallMissile [RESOLVED 0.10.28]

Post by Interkarma »

Thank you jefetienne! :) Have merged a fix for this one now.

https://github.com/Interkarma/daggerfal ... 98ee509649

Locked