enderalse/source/scripts/_00e_bardmarkerscript.psc

96 lines
2.0 KiB
Plaintext
Raw Normal View History

Scriptname _00E_BardMarkerScript extends ObjectReference
Import Utility
;IMPORTANT: EVERY BARD ACTOR NEEDS THE _00E_BardActorScript
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnInit()
Self.BlockActivation(True)
EndEvent
Event OnActivate(ObjectReference akActionRef)
if Self.IsActivationBlocked()
if akActionRef == Game.GetPlayer()
; Do Nothing
Else
Self.Activate(akActionRef, True)
EndIf
EndIf
EndEvent
Event OnUpdate()
If (BardREF.GetDistance(Self) < 100) && (Initiated == False)
Debug.Trace("Close enough!")
Initiated = True
StartInstrumentalSong()
Else
RegisterForSingleUpdate(1)
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function WaitForBard(Actor Bard)
{Accessed from: Package _00E_UseBardMarker, OnEnd}
if Waiting == False
BardREF = Bard
RegisterForSingleUpdate(1)
Waiting = True
Else
Return
EndIf
EndFunction
Function StartInstrumentalSong()
if Playing == False
Wait(1.5)
; BardREF.GetLinkedRef(BardSongMarker).Enable()
Playing = True
Else
Return
EndIf
EndFunction
Function StopInstrumentalSong()
{Accessed from: Package _00E_UseBardMarker, OnEnd}
Playing = False
Waiting = False
Wait(1.5)
BardREF.GetLinkedRef(BardSongMarker).Disable()
; Sound.StopInstance(CurrentSongInstance)
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
int CurrentSongInstance
bool Playing
bool Waiting
bool Initiated
Actor BardREF
Sound SongToPlay
Keyword Property BardSongMarker Auto
Package Property _00E_UseBardMarker Auto