enderalse/source/scripts/sprigganfxscript.psc

146 lines
3.1 KiB
Plaintext
Raw Normal View History

Scriptname SprigganFXSCRIPT extends ActiveMagicEffect
{Attaches and controlss spriggan FX}
2024-01-27 01:10:55 +00:00
; Eddoursul 2024.01.27: Multi-stage dying, fixed the KillFX Papyrus warning
VisualEffect Property SprigganFXAttachEffect Auto
Spell Property crSprigganHeal01 Auto
Spell Property crSprigganCallCreatures Auto
Idle Property FFselfIdle Auto
2024-01-27 02:24:11 +00:00
bool bAnimEffects = true
;===============================================
2024-01-27 01:10:55 +00:00
auto state Alive
2024-01-27 02:24:11 +00:00
event OnEffectStart(Actor Target, Actor Caster)
If ! Target || Target == Game.GetForm(0x14)
2024-01-27 01:10:55 +00:00
GotoState("DoNothing")
Dispel()
return
EndIf
2021-10-05 22:22:24 +00:00
2024-01-27 02:24:11 +00:00
if bAnimEffects
bAnimEffects = false
2024-01-28 05:29:17 +00:00
SprigganFXAttachEffect.Stop(Target)
2024-01-27 02:24:11 +00:00
Target.PlaySubGraphAnimation("KillFX")
2024-01-27 01:10:55 +00:00
endif
2024-01-27 02:24:11 +00:00
If Target.IsDead()
GotoState("DoNothing")
Dispel()
EndIf
endevent
event OnCombatStateChanged(Actor akTarget, int aeCombatState)
2024-01-27 01:10:55 +00:00
Actor actorRef = GetTargetActor()
if ! actorRef || ! actorRef.Is3DLoaded()
return
2024-01-27 01:10:55 +00:00
endif
if aeCombatState == 0
if actorRef.IsDead()
GotoState("Dying")
return
endif
SprigganFXAttachEffect.Stop(actorRef)
return
endif
2024-01-27 01:10:55 +00:00
if aeCombatState == 1
2024-01-27 02:24:11 +00:00
if ! bAnimEffects
bAnimEffects = true
actorRef.PlaySubGraphAnimation("Revive")
endif
2024-01-27 01:10:55 +00:00
SprigganFXAttachEffect.Play(actorRef, -1)
actorRef.playIdle(FFselfIdle)
2024-01-27 02:24:11 +00:00
Utility.Wait(Utility.RandomFloat(1.0, 3.0))
if GetState() == "Alive"
crSprigganCallCreatures.cast(actorRef, actorRef)
endif
2024-01-27 01:10:55 +00:00
endif
2024-01-27 02:24:11 +00:00
endevent
2024-01-27 01:10:55 +00:00
2024-01-27 02:24:11 +00:00
event onDying(actor myKiller)
2024-01-27 01:10:55 +00:00
GotoState("Dying")
2024-01-27 02:24:11 +00:00
endevent
2024-01-27 01:10:55 +00:00
2024-01-27 02:24:11 +00:00
event onDeath(actor myKiller)
2024-01-27 01:10:55 +00:00
GotoState("Dying")
endevent
2024-01-27 02:24:11 +00:00
event OnEnterBleedout()
2024-01-27 01:10:55 +00:00
Actor actorRef = GetTargetActor()
2024-01-27 02:24:11 +00:00
SprigganFXAttachEffect.Stop(actorRef)
if actorRef.GetActorValue("Variable07")
RegisterForAnimationEvent(actorRef, "BleedoutStop")
2024-01-27 01:10:55 +00:00
return
endif
2024-01-27 01:10:55 +00:00
2024-01-27 02:24:11 +00:00
actorRef.SetActorValue("Variable07", 1)
Utility.Wait(Utility.RandomFloat(2.0, 3.5))
if GetState() == "Alive"
RegisterForAnimationEvent(actorRef, "BleedoutStop")
2024-01-27 01:10:55 +00:00
crSprigganHeal01.Cast(actorRef)
2024-01-27 02:24:11 +00:00
actorRef.EvaluatePackage()
2024-01-27 01:10:55 +00:00
endif
endevent
2024-01-27 02:24:11 +00:00
event OnAnimationEvent(ObjectReference akSource, string asEventName)
UnregisterForAnimationEvent(akSource, asEventName)
SprigganFXAttachEffect.Play(akSource)
endevent
2024-01-27 01:10:55 +00:00
endstate
state Dying
2024-01-27 02:24:11 +00:00
2024-01-27 01:10:55 +00:00
event OnBeginState()
2024-01-27 02:24:11 +00:00
RegisterForSingleUpdate(Utility.RandomFloat(2.0, 3.5))
UnregisterForAnimationEvent(GetTargetActor(), "BleedoutStop")
2024-01-27 01:10:55 +00:00
endevent
event OnCellAttach()
RegisterForSingleUpdate(1.0)
endevent
2024-01-27 02:24:11 +00:00
event OnCellDetach()
UnregisterForUpdate()
GotoState("Dead")
SprigganFXAttachEffect.Stop(GetTargetActor())
Dispel()
endevent
2024-01-27 01:10:55 +00:00
event OnUpdate()
2024-01-27 02:24:11 +00:00
SprigganFXAttachEffect.Stop(GetTargetActor())
GotoState("Dead")
RegisterForSingleUpdate(Utility.RandomFloat(3.0, 7.5))
endevent
2024-01-27 01:10:55 +00:00
2024-01-27 02:24:11 +00:00
endstate
state Dead
event OnUpdate()
Dispel()
endevent
event OnEffectFinish(Actor akTarget, Actor akCaster)
GotoState("DoNothing")
if bAnimEffects
bAnimEffects = false
akTarget.PlaySubGraphAnimation("KillFX")
2024-01-27 01:10:55 +00:00
endif
endevent
2024-01-27 02:24:11 +00:00
2024-01-27 01:10:55 +00:00
endstate
2021-10-05 22:22:24 +00:00
2024-01-27 01:10:55 +00:00
state DoNothing
endstate
2021-10-05 22:22:24 +00:00
2024-01-27 01:10:55 +00:00
; Compiler wants it here
2024-01-27 02:24:11 +00:00
event OnEnterBleedout()
endevent