1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
1.3 KiB

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()
;USKP 2.0.1 - Short delay added to let 3D catch up.
Utility.Wait(0.5)
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
;*************************************************