;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment
;NEXT FRAGMENT INDEX 21
Scriptname QF_CWResolution02_0001FA52 Extends Quest Hidden

;BEGIN ALIAS PROPERTY FieldCO
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_FieldCO Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen8 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen18
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen18 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnDefender4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnDefender4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlBodyGuard5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlBodyGuard5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnBarricade
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnBarricade Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen13
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen13 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen19
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen19 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Barricade
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Barricade Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlBodyGuard1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlBodyGuard1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen17
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen17 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen12
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen12 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlBodyGuard4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlBodyGuard4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen11
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen11 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlsHouseCenterMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlsHouseCenterMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnDefender3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnDefender3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CampaignStartMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CampaignStartMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Hold
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_Hold Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlBodyGuard3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlBodyGuard3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen15
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen15 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker8 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnDefender2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnDefender2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Capital
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_Capital Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Jarl
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Jarl Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnAttacker3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnAttacker3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnDefenderFailSafe
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnDefenderFailSafe Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY MapMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_MapMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnAttacker2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnAttacker2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GarrisonEnableMarkerImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GarrisonEnableMarkerImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CapitalEdgeMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CapitalEdgeMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnAttacker4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnAttacker4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlBodyGuard2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlBodyGuard2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen16
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen16 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnAttacker1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnAttacker1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CapitalCenterMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CapitalCenterMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnAttackerFailSafe
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnAttackerFailSafe Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SpawnDefender1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SpawnDefender1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy8 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GarrisonEnableMarkerSons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GarrisonEnableMarkerSons Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlsHouse
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_JarlsHouse Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen14
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen14 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen20
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen20 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierEnemy7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierEnemy7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SoldierFriendly8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SoldierFriendly8 Auto
;END ALIAS PROPERTY

;BEGIN FRAGMENT Fragment_16
Function Fragment_16()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
;Turn off normal garrisons
Alias_GarrisonEnableMarkerImperial.GetReference().disable()
Alias_GarrisonEnableMarkerSons.GetReference().disable()

;Create the soldiers
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy1, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy2, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy3, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy4, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy5, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy6, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy7, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy8, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy9, Alias_CapitalEdgeMarker.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_SoldierEnemy10, Alias_CapitalEdgeMarker.GetReference(), false, false)

kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly1, Alias_ResolutionDefenderMarker1.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly2, Alias_ResolutionDefenderMarker2.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly3, Alias_ResolutionDefenderMarker3.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly4, Alias_ResolutionDefenderMarker4.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly5, Alias_ResolutionDefenderMarker5.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly6, Alias_ResolutionDefenderMarker6.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly7, Alias_ResolutionDefenderMarker7.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly8, Alias_ResolutionDefenderMarker8.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly9, Alias_ResolutionDefenderMarker9.GetReference(), false, false)
kmyquest.CreateAliasedSoldierAlly(Alias_SoldierFriendly10, Alias_ResolutionDefenderMarker10.GetReference(), false, false)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_19
Function Fragment_19()
;BEGIN AUTOCAST TYPE CWReinforcementControllerScript
Quest __temp = self as Quest
CWReinforcementControllerScript kmyQuest = __temp as CWReinforcementControllerScript
;END AUTOCAST
;BEGIN CODE
kmyquest.RegisterAttackPoint(Alias_Capital.GetLocation())

;Sets starting respawn pool
kmyquest.SetPoolAttacker(10)
kmyquest.SetPoolDefender(10)

;Registers spawn points
kmyquest.RegisterSpawnAttackerAliases(Alias_SpawnAttacker1, Alias_SpawnAttacker2, Alias_SpawnAttacker3, Alias_SpawnAttacker4,  Alias_SpawnAttackerFailSafe)
kmyquest.RegisterSpawnDefenderAliases(Alias_SpawnDefender1, Alias_SpawnDefender2, Alias_SpawnDefender3, Alias_SpawnDefender4, Alias_SpawnDefenderFailSafe)

