ScriptName _sycMaintenanceRefAliasScript extends ReferenceAlias
; This script must be attached to the Player Alias defined in the Quest Alias tab of a Quest

;---------------------------------------------------------------------------------------------------
;### DECLARED VARIABLES/PROPERTIES ###
;---------------------------------------------------------------------------------------------------

; Quests
_sycMainQuestScript Property _sycMainQuest Auto	; This points the property to the appropriate quest script


;---------------------------------------------------------------------------------------------------
;### MAIN SCRIPT ###
;---------------------------------------------------------------------------------------------------

Event OnInit()	; Activates on first run
	GoToState("Maintenance")
EndEvent

Event OnPlayerLoadGame()	; This block activates every game load, except the first run
	GoToState("Maintenance")
EndEvent

State Maintenance
	Event OnBeginState()
		If Game.GetFormFromFile(0x00000D62, "CCO - Uninstaller.esp")	; Is CCO - Uninstaller.esp activated?
			_sycMainQuest.UninstallCCO()
		Else
			_sycMainQuest.VersionControl()
		EndIf
	EndEvent
EndState
