2021-10-05 22:15:58 +00:00
|
|
|
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
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
VisualEffect Property SprigganFXAttachEffect Auto
|
|
|
|
Spell Property crSprigganHeal01 Auto
|
|
|
|
Spell Property crSprigganCallCreatures Auto
|
|
|
|
Idle Property FFselfIdle Auto
|
2024-01-27 01:10:55 +00:00
|
|
|
bool bBledout
|
|
|
|
bool bIsDead
|
2021-10-05 22:15:58 +00:00
|
|
|
;===============================================
|
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
auto state Alive
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
EVENT OnEffectStart(Actor Target, Actor Caster)
|
2024-01-27 01:10:55 +00:00
|
|
|
if Target == None
|
2021-10-05 22:15:58 +00:00
|
|
|
Return
|
|
|
|
EndIf
|
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
If Target.IsDead() || Target == Game.GetForm(0x14)
|
|
|
|
GotoState("DoNothing")
|
|
|
|
Dispel()
|
|
|
|
return
|
|
|
|
EndIf
|
2021-10-05 22:22:24 +00:00
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
;test to see if spriggan is not in ambush mode
|
|
|
|
if (Target.IsInCombat() || Target.GetSleepState() == 0) && Target.Is3DLoaded()
|
|
|
|
SprigganFXAttachEffect.Play(Target, -1)
|
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
ENDEVENT
|
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
; May fire when dispelled with a script or console
|
2021-10-05 22:15:58 +00:00
|
|
|
Event OnEffectFinish(Actor akTarget, Actor akCaster)
|
2024-01-27 01:10:55 +00:00
|
|
|
GotoState("DoNothing")
|
|
|
|
SprigganFXAttachEffect.Stop(akTarget)
|
2021-10-05 22:15:58 +00:00
|
|
|
endEvent
|
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
EVENT onCombatStateChanged(Actor akTarget, int aeCombatState)
|
|
|
|
Actor actorRef = GetTargetActor()
|
|
|
|
|
|
|
|
if ! actorRef || ! actorRef.Is3DLoaded()
|
2021-10-05 22:15:58 +00:00
|
|
|
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
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
if aeCombatState == 1
|
|
|
|
SprigganFXAttachEffect.Play(actorRef, -1)
|
|
|
|
actorRef.playIdle(FFselfIdle)
|
|
|
|
Utility.Wait(Utility.RandomFloat(1.0, 4.0))
|
|
|
|
crSprigganCallCreatures.cast(actorRef, actorRef)
|
|
|
|
endif
|
|
|
|
endEVENT
|
|
|
|
|
|
|
|
Event OnGetUp(ObjectReference akFurniture)
|
|
|
|
Actor actorRef = GetTargetActor()
|
|
|
|
|
|
|
|
if ! actorRef
|
|
|
|
return
|
|
|
|
endif
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
SprigganFXAttachEffect.Play(actorRef, -1)
|
|
|
|
actorRef.PlaySubGraphAnimation("Revive")
|
2021-10-05 22:15:58 +00:00
|
|
|
endEvent
|
2024-01-27 01:10:55 +00:00
|
|
|
|
|
|
|
EVENT onDying(actor myKiller)
|
|
|
|
GotoState("Dying")
|
|
|
|
ENDEVENT
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
EVENT onDeath(actor myKiller)
|
2024-01-27 01:10:55 +00:00
|
|
|
GotoState("Dying")
|
|
|
|
endevent
|
|
|
|
|
|
|
|
Event OnEnterBleedout()
|
|
|
|
if bBledout
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
bBledout = true
|
|
|
|
RegisterForSingleUpdate(2.0)
|
2021-10-05 22:15:58 +00:00
|
|
|
ENDEVENT
|
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
; Heals itself
|
|
|
|
event OnUpdate()
|
|
|
|
Actor actorRef = GetTargetActor()
|
|
|
|
|
|
|
|
if ! actorRef
|
|
|
|
return
|
2021-10-05 22:15:58 +00:00
|
|
|
endif
|
2024-01-27 01:10:55 +00:00
|
|
|
|
|
|
|
if actorRef.Is3DLoaded()
|
|
|
|
crSprigganHeal01.Cast(actorRef)
|
|
|
|
actorRef.setActorValue("variable07",1)
|
|
|
|
Utility.Wait(Utility.RandomFloat(1.5, 2.5))
|
|
|
|
actorRef.evaluatePackage()
|
|
|
|
endif
|
|
|
|
endevent
|
|
|
|
|
|
|
|
endstate
|
|
|
|
|
|
|
|
state Dying
|
|
|
|
event OnBeginState()
|
|
|
|
RegisterForSingleUpdate(Utility.RandomFloat(2.5, 4.5))
|
|
|
|
endevent
|
|
|
|
|
|
|
|
Event OnEffectFinish(Actor akTarget, Actor akCaster)
|
|
|
|
GotoState("DoNothing")
|
|
|
|
akTarget.PlaySubGraphAnimation("KillFX")
|
|
|
|
endEvent
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2024-01-27 01:10:55 +00:00
|
|
|
event OnCellAttach()
|
|
|
|
RegisterForSingleUpdate(1.0)
|
|
|
|
endevent
|
|
|
|
|
|
|
|
event OnUpdate()
|
|
|
|
if bIsDead
|
|
|
|
Dispel()
|
|
|
|
return
|
|
|
|
endif
|
|
|
|
|
|
|
|
bIsDead = true
|
|
|
|
Actor actorRef = GetTargetActor()
|
|
|
|
|
|
|
|
if actorRef
|
|
|
|
SprigganFXAttachEffect.Stop(actorRef)
|
|
|
|
endif
|
|
|
|
|
|
|
|
RegisterForSingleUpdate(Utility.RandomFloat(3.0, 7.5))
|
|
|
|
endevent
|
|
|
|
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
|
|
|
|
Event OnEnterBleedout()
|
|
|
|
ENDEVENT
|