
After much headbanging, I've finally zeroed in on a very annoying and seemingly random bug. There is a pattern to this madness!
If you are dual charging a spell that uses the condition (on the base magic effect) EffectWasDualCast and a script executes that causes the player to script Cast() a spell, EffectWasDualCast will return 0! Even though you've been sitting there charging it up.
Also, if you have an ability or other magic effect that utilizes IsDualCasting: while you are charging a dual cast, it will return 1 until the player script Casts something. After that, even though you're still holding the dual charge, IsDualCasting will return 0.
Here's a rundown of a scenario where this would be a problem:
- player starts dual-charging a spell with a magic effect that utilizes EffectWasDualCast (alternatively player starts dual-charging a spell while an ability is active that utilizes IsDualCasting)
- EffectWasDualCast and IsDualCasting will both return 1 (true) at this point
- some script somewhere executes this line:
SomeSpell.Cast(PlayerRef, SomeTarget)
- even though the player is still dual-charging the spell, EffectWasDualCast and IsDualCasting will now return 0 (false)
This will be much more apparent with long cast time spells. I had a long-ish cast time (4 sec) to simulate a ritual type spell without the lame ritual animation that was (seemingly) randomly failing. After an embarrassingly long debugging run, I finally narrowed the problem down to scripts firing Cast() functions using the player as the source.
