enderalse/scripts/source/_00e_heroldscript.psc

144 lines
3.7 KiB
Plaintext

Scriptname _00E_HeroldScript extends actor
;=====================================================================================
; EVENTS
;=====================================================================================
Event OnUpdateGameTime()
CheckForHerold()
EndEvent
Event OnPackageStart(Package akNewPackage)
if akNewPackage == CapitalCityHeroldSpeak8x12
CheckForHerold()
endif
EndEvent
Event OnPackageEnd(Package akNewPackage)
if akNewPackage != CapitalCityHeroldSpeak8x12
bCurrentlySpeaking = False
scCurrentHeroldScene.Stop()
endif
EndEvent
Event OnUpdate()
If bCurrentlySpeaking
if !scCurrentHeroldScene.IsPlaying()
PickHeroldSceneAtRandom().ForceStart()
RegisterForSingleUpdate(5)
Else
UnregisterForUpdate()
EndIf
EndIf
EndEvent
;=====================================================================================
; FUNCTIONS
;=====================================================================================
Function EndHeroldScene()
bCurrentlySpeaking = False
if Self.GetCurrentPackage() == CapitalCityHeroldSpeak8x12 && (PlayerREF.GetWorldSpace() == CapitalCityMarketArea)
RegisterForSingleUpdateGameTime(0.5)
EndIf
EndFunction
Function CheckForHerold()
if Self.GetCurrentPackage() == CapitalCityHeroldSpeak8x12 && (PlayerREF.GetWorldSpace() == CapitalCityMarketArea)
if !bCurrentlySpeaking
bCurrentlySpeaking = True
if !DoOnce && ArkGenericDialogue.GetStage() < 5
ArkGenericDialogue.SetStage(5)
DoOnce = true
endif
PickHeroldSceneAtRandom().ForceStart()
EndIf
endif
EndFunction
Scene Function PickHeroldSceneAtRandom()
int iSceneIndex = 0
if !bSiegeScenePlayed && MQ12b.GetStage() >= 10
bSiegeScenePlayed = True
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC6
Return ArkGenericDialogue_Herold_SC6
elseif !bWarScenePlayed && MQ09.GetStage() >= 10
bWarScenePlayed = True
Return ArkGenericDialogue_Herold_SC5
elseif MQ12b.GetStage() >= 10
iSceneIndex = Utility.RandomInt(5,8)
elseif MQ09.GetStage() >= 10
iSceneIndex = Utility.RandomInt(0,6)
else
iSceneIndex = Utility.RandomInt(0,4)
endif
if iSceneIndex <= 1
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC1
elseif iSceneIndex == 2
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC2
elseif iSceneIndex == 3
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC3
elseif iSceneIndex == 4
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC3
elseif iSceneIndex == 5 || iSceneIndex == 6
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC5
elseif iSceneIndex == 7 || iSceneIndex == 8
scCurrentHeroldScene = ArkGenericDialogue_Herold_SC6
endif
bCurrentlySpeaking = true
Return scCurrentHeroldScene as Scene
EndFunction
;=====================================================================================
; PROPERTIES
;=====================================================================================
Actor Property PlayerREF Auto
Scene scCurrentHeroldScene
bool Property bCurrentlySpeaking Auto Hidden
bool DoOnce
bool bSiegeScenePlayed
bool bWarScenePlayed
WorldSpace Property CapitalCityMarketArea Auto
Location Property CapitalCityLocation Auto
Package Property CapitalCityHeroldSpeak8x12 Auto
Package Property CapitalCityHeroldSandbox20x4 Auto
Scene Property ArkGenericDialogue_Herold_SC1 Auto
Scene Property ArkGenericDialogue_Herold_SC2 Auto
Scene Property ArkGenericDialogue_Herold_SC3 Auto
Scene Property ArkGenericDialogue_Herold_SC4 Auto
Scene Property ArkGenericDialogue_Herold_SC5 Auto
Scene Property ArkGenericDialogue_Herold_SC6 Auto
Quest Property MQ09 Auto
Quest Property MQ12b Auto
Quest Property ArkGenericDialogue Auto