Optimized FXBirdFleeSCRIPT
This commit is contained in:
parent
226596e5e4
commit
5401437976
Binary file not shown.
@ -1,10 +1,7 @@
|
|||||||
Scriptname FXBirdFleeSCRIPT extends ObjectReference
|
Scriptname FXBirdFleeSCRIPT extends ObjectReference
|
||||||
{Triggers birds to fly away}
|
{Triggers birds to fly away}
|
||||||
|
|
||||||
import debug ; import debug.psc for acces to trace()
|
; Eddoursul 2024.01.21: Use states and updates, added OnReset
|
||||||
import game ; game.psc for access to getPlayer()
|
|
||||||
import utility ; utility.psc for access to wait()
|
|
||||||
import sound ; sound.psc for access to play()
|
|
||||||
|
|
||||||
sound property BirdFlockSound auto
|
sound property BirdFlockSound auto
|
||||||
sound property BirdFlockFleeSound auto
|
sound property BirdFlockFleeSound auto
|
||||||
@ -15,32 +12,50 @@ int instanceID00
|
|||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
|
|
||||||
Event onCellAttach()
|
auto state Init
|
||||||
;USKP 2.0.1 - Short delay added to let 3D catch up.
|
Event OnCellAttach()
|
||||||
Utility.Wait(0.5)
|
RegisterForSingleUpdate(0.5)
|
||||||
instanceID00 = BirdFlockSound.Play(Self)
|
endEvent
|
||||||
gotoState("Waiting")
|
|
||||||
endEvent
|
event OnUpdate()
|
||||||
|
instanceID00 = BirdFlockSound.Play(Self)
|
||||||
|
GotoState("Waiting")
|
||||||
|
endevent
|
||||||
|
endstate
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
|
|
||||||
State Waiting
|
State Waiting
|
||||||
Event onTriggerEnter(ObjectReference akActionRef)
|
Event onTriggerEnter(ObjectReference akActionRef)
|
||||||
Actor actionRef = akActionRef as Actor
|
if ! PlayerTriggered || (akActionRef as Actor && akActionRef == Game.GetForm(0x14))
|
||||||
if(((PlayerTriggered) && (actionRef == game.GetPlayer() as Actor)) || (PlayerTriggered == False))
|
GotoState("Triggered")
|
||||||
gotoState("doNothing")
|
PlayAnimation("PlayAnim01")
|
||||||
Self.PlayAnimation("PlayAnim01")
|
BirdFlockFleeSound.Play(Self)
|
||||||
int instanceID01 = BirdFlockFleeSound.Play(Self)
|
RegisterForSingleUpdate(0.5)
|
||||||
wait (0.5)
|
|
||||||
StopInstance(instanceID00)
|
|
||||||
endif
|
endif
|
||||||
endEvent
|
endEvent
|
||||||
endState
|
endState
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
||||||
|
|
||||||
State doNothing
|
State Triggered
|
||||||
;do nothing
|
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
|
endState
|
||||||
|
|
||||||
;*************************************************
|
;*************************************************
|
Loading…
Reference in New Issue
Block a user