2023-12-04 15:02:58 +00:00
|
|
|
Scriptname FXBirdFleeSCRIPT extends ObjectReference
|
|
|
|
{Triggers birds to fly away}
|
|
|
|
|
|
|
|
import debug ; import debug.psc for acces to trace()
|
|
|
|
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 BirdFlockFleeSound auto
|
|
|
|
bool property PlayerTriggered = false auto
|
|
|
|
{check if player is only actor that can trigger - Default FALSE}
|
|
|
|
|
|
|
|
int instanceID00
|
|
|
|
|
|
|
|
;*************************************************
|
|
|
|
|
|
|
|
Event onCellAttach()
|
2023-12-06 15:31:10 +00:00
|
|
|
;USKP 2.0.1 - Short delay added to let 3D catch up.
|
|
|
|
Utility.Wait(0.5)
|
2023-12-04 15:02:58 +00:00
|
|
|
instanceID00 = BirdFlockSound.Play(Self)
|
|
|
|
gotoState("Waiting")
|
|
|
|
endEvent
|
|
|
|
|
|
|
|
;*************************************************
|
|
|
|
|
|
|
|
State Waiting
|
|
|
|
Event onTriggerEnter(ObjectReference akActionRef)
|
|
|
|
Actor actionRef = akActionRef as Actor
|
|
|
|
if(((PlayerTriggered) && (actionRef == game.GetPlayer() as Actor)) || (PlayerTriggered == False))
|
|
|
|
gotoState("doNothing")
|
|
|
|
Self.PlayAnimation("PlayAnim01")
|
|
|
|
int instanceID01 = BirdFlockFleeSound.Play(Self)
|
|
|
|
wait (0.5)
|
|
|
|
StopInstance(instanceID00)
|
|
|
|
endif
|
|
|
|
endEvent
|
|
|
|
endState
|
|
|
|
|
|
|
|
;*************************************************
|
|
|
|
|
|
|
|
State doNothing
|
|
|
|
;do nothing
|
|
|
|
endState
|
|
|
|
|
|
|
|
;*************************************************
|