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

;BEGIN ALIAS PROPERTY Justiciar
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Justiciar Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionNewJarlMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionNewJarlMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BodyGuard5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionJarlMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BodyGuard3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BodyGuard4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BodyGuard2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen56
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen56 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY EnemySoldier6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Soldier6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CityFieldCOImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CityFieldCOImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen70
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen70 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY ConfrontationTriggerbox2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ConfrontationTriggerbox2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionFieldCOMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionFieldCOMarker Auto
;END ALIAS PROPERTY

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

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

;BEGIN ALIAS PROPERTY JarlSurrenderFieldCOMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlSurrenderFieldCOMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen68
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen68 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen55
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen55 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen48
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen48 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen30
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen30 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY BackupJarlWhiterun
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BackupJarlWhiterun Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen50
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen50 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY CastleNPC9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY City
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_City Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen58
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen58 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY BodyGuard6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC8 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BodyGuard1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BodyGuard1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen66
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen66 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Citizen26
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen26 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlThrone
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlThrone Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen43
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen43 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Citizen49
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen49 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen47
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen47 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Soldier3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker12
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker12 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Soldier4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY HouseCarl
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_HouseCarl Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen57
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen57 Auto
;END ALIAS PROPERTY

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

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

;BEGIN ALIAS PROPERTY Citizen52
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen52 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CityFieldCOSons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CityFieldCOSons Auto
;END ALIAS PROPERTY

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

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

;BEGIN ALIAS PROPERTY Citizen59
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen59 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY JarlSurrenderMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlSurrenderMarker Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Friend
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Friend Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen53
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen53 Auto
;END ALIAS PROPERTY

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

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

;BEGIN ALIAS PROPERTY Citizen22
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen22 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen29
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen29 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SonsEnable
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_SonsEnable Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen27
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen27 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen63
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen63 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen67
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen67 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen46
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen46 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Soldier1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY NewJarl
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_NewJarl Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY DragonreachDoor
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_DragonreachDoor Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY BackupJarlMarkarth
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BackupJarlMarkarth Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlSurrenderFriendMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlSurrenderFriendMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Player
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Player Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen65
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen65 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen45
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen45 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Soldier5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Steward
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Steward Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BattleCenterMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BattleCenterMarker Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker1 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY ResolutionHouseCarlMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionHouseCarlMarker Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleHideMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleHideMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier8 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY CastleNPC4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen64
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen64 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC1 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY JarlSurrenderHouseCarlMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlSurrenderHouseCarlMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BackupJarlRiften
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BackupJarlRiften Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionJarlGuardMarker6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionJarlGuardMarker6 Auto
;END ALIAS PROPERTY

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

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

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

;BEGIN ALIAS PROPERTY ClutterEnableToggle
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ClutterEnableToggle Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY JarlSurrenderNewJarlMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_JarlSurrenderNewJarlMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen41
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen41 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier11
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier11 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier12
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier12 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PatrolStartA
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PatrolStartA Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ResolutionDefenderMarker11
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ResolutionDefenderMarker11 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CapitalHQ
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_CapitalHQ Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY CastleNPC5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_CastleNPC5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PatrolStartB
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PatrolStartB Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Soldier2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Soldier2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen62
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen62 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ConfrontationTriggerbox
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ConfrontationTriggerbox Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY ImperialEnable
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ImperialEnable Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY EnemySoldier9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_EnemySoldier9 Auto
;END ALIAS PROPERTY

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

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

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

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

;BEGIN ALIAS PROPERTY Citizen21
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen21 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen44
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen44 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen23
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen23 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen24
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen24 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen25
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen25 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen28
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen28 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen40
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen40 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Citizen42
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen42 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen51
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen51 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen54
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen54 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen60
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen60 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Citizen61
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen61 Auto
;END ALIAS PROPERTY

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

;BEGIN ALIAS PROPERTY Citizen69
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Citizen69 Auto
;END ALIAS PROPERTY

;BEGIN FRAGMENT Fragment_0
Function Fragment_0()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
; CWScript.Log("AttackCity", "Stage 0: Quest Started in " + Alias_City.GetLocation())

ObjectReference SpawnAttacker1 =  Alias_SpawnAttacker1.GetReference()
ObjectReference SpawnAttacker2 =  Alias_SpawnAttacker1.GetReference()