;List of Spawning Attackers
kmyquest.RegisterAlias(Alias_SoldierEnemy1)
kmyquest.RegisterAlias(Alias_SoldierEnemy2)
kmyquest.RegisterAlias(Alias_SoldierEnemy3)
kmyquest.RegisterAlias(Alias_SoldierEnemy4)
kmyquest.RegisterAlias(Alias_SoldierEnemy5)
kmyquest.RegisterAlias(Alias_SoldierEnemy6)
kmyquest.RegisterAlias(Alias_SoldierEnemy7)
kmyquest.RegisterAlias(Alias_SoldierEnemy8)
kmyquest.RegisterAlias(Alias_SoldierEnemy9)
kmyquest.RegisterAlias(Alias_SoldierEnemy10)

;List of Spawning Defenders
kmyquest.RegisterAlias(Alias_SoldierFriendly1)
kmyquest.RegisterAlias(Alias_SoldierFriendly2)
kmyquest.RegisterAlias(Alias_SoldierFriendly3)
kmyquest.RegisterAlias(Alias_SoldierFriendly4)
kmyquest.RegisterAlias(Alias_SoldierFriendly5)
kmyquest.RegisterAlias(Alias_SoldierFriendly6)
kmyquest.RegisterAlias(Alias_SoldierFriendly7)
kmyquest.RegisterAlias(Alias_SoldierFriendly8)
kmyquest.RegisterAlias(Alias_SoldierFriendly9)
kmyquest.RegisterAlias(Alias_SoldierFriendly10)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_4
Function Fragment_4()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
kmyquest.playerFoundArmy = 1

setObjectiveCompleted(10)
setObjectiveDisplayed(20)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_3
Function Fragment_3()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
kmyquest.EnableMapMarkerAlias(Alias_MapMarker)

setobjectivedisplayed(10)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_14
Function Fragment_14()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
; ; debug.traceConditional("CWResolution02 stage 255 (shut down phase)", kmyquest.CWs.debugon.value)

UnregisterForUpdate()

Alias_Jarl.unregisterForUpdate()

;delete created references
;*** TO DO: When we have arrays, CreateMissionAliasedActor should put all created references to an array, then a new funciton should delete ALL of them

Alias_JarlBodyguard1.GetReference().DeleteWhenAble()
Alias_JarlBodyguard2.GetReference().DeleteWhenAble()
Alias_JarlBodyguard3.GetReference().DeleteWhenAble()
Alias_JarlBodyguard4.GetReference().DeleteWhenAble()
Alias_JarlBodyguard5.GetReference().DeleteWhenAble()

Alias_SoldierFriendly1.GetReference().DeleteWhenAble()
Alias_SoldierFriendly2.GetReference().DeleteWhenAble()
Alias_SoldierFriendly3.GetReference().DeleteWhenAble()
Alias_SoldierFriendly4.GetReference().DeleteWhenAble()
Alias_SoldierFriendly5.GetReference().DeleteWhenAble()
Alias_SoldierFriendly6.GetReference().DeleteWhenAble()
Alias_SoldierFriendly7.GetReference().DeleteWhenAble()
Alias_SoldierFriendly8.GetReference().DeleteWhenAble()
Alias_SoldierFriendly9.GetReference().DeleteWhenAble()
Alias_SoldierFriendly10.GetReference().DeleteWhenAble()

Alias_SoldierEnemy1.GetReference().DeleteWhenAble()
Alias_SoldierEnemy2.GetReference().DeleteWhenAble()
Alias_SoldierEnemy3.GetReference().DeleteWhenAble()
Alias_SoldierEnemy4.GetReference().DeleteWhenAble()
Alias_SoldierEnemy5.GetReference().DeleteWhenAble()
Alias_SoldierEnemy6.GetReference().DeleteWhenAble()
Alias_SoldierEnemy7.GetReference().DeleteWhenAble()
Alias_SoldierEnemy8.GetReference().DeleteWhenAble()
Alias_SoldierEnemy9.GetReference().DeleteWhenAble()
Alias_SoldierEnemy10.GetReference().DeleteWhenAble()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_9
Function Fragment_9()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
kmyquest.jarlWillSurrender = 1

