1
Fork 0

Rewrote SprigganFXSCRIPT

development
Eddoursul 4 months ago
parent 1aae79648f
commit fd7a9aaa3c
  1. BIN
      scripts/sprigganfxscript.pex
  2. 201
      source/scripts/sprigganfxscript.psc

Binary file not shown.

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

Loading…
Cancel
Save