enderalse/scripts/source/_00e_a2_skyfallnovaenchsc.psc

118 lines
3.6 KiB
Plaintext
Raw Normal View History

Scriptname _00E_A2_SkyfallNovaEnchSC extends activemagiceffect
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnEffectStart(Actor akTarget, Actor akCaster)
akSelfActor = akTarget
Utility.Wait(2.5)
CastLightning()
EndEvent
Event OnUpdate()
_00E_A2_SkyfallNovaBlackMageFX.SetValueInt(0)
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function CastLightning()
float fHealthBefore = akSelfActor.GetAV("Health")
ObjectReference CastMarker01 = akSelfActor.PlaceAtMe(AbilityMarker, 1)
If akSelfActor.HasSpell(_00E_A1_RiftSP)
CastMarker01.MoveTo(akSelfActor, 0.0, 0.0, akSelfActor.GetHeight() + 120.0)
Elseif akSelfActor.IsInInterior()
CastMarker01.MoveTo(akSelfActor, 0.0, 0.0, akSelfActor.GetHeight() + 120.0)
Else
CastMarker01.MoveTo(akSelfActor, 0.0, 0.0, akSelfActor.GetHeight() + 120.0)
EndIf
_00E_A2_SkyfallBoltSP.RemoteCast(CastMarker01, PlayerREF, akSelfActor)
CastMarker01.Delete()
fDamage = _00E_A2_SkyfallBoltSP.GetNthEffectMagnitude(0)*0.5
If !PlayerREF.HasSpell(_00E_Affinity_AbBlackMage)
ShockFXShader.Play(akSelfActor)
Else
ParalyzeFxShader.Play(akSelfActor)
AbsorbGreenTargetVFX01.Play(akSelfActor)
If _00E_A2_SkyfallNovaBlackMageFX.GetValueInt() == 0
_00E_A2_SkyfallNovaBlackMageFX.SetValueInt(1)
ParalyzeFxShader.Play(PlayerREF)
PlayerREF.PlaceAtMe(_00E_MAGEldritchShockExplosionTeleport)
AbsorbGreenCastVFX01.Play(PlayerREF)
EndIf
AbsorbHealthAndMana(50)
EndIf
If akSelfActor.GetActorValue("Health") == fHealthBefore
akSelfActor.DamageAV("Health", fDamage)
_00E_A2_ShocknovaBoltM.Play(akSelfActor)
EndIf
Utility.Wait(2)
ShockFXShader.Stop(akSelfActor)
ParalyzeFxShader.Stop(akSelfActor)
ParalyzeFxShader.Stop(PlayerREF)
AbsorbGreenCastVFX01.Stop(PlayerREF)
AbsorbGreenTargetVFX01.Stop(akSelfActor)
RegisterForSingleUpdate(5)
EndFunction
Function AbsorbHealthAndMana(float fDamagePercentage)
float fEnergyToAbsorb = (fDamage*(fDamagePercentage/100))
PlayerREF.RestoreAV("Health", fEnergyToAbsorb)
PlayerREF.RestoreAV("Magicka", fEnergyToAbsorb)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
float fDamage
Actor akSelfActor
Actor Property PlayerREF Auto
Static Property AbilityMarker Auto
EffectShader Property ShockFXShader Auto
EffectShader Property ParalyzeFxShader Auto
GlobalVariable Property _00E_A2_SkyfallNovaBlackMageFX Auto
Explosion Property _00E_MAGEldritchShockExplosionTeleport Auto
VisualEffect Property AbsorbGreenTargetVFX01 Auto
VisualEffect Property AbsorbGreenCastVFX01 Auto
Sound Property _00E_A2_ShocknovaBoltM Auto
Spell Property _00E_A2_SkyfallBoltSP Auto
Spell Property _00E_Affinity_AbBlackMage Auto
Spell Property _00E_A1_RiftSP Auto