;turns on fires in the city
if Alias_ClutterEnableToggle.GetReference()
	Alias_ClutterEnableToggle.GetReference().Enable()
endif

kmyquest.CWSiegeObjJarl.ForceRefTo(Alias_Jarl.GetReference())
kmyquest.CWSiegeObj.setObjectiveCompleted(1050)
kmyquest.CWSiegeObj.setObjectiveDisplayed(1200)

; CWScript.Log("AttackCity", "Stage 0: Disabling Garrison enable markers")
Alias_ImperialEnable.getReference().disable()
Alias_SonsEnable.getReference().disable()


Actor JarlActor = Alias_Jarl.GetActorReference()
Actor HouseCarlActor = Alias_HouseCarl.GetActorReference()
Actor PlayerActor = Game.GetPlayer()

; CWScript.Log("AttackCity", "Stage 0: moving Jarl and Housecarl aliases")
JarlActor.moveto(Alias_ResolutionJarlMarker.GetReference())
HouseCarlActor.moveto(Alias_ResolutionHouseCarlMarker.GetReference())

; CWScript.Log("AttackCity", "Stage 0: setting player relationship rank to 0 if greater than for Jarl and Housecarl aliases")

if JarlActor.GetRelationshipRank(PlayerActor) >0
	JarlActor.SetRelationshipRank(PlayerActor, 0)
endif

if HouseCarlActor.GetRelationshipRank(PlayerActor) >0
	HouseCarlActor.SetRelationshipRank(PlayerActor, 0)
endif

; CWScript.Log("AttackCity", "Stage 0: creating Jarl body guards")

ObjectReference ResolutionJarlGuardMarker1Ref = Alias_ResolutionJarlGuardMarker1.GetReference()
ObjectReference ResolutionJarlGuardMarker2Ref = Alias_ResolutionJarlGuardMarker2.GetReference()
ObjectReference ResolutionJarlGuardMarker3Ref = Alias_ResolutionJarlGuardMarker3.GetReference()
ObjectReference ResolutionJarlGuardMarker4Ref = Alias_ResolutionJarlGuardMarker4.GetReference()
ObjectReference ResolutionJarlGuardMarker5Ref = Alias_ResolutionJarlGuardMarker5.GetReference()
ObjectReference ResolutionJarlGuardMarker6Ref = Alias_ResolutionJarlGuardMarker6.GetReference()

;NOTE: the other cities only have a single ref type for the ResolutionJarlGuardMarkers, I made the 6 specific types after we cut the other cities from the war
;so if we need to add them back in, i'll need to change the location ref types of the markers in the other castles

