enderalse/source/scripts/_00e_addmusicscript.psc

52 lines
1.3 KiB
Plaintext

Scriptname _00E_AddMusicScript extends ObjectReference
{Dynamically adds and removes music.}
Auto State WaitingForActivate
Event OnTriggerEnter(ObjectReference akActionRef)
If akActionRef == PlayerREF
MusicToPlay.Add()
_00E_PlayerFunctions.GetSoundControl().RemoveSilence()
If Config_RemoveOnLeave == True
GoToState("WaitingForLeave")
Else
GoToState("Done")
EndIf
EndIf
EndEvent
EndState
State WaitingForLeave
Event OnTriggerLeave(ObjectReference akActionRef)
If akActionRef == PlayerREF
MusicToPlay.Remove()
If Config_ActivateMultipleTimes
GoToState("WaitingForActivate")
Else
GoToState("Done")
EndIf
EndIf
EndEvent
EndState
State Done
; Do nothing
EndState
;=====================================================================================
; PROPERTIES
;=====================================================================================
Bool Property Config_RemoveOnLeave = False Auto
{If checked, removes the music once the player leaves the triggerbox. Check this if you want to check Config_ActivateMultipleTimes!}
Bool Property Config_ActivateMultipleTimes = False Auto
{If checked, the triggerbox will reset after the player leaving}
MusicType Property MusicToPlay Auto
Actor Property PlayerREF Auto