setObjectiveFailed(30)
;setObjectiveDisplayed(40)

;going straight to failedcompletion

kmyquest.jarlHasSurrendered = 1
setStage(210)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_12
Function Fragment_12()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
;Fail quest because of time expiring

; ; debug.traceConditional("CWResolution02 stage 205 FAILURE!!! Time Expired", kmyquest.CWs.debugon.value)

kmyquest.CWCampaignS.FailedMission = 1

kmyquest.CWCampaignS.AdvanceCampaignPhase()
UnregisterForUpdate()
stop()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_13
Function Fragment_13()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
;FAIL QUEST because OBJECTIVE FAILED, clean up
; ; debug.traceConditional("CWResolution02 stage 210 FAILURE!!! Objective lost", kmyquest.CWs.debugon.value)

kmyquest.CWCampaignS.FailedMission = 1
;Attackers Win
;kmyquest.CWs.ContestedHoldWinner = kmyquest.CWs.Attacker

kmyquest.CWCampaign.setStage(255)
stop()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_11
Function Fragment_11()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
;Successfully complete quest
; ; debug.traceConditional("CWResolution02 stage 200 SUCCESS!!!", kmyquest.CWs.debugon.value)

;Defenders Win
;kmyquest.CWs.ContestedHoldWinner = kmyquest.CWs.Defender

kmyquest.CWCampaign.setStage(255)

stop()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_0
Function Fragment_0()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
;CWResolution02Script

; ; debug.traceConditional("CWResolution02 Stage 0: Quest Started in " + Alias_Capital.GetLocation(), kmyquest.CWs.debugon.value)
debug.messageBox("CWResolution02  Started")

kmyquest.RegisterMissionTypeWithCampaign(0, 2);ignore first param, second param means ResolutionType, 2 = Defend Minor Hold Capital (ie THIS quest)
((kmyquest as quest) as CWMissionPollForCampaignPhaseScript).startPolling()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_15
Function Fragment_15()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
; ; debug.traceConditional("CWResolution02 Stage 10", kmyquest.CWs.debugon.value)

;move Jarl
objectReference JarlsHouseCenterMarker =Alias_JarlsHouseCenterMarker.GetReference()
Alias_Jarl.GetReference().MoveTo(JarlsHouseCenterMarker)
Alias_Jarl.RegisterForUpdate(5)

;Create Jarl's body guards
kmyquest.CreateAliasedSoldierDefender(Alias_Hold.GetLocation(), Alias_JarlBodyGuard1, JarlsHouseCenterMarker, false)
kmyquest.CreateAliasedSoldierDefender(Alias_Hold.GetLocation(), Alias_JarlBodyGuard2, JarlsHouseCenterMarker, false)
kmyquest.CreateAliasedSoldierDefender(Alias_Hold.GetLocation(), Alias_JarlBodyGuard3, JarlsHouseCenterMarker, false)
kmyquest.CreateAliasedSoldierDefender(Alias_Hold.GetLocation(), Alias_JarlBodyGuard4, JarlsHouseCenterMarker, false)
kmyquest.CreateAliasedSoldierDefender(Alias_Hold.GetLocation(), Alias_JarlBodyGuard5, JarlsHouseCenterMarker, false)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_8
Function Fragment_8()
;BEGIN AUTOCAST TYPE CWResolution02Script
Quest __temp = self as Quest
CWResolution02Script kmyQuest = __temp as CWResolution02Script
;END AUTOCAST
;BEGIN CODE
kmyquest.barricadeDestroyed = 1

setObjectiveFailed(20)
setObjectiveDisplayed(30)
;END CODE
EndFunction
;END FRAGMENT

;END FRAGMENT CODE - Do not edit anything between this and the begin comment
