enderalse/scripts/source/_00e_barddialoguefunctions.psc

475 lines
16 KiB
Plaintext
Raw Normal View History

Scriptname _00E_BardDialogueFunctions extends Quest Conditional
Import _00E_QuestFunctions
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function PlaySongRequest(objectReference Bard, Bool PlayContinuous = True, int SongToPlay = 0, Bool ChangeSettings = True)
;(Bard as Actor).SetGhost(True)
Utility.Wait(1); Bard is pausing
BardHandoff = Bard
PlayContinuousHandoff = PlayContinuous
SongToPlayHandoff = SongToPlay
ChangeSettingsHandoff = ChangeSettings
;SavedPlayContinuous = True; prevent stop after request?
RegisterForSingleUpdate(1)
EndFunction
;--------------------------------------------------------------------------------------
Event OnUpdate()
PlaySong(BardHandoff, PlayContinuousHandoff, SongToPlayHandoff, ChangeSettingsHandoff)
EndEvent
;---------------------------------------------------------------------------------------
Function PlaySong(objectReference Bard, Bool PlayContinuous = True, int SongToPlay = 0, Bool ChangeSettings = True)
SavedPlayContinuous = True; prevent stop after request?
While Bard.IsInDialogueWithPlayer()
if Changesettings == False && (Stopsong == True || SavedPlayContinuous == False)
;SavedPlayContinuous == True; preventing cycle break?
Return; stops bard cycle?
endif
EndWhile
if Changesettings == False && (Stopsong == True || SavedPlayContinuous == False); Reason for stop after requested song?
Playing = 0
Return; stops bard cycle?
endif
if Changesettings == True
StopAllSongs()
endif
Playing = 1
SingingBard.forcerefto(Bard)
If ChangeSettings == False ;Allows the sytem to recall the function without changing the previous settings.
PlayContinuous = SavedPlayContinuous
SongToPlay = 0
Else ;Saves the settings of the original call.
SavedPlayContinuous = PlayContinuous
endif
if SongToPlay == 0 ;if a particular song hasn't been requested, get a random song.
SongToPlay = GetRandomSong()
endif
PlayChosenSong(SongToPlay)
StopSong = False
EndFunction
;---------------------------------------------------------------------------------------
Function PlayChosenSong(Int ChosenSong)
Int iWithIntro = Utility.RandomInt(0,1)
LastSongPlayed = ChosenSong
if ChosenSong == 2 || ChosenSong == 102 || ChosenSong == 202 || ChosenSong == 302
BardDialogue_WaywardWanderer.ForceStart()
EndIf
if ChosenSong == 3 || ChosenSong == 103 || ChosenSong == 203
BardDialogue_TheAgedMan.ForceStart()
EndIf
if ChosenSong == 4 || ChosenSong == 104 || ChosenSong == 204
BardDialogue_LastSunset.ForceStart()
EndIf
if ChosenSong == 5 || ChosenSong == 105 || ChosenSong == 205
BardDialogue_Whisperwood.ForceStart()
EndIf
if ChosenSong == 6 || ChosenSong == 106 || ChosenSong == 206
BardDialogue_Song06.ForceStart(); Black Guardian
EndIf
if ChosenSong == 7 || ChosenSong == 107 || ChosenSong == 207 || ChosenSong == 303
BardDialogue_Vatyra.ForceStart()
EndIf
if ChosenSong == 8 || ChosenSong == 108 || ChosenSong == 208
BardDialogue_Song08.ForceStart(); Wild Mages
EndIf
if ChosenSong == 9 || ChosenSong == 109 || ChosenSong == 209
BardDialogue_Song09.ForceStart(); Lost Ones
EndIf
if ChosenSong == 10 || ChosenSong == 110 || ChosenSong == 210
BardDialogue_Song10.ForceStart(); Crimson Star
EndIf
if ChosenSong == 11 || ChosenSong == 111 || ChosenSong == 304
BardDialogue_Song11.ForceStart(); Firmament
EndIf
if ChosenSong == 20 || ChosenSong == 112
BardDialogue_WelcomeYouDrunkards.ForceStart()
EndIf
if ChosenSong == 113 || ChosenSong == 211 || ChosenSong == 305
BardDialogue_VatyraInstrumental.ForceStart()
EndIf
if ChosenSong == 114 || ChosenSong == 212 || ChosenSong == 306
BardDialogue_WaywardWandererInstrumental.ForceStart()
EndIf
if ChosenSong == 115 || ChosenSong == 213 || ChosenSong == 307
BardDialogue_TheAgedManInstrumental.ForceStart()
EndIf
if ChosenSong == 116 || ChosenSong == 214 || ChosenSong == 308
BardDialogue_LastSunsetInstrumental.ForceStart()
EndIf
if ChosenSong == 117 || ChosenSong == 215 || ChosenSong == 309
BardDialogue_Instrumental20.ForceStart(); Drum Instrumental
EndIf
if ChosenSong == 130
BardDialogue_Instrumental30.ForceStart()
EndIf
if ChosenSong == 131
BardDialogue_Instrumental31.ForceStart()
EndIf
if ChosenSong == 555
BardDialogue_SongWaageScene.ForceStart()
EndIf
EndFunction
;---------------------------------------------------------------------------------------
int Function GetRandomSong()
Int BardSongToPlay = LastSongPlayed
float NoSinging = bNoSinging.GetValue()
if SingingBard.GetReference().IsInLocation(_00E_DunehomeInteriorLocation)
BardSongToPlay = Utility.RandomInt(102,117)
elseif SingingBard.GetReference().IsInLocation(_00E_UEEntr_FalseDog_Location)
BardSongToPlay = Utility.RandomInt(102,117)
elseif SingingBard.GetReference().IsInLocation(CapitalCityTheFatLeoranLocation)
BardSongToPlay = Utility.RandomInt(102,117)
elseif SingingBard.GetReference().IsInLocation(_00E_FlusshaimTaverneLocation)
BardSongToPlay = Utility.RandomInt(202,215)
elseif SingingBard.GetReference().IsInLocation(_00E_SuntempleQuarters)
BardSongToPlay = Utility.RandomInt(202,215)
elseif SingingBard.GetReference().IsInLocation(SchneefelstaverneInteriorLocation)
BardSongToPlay = Utility.RandomInt(302,309)
elseif SingingBard.GetReference().IsInLocation(BauernkuesteRoterOchseLocation)
BardSongToPlay = Utility.RandomInt(302,309)
endif
Return (BardSongToPlay)
EndFunction
;--------------------------------------------------------------------------------------
Function StopAllSongs()
StopSong = True
BardDialogue_Vatyra.Stop()
BardDialogue_WaywardWanderer.Stop()
BardDialogue_TheAgedMan.Stop()
BardDialogue_LastSunset.Stop()
BardDialogue_Whisperwood.Stop()
BardDialogue_WelcomeYouDrunkards.Stop()
BardDialogue_Song06.Stop()
BardDialogue_Song08.Stop()
BardDialogue_Song09.Stop()
BardDialogue_Song10.Stop()
BardDialogue_Song11.Stop()
BardDialogue_VatyraInstrumental.Stop()
BardDialogue_WaywardWandererInstrumental.Stop()
BardDialogue_TheAgedManInstrumental.Stop()
BardDialogue_LastSunsetInstrumental.Stop()
BardDialogue_Instrumental20.Stop()
BardDialogue_Instrumental30.Stop()
BardDialogue_Instrumental31.Stop()
;added in FS
BardDialogue_SongWaageScene.Stop()
Playing = 0
EndFunction
;---------------------------------------------------------------------------------------
bool Function IsRestricted(Cell akCurrentCell)
If akCurrentCell == CapitalCityCommonTavern
Return Self.IsRestrictionQuestRunning(arrayRestrictionQuestsDancingNomad, arrayRestrictionStagesDancingNomad)
Else
Return False
EndIf
EndFunction
;---------------------------------------------------------------------------------------
bool Function IsRestrictionQuestRunning(Quest[] arrayRestrictionQuests, int[] arrayRestrictionStages)
int iQuestArrayIndex = (arrayRestrictionQuests.Length - 1)
int iStageArrayIndex = (arrayRestrictionStages.Length - 1)
while (iQuestArrayIndex >= 0) && (iStageArrayIndex >= 0)
if (arrayRestrictionQuests[iQuestArrayIndex].GetStage() <= arrayRestrictionStages[iStageArrayIndex]) && (arrayRestrictionQuests[iQuestArrayIndex].GetStage() >= arrayRestrictionStages[iStageArrayIndex - 1])
Return True
Else
iQuestArrayIndex -= 1
iStageArrayIndex -= 2
endif
endwhile
Return False
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
;added in FS
Scene Property BardDialogue_SongWaageScene Auto
int CurrentBardSong
Actor Property SingingBardActor Auto Hidden
GlobalVariable Property _00E_BardDialogueGlobal Auto
MusicType Property _00E_SilenceAbruptHighPriority Auto
ReferenceAlias Property Spectator01 Auto
ReferenceAlias Property Spectator02 Auto
ReferenceAlias Property Spectator03 Auto
ReferenceAlias Property Spectator04 Auto
ReferenceAlias Property Spectator05 Auto
ReferenceAlias Property Dancer01 Auto
ReferenceAlias Property Dancer02 Auto
ReferenceAlias Property SingingBard Auto
ReferenceAlias Property Accompanist01 Auto
ReferenceAlias Property Accompanist02 Auto
ReferenceAlias Property Accompanist03 Auto
ReferenceAlias Property Accompanist04 Auto
ReferenceAlias Property Accompanist05 Auto
ReferenceAlias Property Accompanist06 Auto
ReferenceAlias Property CrowdMarker Auto
ReferenceAlias Property PerformanceStartMarker Auto
LocationAlias Property Location_Alias Auto
Scene Property TestScene Auto
Scene Property BardDialogue_ThePathlessWanderer Auto
Scene Property BardDialogue_TheLastSunsetPerformance Auto
Scene Property BardDialogue_TheAgedMan Auto
Scene Property BardDialogue_WaywardWanderer Auto
Scene Property BardDialogue_Vatyra Auto
Scene Property BardDialogue_LastSunset Auto
Scene Property BardDialogue_WelcomeYouDrunkards Auto
Scene Property BardDialogue_Song06 Auto
Scene Property BardDialogue_Whisperwood Auto
Scene Property BardDialogue_Song08 Auto
Scene Property BardDialogue_Song09 Auto
Scene Property BardDialogue_Song10 Auto
Scene Property BardDialogue_Song11 Auto
Scene Property BardDialogue_Song12 Auto
Scene Property BardDialogue_Song13 Auto
Scene Property BardDialogue_Song14 Auto
Scene Property BardDialogue_Song15 Auto
Scene Property BardDialogue_Song16 Auto
Scene Property BardDialogue_Song17 Auto
Scene Property BardDialogue_Song18 Auto
Scene Property BardDialogue_Song19 Auto
Scene Property BardDialogue_Song20 Auto
Scene Property BardDialogue_Song21 Auto
Scene Property BardDialogue_Song22 Auto
Scene Property BardDialogue_Song23 Auto
Scene Property BardDialogue_Song24 Auto
Scene Property BardDialogue_Song25 Auto
Scene Property BardDialogue_Song26 Auto
Scene Property BardDialogue_Song27 Auto
Scene Property BardDialogue_Song28 Auto
Scene Property BardDialogue_Song29 Auto
Scene Property BardDialogue_Song30 Auto
Scene Property BardDialogue_Song31 Auto
Scene Property BardDialogue_Song32 Auto
Scene Property BardDialogue_Song33 Auto
Scene Property BardDialogue_Song34 Auto
Scene Property BardDialogue_Song35 Auto
Scene Property BardDialogue_Song36 Auto
Scene Property BardDialogue_Song37 Auto
Scene Property BardDialogue_Song38 Auto
Scene Property BardDialogue_Song39 Auto
Scene Property BardDialogue_Song40 Auto
Scene Property BardDialogue_TheAgedManWithIntro Auto
Scene Property BardDialogue_WaywardWandererWithIntro Auto
Scene Property BardDialogue_VatyraWithIntro Auto
Scene Property BardDialogue_LastSunsetWithIntro Auto
Scene Property BardDialogue_WelcomeYouDrunkardsWithIntro Auto
Scene Property BardDialogue_Song06WithIntro Auto
Scene Property BardDialogue_WhisperwoodWithIntro Auto
Scene Property BardDialogue_Song08WithIntro Auto
Scene Property BardDialogue_Song09WithIntro Auto
Scene Property BardDialogue_Song10WithIntro Auto
Scene Property BardDialogue_Song11WithIntro Auto
Scene Property BardDialogue_Song12WithIntro Auto
Scene Property BardDialogue_Song13WithIntro Auto
Scene Property BardDialogue_Song14WithIntro Auto
Scene Property BardDialogue_Song15WithIntro Auto
Scene Property BardDialogue_Song16WithIntro Auto
Scene Property BardDialogue_Song17WithIntro Auto
Scene Property BardDialogue_Song18WithIntro Auto
Scene Property BardDialogue_Song19WithIntro Auto
Scene Property BardDialogue_Song20WithIntro Auto
Scene Property BardDialogue_Song21WithIntro Auto
Scene Property BardDialogue_Song22WithIntro Auto
Scene Property BardDialogue_Song23WithIntro Auto
Scene Property BardDialogue_Song24WithIntro Auto
Scene Property BardDialogue_Song25WithIntro Auto
Scene Property BardDialogue_Song26WithIntro Auto
Scene Property BardDialogue_Song27WithIntro Auto
Scene Property BardDialogue_Song28WithIntro Auto
Scene Property BardDialogue_Song29WithIntro Auto
Scene Property BardDialogue_Song30WithIntro Auto
Scene Property BardDialogue_Song31WithIntro Auto
Scene Property BardDialogue_Song32WithIntro Auto
Scene Property BardDialogue_Song33WithIntro Auto
Scene Property BardDialogue_Song34WithIntro Auto
Scene Property BardDialogue_Song35WithIntro Auto
Scene Property BardDialogue_Song36WithIntro Auto
Scene Property BardDialogue_Song37WithIntro Auto
Scene Property BardDialogue_Song38WithIntro Auto
Scene Property BardDialogue_Song39WithIntro Auto
Scene Property BardDialogue_Song40WithIntro Auto
Scene Property BardDialogue_TheAgedManInstrumental Auto
Scene Property BardDialogue_WaywardWandererInstrumental Auto
Scene Property BardDialogue_VatyraInstrumental Auto
Scene Property BardDialogue_LastSunsetInstrumental Auto
Scene Property BardDialogue_WelcomeYouDrunkardsInstrumental Auto
Scene Property BardDialogue_Instrumental06 Auto
Scene Property BardDialogue_WhisperwoodInstrumental Auto
Scene Property BardDialogue_Instrumental08 Auto
Scene Property BardDialogue_Instrumental09 Auto
Scene Property BardDialogue_Instrumental10 Auto
Scene Property BardDialogue_Instrumental11 Auto
Scene Property BardDialogue_Instrumental12 Auto
Scene Property BardDialogue_Instrumental13 Auto
Scene Property BardDialogue_Instrumental14 Auto
Scene Property BardDialogue_Instrumental15 Auto
Scene Property BardDialogue_Instrumental16 Auto
Scene Property BardDialogue_Instrumental17 Auto
Scene Property BardDialogue_Instrumental18 Auto
Scene Property BardDialogue_Instrumental19 Auto
Scene Property BardDialogue_Instrumental20 Auto
Scene Property BardDialogue_Instrumental21 Auto
Scene Property BardDialogue_Instrumental22 Auto
Scene Property BardDialogue_Instrumental23 Auto
Scene Property BardDialogue_Instrumental24 Auto
Scene Property BardDialogue_Instrumental25 Auto
Scene Property BardDialogue_Instrumental26 Auto
Scene Property BardDialogue_Instrumental27 Auto
Scene Property BardDialogue_Instrumental28 Auto
Scene Property BardDialogue_Instrumental29 Auto
Scene Property BardDialogue_Instrumental30 Auto
Scene Property BardDialogue_Instrumental31 Auto
Scene Property BardDialogue_Instrumental32 Auto
Scene Property BardDialogue_Instrumental33 Auto
Scene Property BardDialogue_Instrumental34 Auto
Scene Property BardDialogue_Instrumental35 Auto
Scene Property BardDialogue_Instrumental36 Auto
Scene Property BardDialogue_Instrumental37 Auto
Scene Property BardDialogue_Instrumental38 Auto
Scene Property BardDialogue_Instrumental39 Auto
Scene Property BardDialogue_Instrumental40 Auto
Scene Property BardDialogue_Instrumental41 Auto
Scene Property BardDialogue_Instrumental42 Auto
Scene Property BardDialogue_Instrumental43 Auto
Scene Property BardDialogue_Instrumental44 Auto
Scene Property BardDialogue_Instrumental45 Auto
Scene Property BardDialogue_Instrumental46 Auto
Scene Property BardDialogue_Instrumental47 Auto
Scene Property BardDialogue_Instrumental48 Auto
Scene Property BardDialogue_Instrumental49 Auto
Scene Property BardDialogue_Instrumental50 Auto
Sound Property _00E_MUS_Liliath_TheLastSunset_Marker Auto
Sound Property _00E_MUS_Liliath_ThePathless_Marker Auto
ObjectReference TriggeredTavernBard; bard who was chosen in triggerbox
ObjectReference TriggeredAccompanist01; accompanist01 who was chosen in triggerbox
ObjectReference TriggeredPerformanceStartMarker; PerformanceStartMarker that was chosen in triggerbox
ObjectReference TriggeredCrowdMarker; CrowdMarker that was chosen in triggerbox
Formlist TriggeredSpectatorFormlist
objectReference BardHandoff
Bool PlayContinuousHandoff
Int SongToPlayHandoff
Bool ChangeSettingsHandoff
Bool SavedPlayContinuous
int SavedSongToPlay
Int LastSongPlayed
Bool ProcessingDialogueRequest
Bool StopSong = False
Int Playing = 0 Conditional
_00E_QuestFunctions Property Levelsystem Auto
GlobalVariable Property bNoSinging auto
GlobalVariable Property GameHour auto
Location Property _00E_DunehomeInteriorLocation auto
Location Property _00E_UEEntr_FalseDog_Location auto
Location Property BauernkuesteRoterOchseLocation auto
Location Property SchneefelstaverneInteriorLocation auto
Location Property CapitalCityZumTanzendenNomadenLocation auto
Location Property _00E_SuntempleQuarters auto
Location Property _00E_FlusshaimTaverneLocation auto
Location Property CapitalCityTheFatLeoranLocation auto
;new properties for arrays
Quest[] Property arrayRestrictionQuestsDancingNomad auto
int[] Property arrayRestrictionStagesDancingNomad auto
Quest[] Property arrayRestrictionQuestsFatLeor auto
int[] Property arrayRestrictionStagesFatLeor auto
int[] Property arrayRestrictionStages auto
Quest[] Property arrayRestrictionQuests auto
cell property CapitalCityCommonTavern auto
cell property CapitalCityBar01 auto