if Alias_City.GetLocation() == kmyquest.CWs.WhiterunLocation
	Alias_BodyGuard1.ForceRefTo(ResolutionJarlGuardMarker1Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
	Alias_BodyGuard2.ForceRefTo(ResolutionJarlGuardMarker2Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
	Alias_BodyGuard3.ForceRefTo(ResolutionJarlGuardMarker3Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
	Alias_BodyGuard4.ForceRefTo(ResolutionJarlGuardMarker4Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
	Alias_BodyGuard5.ForceRefTo(ResolutionJarlGuardMarker5Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
	Alias_BodyGuard6.ForceRefTo(ResolutionJarlGuardMarker6Ref.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))

;	Alias_BodyGuard1.GetActorReference().setAlert()
;	Alias_BodyGuard2.GetActorReference().setAlert()
;	Alias_BodyGuard3.GetActorReference().setAlert()
;	Alias_BodyGuard4.GetActorReference().setAlert()
;	Alias_BodyGuard5.GetActorReference().setAlert()
;	Alias_BodyGuard6.GetActorReference().setAlert()

else

	kmyquest.CreateAliasedSoldierEnemy(Alias_BodyGuard1, ResolutionJarlGuardMarker1Ref, false, false)
	kmyquest.CreateAliasedSoldierEnemy(Alias_BodyGuard2, ResolutionJarlGuardMarker1Ref, false, false)
	kmyquest.CreateAliasedSoldierEnemy(Alias_BodyGuard3, ResolutionJarlGuardMarker1Ref, false, false)

endif


; CWScript.Log("AttackCity", "Stage 0: moving FieldCO inside city gate")
Alias_FieldCO.GetReference().moveto(SpawnAttacker1)

; CWScript.Log("AttackCity", "Stage 0: enabling DefenderMarkers")
ObjectReference ResolutionDefenderMarkerRef1 = Alias_ResolutionDefenderMarker1.GetReference()
ObjectReference ResolutionDefenderMarkerRef2 = Alias_ResolutionDefenderMarker2.GetReference()
ObjectReference ResolutionDefenderMarkerRef3 = Alias_ResolutionDefenderMarker3.GetReference()
ObjectReference ResolutionDefenderMarkerRef4 = Alias_ResolutionDefenderMarker4.GetReference()
ObjectReference ResolutionDefenderMarkerRef5 = Alias_ResolutionDefenderMarker5.GetReference()
ObjectReference ResolutionDefenderMarkerRef6 = Alias_ResolutionDefenderMarker6.GetReference()
ObjectReference ResolutionDefenderMarkerRef7 = Alias_ResolutionDefenderMarker7.GetReference()
ObjectReference ResolutionDefenderMarkerRef8 = Alias_ResolutionDefenderMarker8.GetReference()
ObjectReference ResolutionDefenderMarkerRef9 = Alias_ResolutionDefenderMarker9.GetReference()
ObjectReference ResolutionDefenderMarkerRef10 = Alias_ResolutionDefenderMarker10.GetReference()
ObjectReference ResolutionDefenderMarkerRef11 = Alias_ResolutionDefenderMarker11.GetReference()
ObjectReference ResolutionDefenderMarkerRef12 = Alias_ResolutionDefenderMarker12.GetReference()


;see CWDisableHoldPositionMarkerTrigger script for why we need to do this
ResolutionDefenderMarkerRef1.Enable()
ResolutionDefenderMarkerRef2.Enable()
ResolutionDefenderMarkerRef3.Enable()
ResolutionDefenderMarkerRef4.Enable()
ResolutionDefenderMarkerRef5.Enable()

; CWScript.Log("AttackCity", "Stage 0: creating player enemy soldiers")

if  Alias_City.GetLocation() == kmyquest.CWs.WhiterunLocation

Alias_EnemySoldier1.ForceRefTo(ResolutionDefenderMarkerRef1.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier2.ForceRefTo(ResolutionDefenderMarkerRef2.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier3.ForceRefTo(ResolutionDefenderMarkerRef3.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier4.ForceRefTo(ResolutionDefenderMarkerRef4.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier5.ForceRefTo(ResolutionDefenderMarkerRef5.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier6.ForceRefTo(ResolutionDefenderMarkerRef6.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier7.ForceRefTo(ResolutionDefenderMarkerRef7.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier8.ForceRefTo(ResolutionDefenderMarkerRef8.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier9.ForceRefTo(ResolutionDefenderMarkerRef9.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier10.ForceRefTo(ResolutionDefenderMarkerRef10.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier11.ForceRefTo(ResolutionDefenderMarkerRef11.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))
Alias_EnemySoldier12.ForceRefTo(ResolutionDefenderMarkerRef12.PlaceAtMe(kmyquest.CWSiegeWhiterunImperialSoldier))

else

;FOR NOW USE IMPERIAL/STORMCLOAKS... will need to change these to hold specific guys like in whiterun

kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier1, Alias_ResolutionDefenderMarker1.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier2, Alias_ResolutionDefenderMarker2.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier3, Alias_ResolutionDefenderMarker3.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier4, Alias_ResolutionDefenderMarker4.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier5, Alias_ResolutionDefenderMarker5.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier6, Alias_ResolutionDefenderMarker6.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier7, Alias_ResolutionDefenderMarker7.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier8, Alias_ResolutionDefenderMarker8.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier9, Alias_ResolutionDefenderMarker9.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier10, Alias_ResolutionDefenderMarker10.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier11, Alias_ResolutionDefenderMarker11.GetReference(), false, false)
kmyquest.CreateAliasedSoldierEnemy(Alias_EnemySoldier12, Alias_ResolutionDefenderMarker12.GetReference(), false, false)

endif

; CWScript.Log("AttackCity", "Stage 0: creating player ally soldiers")

;*** !!! *** !!! THESE SHOULD BE SET UP TO SPAWN INFINITE REINFORCEMENTS *** !!! *** !!! 

if  Alias_City.GetLocation() == kmyquest.CWs.WhiterunLocation

	Alias_Soldier1.ForceRefTo(SpawnAttacker1.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))
	Alias_Soldier2.ForceRefTo(SpawnAttacker1.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))
	Alias_Soldier3.ForceRefTo(SpawnAttacker1.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))
	Alias_Soldier4.ForceRefTo(SpawnAttacker2.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))
	Alias_Soldier5.ForceRefTo(SpawnAttacker2.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))
	Alias_Soldier6.ForceRefTo(SpawnAttacker2.PlaceAtMe(kmyquest.CWSiegeSonsSoldier))

else

	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier1, SpawnAttacker1 , false, false)
	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier2, SpawnAttacker1 , false, false)
	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier3, SpawnAttacker1 , false, false)
	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier4, SpawnAttacker2 , false, false)
	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier5, SpawnAttacker2 , false, false)
	kmyquest.CreateAliasedSoldierAlly(Alias_Soldier6, SpawnAttacker2 , false, false)

endif

; CWScript.Log("AttackCity", "Stage 0: making Jarl, Housecarl, body guards non-aggressive")
Alias_Jarl.GetActorReference().setAV("Aggression", 0)
Alias_HouseCarl.GetActorReference().setAV("Aggression", 0)
Alias_BodyGuard1.GetActorReference().setAV("Aggression", 0)
Alias_BodyGuard2.GetActorReference().setAV("Aggression", 0)
Alias_BodyGuard3.GetActorReference().setAV("Aggression", 0)

Alias_Justiciar.GetActorReference().setAV("Aggression", 0)

Alias_Jarl.RegisterForUpdate(5)

;REMINDER CWAttackCityConfrontationScene STARTS ON STARTUP

;-Commented out 7/11 jduvall, I believe this is all handled by the Player Alias script now
; ;CWScript.Log("AttackCity", self + "Stage 0: RegisterForUpdate() and RegisterBattleCenterMarkerAndLocation() so we can check if the player leaves the battle.")
;RegisterForUpdate(1)		;Needed for checking if the player has left the battle
;((self as quest) as CWSiegePollPlayerLocation).RegisterBattleCenterMarkerAndLocation(Alias_BattleCenterMarker.GetReference(), Alias_City.GetLocation())

; CWScript.Log("AttackCity", self + "Stage 0: Giving Jarl Steel plate and storing his current outfit to retrieve later")
;WE DONT YET HAVE FUNCTIONALITY TO GET OUTFIT
;if we get that function I should change this to store the outfit the jarl is currently wearing
;for now assume this is Balgruuf, because we only do sieges at whiterun now
Alias_Jarl.GetActorReference().setOutfit(kmyquest.ArmorBalgruufSteelPlateNoHelmetOutfit)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_10
Function Fragment_10()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
;A CONDITION ON FRIEND PACKAGES... SET BY DOOR INTO WORLD SPACE
; CWScript.Log("AttackCity", "Stage 10: moving friend into city.")
Alias_Friend.GetReference().MoveTo(Alias_SpawnAttacker1.GetReference())
kmyQuest.SkyrimOvercastWar.ForceActive(1)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_19
Function Fragment_19()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
;THIS IS SIMILAR TO STAGE 50

;player left the area (see CWPlayerScript attached to Player alias)
;so close out this quest and advance it as if he got the jarl to surrender (it was an optional objective anyway)
if GetStageDone(9000) == false
	kmyquest.jarlHasSurrendered = 1
	kmyquest.CWSiegeObj.setObjectiveFailed(1210)
	kmyquest.CWSiegeObj.setStage(9000)
	setStage(9000)
endif
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_13
Function Fragment_13()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
; CWScript.Log("AttackCity", "Stage 31: making Jarl, Housecarl, body guards aggressive")
Alias_Jarl.GetActorReference().setAV("Aggression", 1)
Alias_HouseCarl.GetActorReference().setAV("Aggression", 1)
Alias_BodyGuard1.GetActorReference().setAV("Aggression", 1)
Alias_BodyGuard2.GetActorReference().setAV("Aggression", 1)
Alias_BodyGuard3.GetActorReference().setAV("Aggression", 1)

Alias_Justiciar.GetActorReference().setAV("Aggression", 1)

Alias_Jarl.GetActorReference().EvaluatePackage()
Alias_HouseCarl.GetActorReference().EvaluatePackage()
Alias_BodyGuard1.GetActorReference().EvaluatePackage()
Alias_BodyGuard2.GetActorReference().EvaluatePackage()
Alias_BodyGuard3.GetActorReference().EvaluatePackage()

Alias_Justiciar.GetActorReference().EvaluatePackage()

Alias_Jarl.GetActorReference().startCombat(Game.GetPlayer())
Alias_HouseCarl.GetActorReference().startCombat(Alias_FieldCO.GetActorReference())
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_17
Function Fragment_17()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
kmyquest.CWAttackCityJarlBleedingOutScene.Start()

kmyquest.CWSiegeObj.setObjectiveCompleted(1200)
kmyquest.CWSiegeObj.setObjectiveDisplayed(1210)

;make everyone non-hostile

;prevent player from attacking
Game.DisablePlayerControls(abMovement = false, abFighting = true, abCamSwitch = false,  abLooking = false, abSneaking = false, abMenu = false, abActivate = false, abJournalTabs = false)

Game.GetPlayer().addToFaction(kmyquest.CWs.CWSurrenderTemporaryAllies)

kmyquest.CWs.pacifyAliasForSurrender(Alias_Jarl)
kmyquest.CWs.pacifyAliasForSurrender(Alias_HouseCarl)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Steward)

kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard1)
kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard2)
kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard3)
kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard4)
kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard5)
kmyquest.CWs.pacifyAliasForSurrender(Alias_BodyGuard6)

