ImageSpaceModifier - Not always removed

Post » Sat Jan 05, 2013 9:09 pm

Hi there!
This is my first post here, about my first mod in Skyrim!

If you didn't dismiss the post after that first line, feel free to continue reading :biggrin:

I'm trying to create an effect similar to the Night Eye, that would adaptively adjust the strength depending on the ambient light conditions.
What this means in Papyrus is:
  • Check Game.GetPlayer().GetLightLevel()
  • Apply MainFX.Apply(MainFxStrenth) with the required strength
The actual ImageSpaceModifiers are the same from Night Eye. Also the outro transition is followed.
As reference the vanilla magicNightEyeScript was used. The MainFx and OutFx are the same as in the Night Eye effect.
Below is my script

scriptName magicNightEyeAdaptiveScript extends ActiveMagicEffect{Scripted effect for the Adaptive Night Eye Spell}ImageSpaceModifier property MainFX autoImageSpaceModifier property OutFX autoFloat MainFxStrenthFloat MainFxStrenthTargetFloat MainFxStrenthStepEvent OnEffectStart(Actor Target, Actor Caster)  MainFxStrenth = 1 - (Game.GetPlayer().GetLightLevel() / 100)  MainFX.Apply(MainFxStrenth)  RegisterForSingleUpdate(2)EndEventEvent OnUpdate()  MainFxStrenthTarget = 1 - (Game.GetPlayer().GetLightLevel() / 100)  MainFxStrenthStep   = (MainFxStrenthTarget - MainFxStrenth) / 40  If (Math.Abs (MainFxStrenthTarget - MainFxStrenth) > MainFxStrenthStep)	MainFxStrenth = MainFxStrenth + MainFxStrenthStep	MainFX.Popto(MainFx, MainFxStrenth)  EndIf  RegisterForSingleUpdate(1)EndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)  ;Debug.MessageBox("Removing Night Eye")  UnregisterForUpdate()  MainFX.PopTo(OutFX,1)EndEvent

The actual update event works pretty well. It fades the ImageSpaceModifierto the required value.
I have tried other solutions, such as running a while loop for fading the ImageSpaceModifierbut didn't work well.
Also tried running the update faster that 1sec, for smoother effect but that didn't go well too.

The actual problem is the effect finish. I always get the debug message box but the ImageSpaceModifier remains.
I also tried MainFX.Remove() with worse results! The effect persisted most of the time, so I tried Bethesta's solution.
If you check their script, they also have used the Remove() method, but commented it out and used the PopTo() instead.

I don't have any feedback why it actually remains active and I don't know how to get a list of the active ImageSpaceModifiers, so I'm at a standstill.

If you have any advice please post it!
Thanks for reading!
User avatar
Bee Baby
 
Posts: 3450
Joined: Sun Jun 18, 2006 4:47 am

Return to V - Skyrim