Joshlaryeth Posted December 8, 2020 Share Posted December 8, 2020 This is what I've done so far but cannot compile. Any help would be greatly appreciated. Scriptname AAA_ParalysisInvincible extends activemagiceffect ActorValue property HealthAV Event OnEffectStart(Actor akTarget, Actor akCaster) Target = akTarget SpellHP = 100 StartTimerGameTime(UpdateSpeed) EndEvent Event OnTimerGameTime() If (SpellHP > 0.0) float HealthPercent HealthPercent = Target.GetValuePercentage(HealthAV) If (HealthPercent < 1.0) float Healthcurrent float HealthToHeal HealthCurrent = Target.GetValue(HealthAV) HealthToHeal = ((HealthCurrent / HealthPercent) - HealthCurrent) If HealthToHeal > SpellHP HealthToHeal = SpellHP Endif Target.RestoreValue(HealthAV, HealthToHeal) float SpellHP SpellHP -= HealthToHeal Endif StartTimerGameTime(0.2) Else self.Dispel() Endif EndEvent Link to comment Share on other sites More sharing options...
DieFeM Posted December 8, 2020 Share Posted December 8, 2020 (edited) Didn't tested it, but I think it should work correctly: Scriptname AAA_ParalysisInvincible extends activemagiceffect Float Property UpdateSpeed = 0.2 Auto Hidden Float SpellHP Actor Target Event OnEffectStart(Actor akTarget, Actor akCaster) Target = akTarget SpellHP = 100.0 StartTimerGameTime(UpdateSpeed) EndEvent Event OnTimerGameTime() If (SpellHP > 0.0) ActorValue HealthAV = Game.GetHealthAV() float HealthPercent = Target.GetValuePercentage(HealthAV) If (HealthPercent < 1.0) float Healthcurrent = Target.GetValue(HealthAV) float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrent If HealthToHeal > SpellHP HealthToHeal = SpellHP Endif Target.RestoreValue(HealthAV, HealthToHeal) SpellHP -= HealthToHeal Endif StartTimerGameTime(UpdateSpeed) Else Dispel() Endif EndEvent Edited December 8, 2020 by DieFeM Link to comment Share on other sites More sharing options...
DieFeM Posted December 8, 2020 Share Posted December 8, 2020 On the other hand, I want to point out that this script doesn't make the actor invulnerable as your thread's title suggests, it just keeps healing the actor for a limited amount of health. If you really want to set the actor invulnerable for the duration of the magic effect I would consider using something like this: Scriptname AAA_SetInvulnerableEffect extends activemagiceffect Event OnEffectStart(Actor akTarget, Actor akCaster) akTarget.GetLeveledActorBase().SetInvulnerable() EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) akTarget.GetLeveledActorBase().SetInvulnerable(false) EndEvent Link to comment Share on other sites More sharing options...
Joshlaryeth Posted December 8, 2020 Author Share Posted December 8, 2020 (edited) Scriptname AAA_ParalysisInvincible extends activemagiceffect Float Property UpdateSpeed = 0.2 Auto Hidden Float SpellHPActor Target Event OnEffectStart(Actor akTarget, Actor akCaster)Target = akTargetSpellHP = 100.0StartTimerGameTime(UpdateSpeed)EndEvent Float Property UpdateSpeed2 = 0.25 Auto HiddenActorValue Property HealthAV autofloat Function GetValue(ActorValue akAV) Event OnTimerGameTime(UpdateSpeed2)If (SpellHP > 0.0)ActorValue HealthAV = Game.GetValue("HealthAV")float HealthPercent = Target.GetValuePercentage("HealthAV")If (HealthPercent < 1.0)float Healthcurrent = Target.GetValue("HealthAV")float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrentIf HealthToHeal > SpellHPHealthToHeal = SpellHPEndifTarget.RestoreValue("HealthAV", HealthToHeal)SpellHP -= HealthToHealEndifStartTimerGameTime(UpdateSpeed)ElseDispel()EndifEndEventI'm getting: "no viable alternative at input event now". Should I be using an extends other than activemagiceffect? Edited December 8, 2020 by Joshlaryeth Link to comment Share on other sites More sharing options...
DieFeM Posted December 8, 2020 Share Posted December 8, 2020 (edited) Scriptname AAA_ParalysisInvincible extends activemagiceffect Float Property UpdateSpeed = 0.2 Auto Hidden Float SpellHP Actor Target Event OnEffectStart(Actor akTarget, Actor akCaster) Target = akTarget SpellHP = 100.0 StartTimerGameTime(UpdateSpeed) EndEvent Event OnTimerGameTime(int aiTimerID) If (SpellHP > 0.0) ActorValue HealthAV = Game.GetHealthAV() float HealthPercent = Target.GetValuePercentage(HealthAV) If (HealthPercent < 1.0) float Healthcurrent = Target.GetValue(HealthAV) float HealthToHeal = (HealthCurrent / HealthPercent) - HealthCurrent If HealthToHeal > SpellHP HealthToHeal = SpellHP Endif Target.RestoreValue(HealthAV, HealthToHeal) SpellHP -= HealthToHeal Endif StartTimerGameTime(UpdateSpeed) Else Dispel() Endif EndEvent The parameter was missing in the event Event OnTimerGameTime(int aiTimerID) Edited December 8, 2020 by DieFeM Link to comment Share on other sites More sharing options...
Recommended Posts