kmyquest.CWs.pacifyAliasForSurrender(Alias_Justiciar)

kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier1)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier2)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier3)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier4)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier5)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier6)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier7)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier8)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier9)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier10)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier11)
kmyquest.CWs.pacifyAliasForSurrender(Alias_EnemySoldier12)

kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier1)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier2)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier3)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier4)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier5)
kmyquest.CWs.pacifyAliasForSurrender(Alias_Soldier6)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_1
Function Fragment_1()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
; CWScript.Log("AttackCity", "Stage 40: Jarl surrender scene will start up")

kmyquest.jarlWillSurrender = 1

;Removing Combat Music
kmyQuest.MUSCombatCivilWar.Remove()

;SURRENDER SCENE
; CWScript.Log("AttackCity", "Stage 40: moving New Jarl and FieldCO into position and starting scene")
Alias_NewJarl.GetReference().moveto(Alias_ResolutionNewJarlMarker.GetReference())
Actor Jarl = Alias_Jarl.GetActorReference()
Jarl.SetNoBleedoutRecovery(false) 
Jarl.restoreAv("Health", 1000)
Alias_HouseCarl.GetActorReference().restoreAv("Health", 1000)
Alias_FieldCO.GetActorReference().restoreAv("Health", 1000)
Alias_Friend.GetActorReference().restoreAv("Health", 1000)
kmyquest.CWAttackCitySurrenderScene.Start()

