First of all, one of the errors I'm getting most often is the following:
[08/03/2012 - 11:58:54AM] error: Unable to call RegisterForAnimationEvent - no native object bound to the script object, or object is of incorrect typestack: [None].DCAbEnemyMagEffLocDamScript.RegisterForAnimationEvent() - "" Line ? [None].DCAbEnemyMagEffLocDamScript.OnEffectStart() - "DCAbEnemyMagEffLocDamScript.psc" Line ?
and also sometimes other kinds of errors related to null-pointers (variables holding ''None'' as a value)
Now, obviously, the error in the above example is caused by a RegisterForAnimationEvent call in my script's OnEffectStart() event. The script in question extends activeMagicEffect and is a script on a magic effect on a spell which I add to all actors around the world (this specific magic effect has a condition checking for the keyword ActorTypeNPC, so this specific script should only end up on humanoid NPCs). Now, this is the specific code of the OnEffectStart() event:
If(self == None) Dispel() return EndIf If(akTarget == None) Dispel() return EndIf selfActor = akTarget If(selfActor == None) Dispel() return EndIf RegisterForAnimationEvent(selfActor, "RemoveCharacterControllerFromWorld") randomInts = new int[2] randomInts[0] = Utility.RandomInt() randomInts[1] = Utility.RandomInt()
Now, the first 3 If() - blocks are simply attempts to get rid of these errors. In the first condition I check if the magic effect exists, in the second if the target actors exists, and in the third if the target actor got set correctly to a selfActor variable which I use in various other events and functions throughout the script as well. These all have return statements, so obviously none of these values pointed at ''None'' when the errors in papyrus logs were produced since the RegisterForAnimationEvent() call causing errors follows after these conditional blocks and therefore the return statements cannot have executed.
So, immediately after I have checked and made sure that none of those variables are None, I call RegisterForAnimationEvent() and that specific call prints errors in my logs about None-variables. Does anyone have any idea at all what could be happening here?