1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

61 lines
1.8 KiB

Scriptname CWCampaignPollForMissionAcceptScript extends Quest
;## Quests ##
Quest Property CW Auto
Quest Property CWCampaign Auto
;## Scripts ##
;These will be assigned in the OnInit() block
CWScript Property CWs Auto hidden
CWCampaignScript Property CWCampaignS Auto hidden
Event OnInit()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " OnInit()", 0, True, True)
CWs = CW as CWScript
CWCampaignS = CWCampaign as CWCampaignScript
registerForUpdate(5)
EndEvent
auto State NotPolling
Event OnUpdate()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'NotPolling' OnUpdate(), doing nothing." )
EndEvent
EndState
State Polling
Event OnUpdate()
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' OnUpdate(), polling for quest acceptance or GameDaysPassed > NextPhaseDay." )
if CWCampaignS.AcceptedMission > 0
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' See's AcceptedMission > 0, going to State 'NotPolling'" )
StopPolling()
Elseif CWs.GameDaysPassed.value > CWCampaignS.NextPhaseDay
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' sees that GameDaysPassed(" + CWs.GameDaysPassed.value + ") > NextPhaseDay(" + CWCampaignS.NextPhaseDay + "), stopping polling, and calling AdvanceCampaignPhase()" )
StopPolling()
CWCampaignS.AdvanceCampaignPhase() ;this will among other things set AcceptedMission to 0
Else
; CWScript.Log("CWCampaignPollForMissionAcceptScript" , " State: 'Polling' sees that GameDaysPassed(" + CWs.GameDaysPassed.value + ") < NextPhaseDay(" + CWCampaignS.NextPhaseDay + "), will keep polling." )
EndIf
EndEvent
EndState
Function StartPolling()
GoToState("Polling")
EndFunction
Function StopPolling()
GoToState("NotPolling")
EndFunction