Game.EnablePlayerControls()

;START CLEANING UP THE CITY REFERENCES
Alias_EnemySoldier1.GetActorReference().disable()
Alias_EnemySoldier2.GetActorReference().disable()
Alias_EnemySoldier3.GetActorReference().disable()
Alias_EnemySoldier4.GetActorReference().disable()
Alias_EnemySoldier5.GetActorReference().disable()
Alias_EnemySoldier6.GetActorReference().disable()
Alias_EnemySoldier7.GetActorReference().disable()
Alias_EnemySoldier8.GetActorReference().disable()
Alias_EnemySoldier9.GetActorReference().disable()
Alias_EnemySoldier10.GetActorReference().disable()
Alias_EnemySoldier11.GetActorReference().disable()
Alias_EnemySoldier12.GetActorReference().disable()

Alias_Soldier1.GetActorReference().disable()
Alias_Soldier2.GetActorReference().disable()
Alias_Soldier3.GetActorReference().disable()
Alias_Soldier4.GetActorReference().disable()
Alias_Soldier5.GetActorReference().disable()
Alias_Soldier6.GetActorReference().disable()

;TURN ON NORMAL GUARDS

kmyquest.CWs.ClearHoldCrimeGold(Alias_Hold.GetLocation())

if kmyquest.CWs.PlayerAllegiance == kmyquest.CWs.iImperials
	Alias_ImperialEnable.GetReference().Enable()
else
	Alias_SonsEnable.GetReference().Enable()
endif

