parent
1aae79648f
commit
fd7a9aaa3c
2 changed files with 112 additions and 89 deletions
Binary file not shown.
@ -1,121 +1,144 @@ |
||||
Scriptname SprigganFXSCRIPT extends ActiveMagicEffect |
||||
{Attaches and controlss spriggan FX} |
||||
|
||||
import utility |
||||
import form |
||||
; Eddoursul 2024.01.27: Multi-stage dying, fixed the KillFX Papyrus warning |
||||
|
||||
Actor selfRef |
||||
VisualEffect Property SprigganFXAttachEffect Auto |
||||
Spell Property crSprigganHeal01 Auto |
||||
Spell Property crSprigganCallCreatures Auto |
||||
Idle Property FFselfIdle Auto |
||||
int doOnce |
||||
bool bBledout |
||||
bool bIsDead |
||||
;=============================================== |
||||
|
||||
;RegisterForSleep() ; Before we can use OnSleepStart we must register. |
||||
|
||||
auto state Alive |
||||
|
||||
EVENT OnEffectStart(Actor Target, Actor Caster) |
||||
;Play your particles. |
||||
selfRef = caster |
||||
|
||||
;Added by USKP to prevent this effect from appearing on the player. |
||||
If selfRef == Game.GetPlayer() |
||||
Dispel() |
||||
return |
||||
EndIf |
||||
|
||||
;USKP 2.0 - Check for NONE and spit an error out to see if we can find it |
||||
if( selfRef == None ) |
||||
Debug.TraceStack( "USKP error check: Spriggan called this as a NONE. Please report this error to the USKP team." ) |
||||
if Target == None |
||||
Return |
||||
EndIf |
||||
|
||||
;USSEP 4.1.5 Bug #14445: added this line: |
||||
RegisterForAnimationEvent (selfRef, "KillFX") |
||||
RegisterForAnimationEvent (selfRef, "Revive") |
||||
If Target.IsDead() || Target == Game.GetForm(0x14) |
||||
GotoState("DoNothing") |
||||
Dispel() |
||||
return |
||||
EndIf |
||||
|
||||
;test to see if spriggan is in ambush mode |
||||
if (selfRef.GetSleepState() == 3) |
||||
; Debug.Trace("Spriggan is sleeping! 3") |
||||
selfRef.PlaySubGraphAnimation( "KillFX" ) |
||||
else |
||||
;USKP 2.0.3 - 3D check needed before shaders. |
||||
if( selfRef.Is3DLoaded() ) |
||||
SprigganFXAttachEffect.Play(selfRef, -1) |
||||
EndIf |
||||
endIf |
||||
;test to see if spriggan is not in ambush mode |
||||
if (Target.IsInCombat() || Target.GetSleepState() == 0) && Target.Is3DLoaded() |
||||
SprigganFXAttachEffect.Play(Target, -1) |
||||
endif |
||||
ENDEVENT |
||||
|
||||
; May fire when dispelled with a script or console |
||||
Event OnEffectFinish(Actor akTarget, Actor akCaster) |
||||
SprigganFXAttachEffect.Stop(selfRef) |
||||
GotoState("DoNothing") |
||||
SprigganFXAttachEffect.Stop(akTarget) |
||||
endEvent |
||||
|
||||
Event OnGetUp(ObjectReference akFurniture) |
||||
;Added by USKP to prevent this effect from appearing on the player. |
||||
If selfRef == Game.GetPlayer() |
||||
Dispel() |
||||
EVENT onCombatStateChanged(Actor akTarget, int aeCombatState) |
||||
Actor actorRef = GetTargetActor() |
||||
|
||||
if ! actorRef || ! actorRef.Is3DLoaded() |
||||
return |
||||
EndIf |
||||
endif |
||||
|
||||
if aeCombatState == 0 |
||||
if actorRef.IsDead() |
||||
GotoState("Dying") |
||||
return |
||||
endif |
||||
SprigganFXAttachEffect.Stop(actorRef) |
||||
return |
||||
endif |
||||
|
||||
;USKP 2.0 - Check for NONE and spit an error out to see if we can find it |
||||
if( selfRef == None ) |
||||
Debug.TraceStack( "USKP error check: Spriggan called this as a NONE. Please report this error to the USKP team." ) |
||||
Return |
||||
EndIf |
||||
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 |
||||
|
||||
; Debug.Trace("We just got up from " ) |
||||
SprigganFXAttachEffect.Play(selfRef, -1) |
||||
selfRef.PlaySubGraphAnimation( "Revive" ) |
||||
SprigganFXAttachEffect.Play(actorRef, -1) |
||||
actorRef.PlaySubGraphAnimation("Revive") |
||||
endEvent |
||||
|
||||
|
||||
EVENT onDying(actor myKiller) |
||||
GotoState("Dying") |
||||
ENDEVENT |
||||
|
||||
EVENT onDeath(actor myKiller) |
||||
;(selfRef as actor).PlaySubGraphAnimation( "LeavesScared" ) |
||||
;wait(10.0) |
||||
|
||||
;USKP 2.0 - Check for NONE and spit an error out to see if we can find it |
||||
if( selfRef == None ) |
||||
Debug.TraceStack( "USKP error check: Spriggan called this as a NONE. Please report this error to the USKP team." ) |
||||
Return |
||||
EndIf |
||||
selfRef.PlaySubGraphAnimation( "KillFX" ) |
||||
wait(10.0) |
||||
SprigganFXAttachEffect.Stop(selfRef) |
||||
GotoState("Dying") |
||||
endevent |
||||
|
||||
Event OnEnterBleedout() |
||||
if bBledout |
||||
return |
||||
endif |
||||
bBledout = true |
||||
RegisterForSingleUpdate(2.0) |
||||
ENDEVENT |
||||
|
||||
EVENT onCombatStateChanged(Actor akTarget, int aeCombatState) |
||||
if aeCombatState == 1 |
||||
selfRef.playIdle(FFselfIdle) |
||||
utility.wait(3.0) |
||||
|
||||
;USKP 2.0.1 - If the 3D isn't loaded, don't cast. |
||||
if( selfRef.Is3DLoaded() ) |
||||
crSprigganCallCreatures.cast(selfRef,selfRef) |
||||
EndIf |
||||
; Heals itself |
||||
event OnUpdate() |
||||
Actor actorRef = GetTargetActor() |
||||
|
||||
if ! actorRef |
||||
return |
||||
endif |
||||
endEVENT |
||||
|
||||
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 |
||||
|
||||
Event OnEnterBleedout() |
||||
; Debug.Trace("dude im bleeeding out" ) |
||||
if doOnce == 0 |
||||
selfRef.PlaySubGraphAnimation( "KillFX" ) |
||||
wait(2.0) |
||||
;USKP 2.0.1 - If the 3D isn't loaded, don't case. |
||||
if( selfRef.Is3DLoaded() ) |
||||
crSprigganHeal01.Cast(selfRef) |
||||
EndIf |
||||
selfRef.setActorValue("variable07",1) |
||||
selfRef.evaluatePackage() |
||||
wait(1.0) |
||||
selfRef.PlaySubGraphAnimation( "Revive" ) |
||||
doOnce = 1 |
||||
endIf |
||||
ENDEVENT |
||||
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 |
||||
|
||||
;----------------------------------------------------------------- |
||||
; Added by USSEP 4.1.5 for Bug #14445: |
||||
;----------------------------------------------------------------- |
||||
state DoNothing |
||||
endstate |
||||
|
||||
Event OnAnimationEvent (ObjectReference akSource, string asEventName) |
||||
;do nothing |
||||
EndEvent |
||||
; Compiler wants it here |
||||
Event OnEnterBleedout() |
||||
ENDEVENT |
||||
|
Loading…
Reference in new issue