Is the Spell.Cast method not reliable?

Post » Wed Jun 20, 2012 2:10 am

I have a mod that primarily uses one ActiveSpellEffect script. The script "charges" up levels (1 thru 10) and then casts a spell depending on how long you charged. The target spell casts 95% of the time, but I sometimes observe that it does NOT cast and I haven't figured out the reason for this.

The relevant part of the "charger" script is this:
Debug.Trace("Spell casting - level = " + currentLevel, 2)leveledSpells[currentLevel - 1].Cast(caster)

The array has the index I'm asking it for, and the Spell stored there is not None, at least according to the Papyrus Log files. Also, this does work 95% of the time.

The spell I'm casting is Script only, cast on Self, Fire and Forget, and its only event looks like this:
Event OnEffectStart(Actor akTarget, Actor akCaster) Debug.Trace("Started: Times=" + TimesToCast + " DelayBeforeFirstCast=" + DelayBeforeFirstCast, 2) Wait(DelayBeforeFirstCast) int i = 0 while (i < TimesToCast)  SpellToCast.Cast(Game.GetPlayer())  Wait(DelayBetweenCasts)  i+=1 endwhileEndEvent

My observation when it fails is that I get the trace in the charger spell, but I do not get the trace in the second spell. The logs report no errors. The only pattern I've observed is that when it fails, it fails multiple times in a row. If I lay off casting the charger for a minute or so, it will work the next time I do cast it.

What do you all think? Is the Cast method just not reliable? Is there something awry with my script? If Papyrus is overloaded would it simply ignore the Cast method, but if so, why does it still perform my "charger" script?
User avatar
Wayne Cole
 
Posts: 3369
Joined: Sat May 26, 2007 5:22 am

Post » Wed Jun 20, 2012 12:54 am

doesnt the SPELL.cast() call require the caster and the target to work? Not sure if thats the issue though seeing as you get casts sometimes?
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Tue Jun 19, 2012 10:51 am

doesnt the SPELL.cast() call require the caster and the target to work? Not sure if thats the issue though seeing as you get casts sometimes?

The second argument is optional and indicates the target towards which to cast. As I understand, this would be used if a non-Actor needs to cast a projectile at the player (e.g., player triggers a trap).

On a side note, I originally wanted a spell that was Fire and Forget, Cast on Target Actor, and hoped I could cast it on the player with "Spell.Cast(Player, Player)", but that didn't work. "Target Actor" definitively means "the actor you've got you're crosshairs on".
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am


Return to V - Skyrim