Jump to content

Magic Effect Power Reduction Timer?


Recommended Posts

So I am making a weapon that the power levels on its enchantment fluctuates. I am using a global to control how hard the enchantment hits. The issue is that I can't seem to get it to go back down consistently. The Idea is that the power stacks for each hit within 7 seconds (1 hit = 20 damage, 2 hits = 25 damage, etc). I've tried using a "RegisterforsingleUpdate" but it seems like it doesn't actually update, since when I check the global in game, it just keeps going up, and never back down.

 

This is the script that I am using now:

 

GlobalVariable Property HitStack Auto

SPELL Property StamDrain Auto

Float Property Timer Auto

Float Property hits Auto

Actor Property Caster Auto

Event OnEffectStart(Actor AkTarget, Actor AkCaster)
Caster = AkCaster
hits = HitStack.GetValue()
If(HitStack.GetValue() < 1)
RegisterForSingleUpdate(Timer)
EndIf
StamDrain.Cast(Caster, Caster)
HitStack.SetValue(hits + 1)
EndEvent

Event OnUpdate()
hits = HitStack.GetValue()
HitStack.SetValue(hits - 1)
If(HitStack.GetValue() > 0)
RegisterForSingleUpdate(Timer)
ElseIf(HitStack.GetValue() < 0)
HitStack.SetValue(0)
Else
EndIf
EndEvent

 

Does anybody know a way to fix this?

 

Another way I'd thought of fixing it was to use another magic effect that lasts 7 seconds, and at the end of it reduces your hit # by 1, but I don't know if its possible to make magic effects stack with themselves?

Edited by HeirOfTheSeptems
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...