Scriptname _00E_BardSongTriggerScript extends ObjectReference  
{Controls the start of "proper" bard songs}

;=====================================================================================
;              							EVENTS                  					 
;=====================================================================================

Event OnTriggerEnter(ObjectReference akActionRef)

if !Done && akActionRef == Game.GetPlayer()
	Done = True
	If __Config_SameSong == False
		__Config_SongIndex = Utility.RandomInt(0, _00E_MUS_Liliath_Songs.GetSize())
	EndIf
	BardDialogue.StartBardSong(__Config_SongIndex, SpectatorList, __Config_PerformanceStartMarker, __Config_CrowdMarker, __Config_BardActor)
		If !__Config_OnceOnly
			InitializeResetTimer(__Config_GamedaysTillReset)
		EndIf
EndIf
	


EndEvent

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================

Function InitializeResetTimer(int DaysTillReset)

float HoursToWait = (24*DaysTillReset)

RegisterForSingleUpdateGameTime(HoursToWait) 

EndFunction

Event OnUpdateGameTime()
	Done = False
EndEvent


;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

MusicType Property _00E_SilenceAbruptHighPriority Auto

int SongIndex

bool Property Done = False Auto Hidden

int Property __Config_GamedaysTillReset Auto
{How many game days have to pass until the triggerbox resets?}

bool Property __Config_SameSong Auto
{Shall this box only start one specific song, or choose randomly between all songs available? Default: False}

bool Property __Config_OnceOnly Auto
{Shall this box only trigger once?? Default: False}

int Property __Config_SongIndex Auto
{If __Config_SameSong is TRUE, please specifiy the index number of the song the box shall start. See _00E_MUS_LILIATH_SONGS for "Tracklist"}

Formlist Property SpectatorList Auto
{Set this to a created formlist containing the REFERENCES of the FIVE spectators in total. They will react to Liliaths music.}

Formlist Property _00E_MUS_Liliath_Songs Auto
{Tracklist. Auto-Fill this.}

ObjectReference Property __Config_PerformanceStartMarker Auto
{Where should the bard stand when the show begins?}

ObjectReference Property __Config_CrowdMarker Auto
{Where should the audience stand when the show begins? Approximate.}

ObjectReference Property __Config_BardActor Auto
{Who should sing? Please make this a woman, or it will get awkward. Ideally Liliath.}

_00E_BardDialogueFunctions Property BardDialogue Auto