enderalse/source/scripts/fxbirdfleescript.psc

62 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

Scriptname FXBirdFleeSCRIPT extends ObjectReference
{Triggers birds to fly away}
2024-01-21 04:41:41 +00:00
; Eddoursul 2024.01.21: Use states and updates, added OnReset
sound property BirdFlockSound auto
sound property BirdFlockFleeSound auto
bool property PlayerTriggered = false auto
{check if player is only actor that can trigger - Default FALSE}
int instanceID00
;*************************************************
2024-01-21 04:41:41 +00:00
auto state Init
Event OnCellAttach()
RegisterForSingleUpdate(0.5)
endEvent
event OnUpdate()
instanceID00 = BirdFlockSound.Play(Self)
GotoState("Waiting")
endevent
endstate
;*************************************************
State Waiting
Event onTriggerEnter(ObjectReference akActionRef)
2024-01-21 04:41:41 +00:00
if ! PlayerTriggered || (akActionRef as Actor && akActionRef == Game.GetForm(0x14))
GotoState("Triggered")
PlayAnimation("PlayAnim01")
BirdFlockFleeSound.Play(Self)
RegisterForSingleUpdate(0.5)
endif
endEvent
endState
;*************************************************
2024-01-21 04:41:41 +00:00
State Triggered
event OnUpdate()
GotoState("WaitForReset")
Sound.StopInstance(instanceID00)
instanceID00 = 0
endevent
endState
;*************************************************
State WaitForReset
event OnReset()
GotoState("Init")
; OnReset fires after onCellAttach()
if Is3DLoaded()
RegisterForSingleUpdate(0.5)
endif
endevent
endState
2024-01-21 04:41:41 +00:00
;*************************************************