I am trying to apply a sun damage effect via an ability to a custom vampire race. It uses a magic effect which runs a script to determine the constant damage to the player. It works to an extent, but later in the game, I realized I had not accounted for the possibility of a Dawnguard eclipse. I fixed that, and it works, too, but in the process of debugging, I realized there were old scripts, before I made the eclipse change, still running on my player. I made a custom spell to dispell the old scripts using a keyword I had put in, and now everything works as expected.
To make a long story short, how can I stop constant effect magic effects using the script archetype from stacking? What triggers a new application of the effect? I tried the "no recast" box, but then the sun damage didn't seem to work at all.
In case it's helpful, heres the script.
GlobalVariable Property GameHour auto
GlobalVariable Property DLC1EclipseActive auto
Event OnEffectStart(Actor DetectTarget, Actor DetectCaster)
RegisterForSingleUpdate(1)
EndEvent
Event OnUpdate()
Actor targetActor = GetCasterActor()
if (targetActor.IsInInterior() == 0 && DLC1EclipseActive.GetValue() == 0)
float Time = GameHour.GetValue()
if (Time >= 6 && Time < 19)
float fLightLevel = targetActor.GetLightLevel()
float maxHealth = targetActor.GetBaseAV("Health")
int onePercentOfHealth = Math.Ceiling(maxHealth / 100.0)
if fLightLevel >= 135
targetActor.DamageAV("Health", onePercentOfHealth * 10)
elseif (fLightLevel >= 120 && fLightLevel < 135)
targetActor.DamageAV("Health", onePercentOfHealth * 7)
elseif fLightLevel >= 105 && fLightLevel < 120
targetActor.DamageAV("Health", onePercentOfHealth * 5)
elseif fLightLevel >= 90 && fLightLevel < 105
targetActor.DamageAV("Health", onePercentOfHealth * 4)
elseif fLightLevel >= 75 && fLightLevel < 90
targetActor.DamageAV("Health", onePercentOfHealth * 3)
elseif fLightLevel >= 60 && fLightLevel < 75
targetActor.DamageAV("Health", onePercentOfHealth * 2)
else
targetActor.DamageAV("Health", onePercentOfHealth)
endif
endif
endif
RegisterForSingleUpdate(1)
EndEvent
Event OnEffectFinish(Actor DetectTarget, Actor DetectCaster)
EndEvent
My coding skills are pretty meager, so the solution might be simple, but I'd appreciate some help.