2021-10-05 22:59:59 +00:00
|
|
|
Scriptname _00E_HeroldScript extends Actor
|
|
|
|
|
|
|
|
Actor Property PlayerREF Auto
|
|
|
|
Scene[] Property HeroldScenes Auto
|
|
|
|
Package Property Ark_Herold_SpeakPackage Auto
|
|
|
|
Keyword Property LinkPerformanceSpot Auto
|
|
|
|
WorldSpace Property CapitalCityMarketArea Auto
|
|
|
|
|
|
|
|
Quest Property MQ09 Auto
|
|
|
|
Quest Property MQ12b Auto
|
|
|
|
Quest Property ArkGenericDialogue Auto
|
|
|
|
|
|
|
|
Bool DoOnce
|
|
|
|
Bool bPlayerIsInsideTrigger
|
|
|
|
Bool bPauseBetweenHeroldScenes
|
|
|
|
Bool bSiegeScenePlayed
|
|
|
|
Bool bWarScenePlayed
|
|
|
|
Scene scCurrentHeroldScene
|
|
|
|
Int iLastHeroldScene = -1
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
;=====================================================================================
|
|
|
|
; EVENTS
|
|
|
|
;=====================================================================================
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
State WaitBetweenScenes
|
|
|
|
Event OnUpdate()
|
|
|
|
SetPauseBetweenHeroldScenes(False)
|
|
|
|
EndEvent
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Event OnUpdateGameTime()
|
|
|
|
SetPauseBetweenHeroldScenes(False)
|
|
|
|
EndEvent
|
|
|
|
EndState
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
State WaitPlayNext
|
|
|
|
Event OnUpdate()
|
|
|
|
TryPlayNextHeroldScene()
|
|
|
|
EndEvent
|
|
|
|
EndState
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Event OnPackageStart(Package akNewPackage)
|
|
|
|
If akNewPackage == Ark_Herold_SpeakPackage && bPlayerIsInsideTrigger
|
|
|
|
TryPlayNextHeroldScene()
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
EndEvent
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function OnHeroldSceneStart(Scene scSceneStarted) ; Called from the scenes
|
|
|
|
ResetWaitState()
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
scCurrentHeroldScene = scSceneStarted
|
|
|
|
iLastHeroldScene = HeroldScenes.Find(scSceneStarted)
|
|
|
|
If iLastHeroldScene == 4
|
|
|
|
bSiegeScenePlayed = True
|
|
|
|
ElseIf iLastHeroldScene == 3
|
|
|
|
bWarScenePlayed = True
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
2021-10-05 22:59:59 +00:00
|
|
|
EndFunction
|
|
|
|
|
|
|
|
Function EndHeroldScene() ; Called from the scenes
|
|
|
|
scCurrentHeroldScene = None
|
|
|
|
SetPauseBetweenHeroldScenes(True)
|
|
|
|
EndFunction
|
|
|
|
|
2021-10-05 22:15:58 +00:00
|
|
|
|
|
|
|
;=====================================================================================
|
|
|
|
; FUNCTIONS
|
|
|
|
;=====================================================================================
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function _TryPlayNextHeroldScene()
|
|
|
|
ObjectReference speakMarkerRef = GetLinkedRef(LinkPerformanceSpot)
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
If scCurrentHeroldScene
|
|
|
|
If scCurrentHeroldScene.IsPlaying()
|
|
|
|
Return
|
|
|
|
Else
|
|
|
|
scCurrentHeroldScene = None
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
If PlayerREF.GetWorldSpace() == CapitalCityMarketArea && GetCurrentPackage() == Ark_Herold_SpeakPackage && (bPauseBetweenHeroldScenes == False)
|
|
|
|
ResetWaitState()
|
|
|
|
|
|
|
|
If GetDistance(speakMarkerRef) < 150.0
|
|
|
|
; ArkGenericDialogue start failsafe?
|
|
|
|
If DoOnce == False
|
|
|
|
DoOnce = True
|
|
|
|
If ArkGenericDialogue.GetStage() < 5
|
|
|
|
ArkGenericDialogue.SetStage(5)
|
|
|
|
Utility.Wait(1.0) ; Warm up ArkGenericDialogue
|
|
|
|
EndIf
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
; Try start new scene
|
|
|
|
Int iNewScene = 0
|
|
|
|
|
|
|
|
If MQ12b.GetStage() >= 10
|
|
|
|
If bSiegeScenePlayed == False
|
|
|
|
iNewScene = 4
|
|
|
|
Else
|
|
|
|
iNewScene = GetNextHeroldScene(3, 4)
|
|
|
|
EndIf
|
|
|
|
ElseIf MQ09.GetStage() >= 10
|
|
|
|
If bWarScenePlayed == False
|
|
|
|
iNewScene = 3
|
|
|
|
Else
|
|
|
|
iNewScene = GetNextHeroldScene(0, 3)
|
|
|
|
EndIf
|
|
|
|
Else
|
|
|
|
iNewScene = GetNextHeroldScene(0, 2)
|
|
|
|
EndIf
|
|
|
|
|
|
|
|
scCurrentHeroldScene = HeroldScenes[iNewScene]
|
|
|
|
scCurrentHeroldScene.ForceStart()
|
2021-10-05 22:15:58 +00:00
|
|
|
EndIf
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
; Serves both as a wait for the herold to approach the marker and as a failsafe if the scene is not started
|
|
|
|
GoToState("WaitPlayNext")
|
|
|
|
RegisterForSingleUpdate(5.0)
|
|
|
|
If scCurrentHeroldScene
|
|
|
|
Utility.Wait(1.0) ; Give some time for the scene to start before unlocking TryPlayNextHeroldScene
|
|
|
|
EndIf
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
EndFunction
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Int Function GetNextHeroldScene(Int iMinScene, Int iMaxScene)
|
|
|
|
Int iNewScene = iLastHeroldScene + 1
|
|
|
|
If iNewScene >= iMinScene && iNewScene <= iMaxScene
|
|
|
|
Return iNewScene
|
|
|
|
Else
|
|
|
|
Return iMinScene
|
|
|
|
EndIf
|
2021-10-05 22:15:58 +00:00
|
|
|
EndFunction
|
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Bool bSceneUpdatesLocked = False
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function TryPlayNextHeroldScene()
|
|
|
|
While bSceneUpdatesLocked
|
|
|
|
Utility.Wait(1.0)
|
|
|
|
EndWhile
|
|
|
|
bSceneUpdatesLocked = True
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
_TryPlayNextHeroldScene()
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
bSceneUpdatesLocked = False
|
|
|
|
EndFunction
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function SetPlayerInsideTrigger(Bool _bPlayerIsInsideTrigger)
|
|
|
|
bPlayerIsInsideTrigger = _bPlayerIsInsideTrigger
|
|
|
|
If bPlayerIsInsideTrigger
|
|
|
|
TryPlayNextHeroldScene()
|
|
|
|
EndIf
|
|
|
|
EndFunction
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function SetPauseBetweenHeroldScenes(Bool _bPauseBetweenHeroldScenes)
|
|
|
|
ResetWaitState()
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
bPauseBetweenHeroldScenes = _bPauseBetweenHeroldScenes
|
|
|
|
If bPauseBetweenHeroldScenes
|
|
|
|
GoToState("WaitBetweenScenes")
|
|
|
|
RegisterForSingleUpdateGameTime(0.5)
|
|
|
|
Else
|
|
|
|
TryPlayNextHeroldScene()
|
|
|
|
EndIf
|
|
|
|
EndFunction
|
2021-10-05 22:15:58 +00:00
|
|
|
|
2021-10-05 22:59:59 +00:00
|
|
|
Function ResetWaitState()
|
|
|
|
GoToState("")
|
|
|
|
UnregisterForUpdateGameTime()
|
|
|
|
UnregisterForUpdate()
|
|
|
|
EndFunction
|