;setStage(50) - THIS NOW HAPPENS IN A SCENE
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_11
Function Fragment_11()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
; CWScript.Log("AttackCity", "Stage 30: Allowing confrontation scene to progress")
Alias_FieldCO.GetReference().Moveto(Game.GetPlayer())
Alias_Friend.GetReference().Moveto(Game.GetPlayer())
sound.StopInstance(kmyQuest.CWSiegeS.AMBDistantBattleSoundInstance)

;Alias_BodyGuard1.GetActorReference().startCombat(Game.GetPlayer())
;Alias_BodyGuard2.GetActorReference().startCombat(Game.GetPlayer())
;Alias_BodyGuard3.GetActorReference().startCombat(Game.GetPlayer())
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_3
Function Fragment_3()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
;THIS IS SIMILAR TO STAGE 200

kmyquest.jarlHasSurrendered = 1

kmyquest.CWSiegeObj.setObjectiveCompleted(1210)
kmyquest.CWSiegeObj.setStage(9000)

setStage(9000)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_16
Function Fragment_16()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
; CWScript.Log("AttackCity", "Stage 9999: Shut down stage, removing everyone from CWSurrenderTemporaryAllies")

Game.GetPlayer().RemoveFromFaction(kmyquest.CWs.CWSurrenderTemporaryAllies)

Alias_Jarl.GetActorReference().removeFromFaction(kmyquest.CWs.CWSurrenderTemporaryAllies)
Alias_HouseCarl.GetActorReference().removeFromFaction(kmyquest.CWs.CWSurrenderTemporaryAllies)
Alias_Steward.GetActorReference().removeFromFaction(kmyquest.CWs.CWSurrenderTemporaryAllies)


;turns off fires in the city
if Alias_ClutterEnableToggle.GetReference()
	Alias_ClutterEnableToggle.GetReference().Disable()
endif

Alias_Jarl.UnRegisterForUpdate()

Alias_BodyGuard1.TryToDisable()
Alias_BodyGuard2.TryToDisable()
Alias_BodyGuard3.TryToDisable()
Alias_BodyGuard4.TryToDisable()
Alias_BodyGuard5.TryToDisable()
Alias_BodyGuard6.TryToDisable()

Alias_BodyGuard1.GetActorReference().DeleteWhenAble()
Alias_BodyGuard2.GetActorReference().DeleteWhenAble()
Alias_BodyGuard3.GetActorReference().DeleteWhenAble()
Alias_BodyGuard4.GetActorReference().DeleteWhenAble()
Alias_BodyGuard5.GetActorReference().DeleteWhenAble()
Alias_BodyGuard6.GetActorReference().DeleteWhenAble()

Alias_EnemySoldier1.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier2.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier3.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier4.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier5.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier6.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier7.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier8.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier9.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier10.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier11.GetActorReference().DeleteWhenAble()
Alias_EnemySoldier12.GetActorReference().DeleteWhenAble()

Alias_Soldier1.GetActorReference().DeleteWhenAble()
Alias_Soldier2.GetActorReference().DeleteWhenAble()
Alias_Soldier3.GetActorReference().DeleteWhenAble()
Alias_Soldier4.GetActorReference().DeleteWhenAble()
Alias_Soldier5.GetActorReference().DeleteWhenAble()
Alias_Soldier6.GetActorReference().DeleteWhenAble()

; CWScript.Log("AttackCity", self + "Stage 9999: Shutdown stage, Giving Jarl his normal outfit")
;WE DONT YET HAVE FUNCTIONALITY TO GET OUTFIT
;if we get that function I should change this to store the outfit the jarl is currently wearing
;for now assume this is Balgruuf, because we only do sieges at whiterun now
Alias_Jarl.GetActorReference().setOutfit(kmyquest.JarlClothesBalgruuf)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_6
Function Fragment_6()
;BEGIN AUTOCAST TYPE CWAttackCityScript
Quest __temp = self as Quest
CWAttackCityScript kmyQuest = __temp as CWAttackCityScript
;END AUTOCAST
;BEGIN CODE
;Attackers Win

location currentHold = kmyquest.CWs.GetMyCurrentHoldLocation(Alias_Jarl.GetReference())
kmyquest.CWs.CompleteCWObj(currentHold)

registerForSingleUpdate(5)   ;enters a while loop until the player leaves, then stops this quest and CWSiege quest
;END CODE
EndFunction
;END FRAGMENT

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