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

;BEGIN ALIAS PROPERTY GuardDImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardDImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy14
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy14 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ElisifDoor
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ElisifDoor Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardBSons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardBSons Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BluePalace
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_BluePalace Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy10
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy10 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ShrineApproachTrigger
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ShrineApproachTrigger Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy7
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy7 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ElisifIsEssential
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ElisifIsEssential Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ElisifWelcomeTrigger
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ElisifWelcomeTrigger Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Fighter1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Fighter1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist1
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist1 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PalaceFollowTriggerA
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PalaceFollowTriggerA Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Fighter1Spawn
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Fighter1Spawn Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardMarkerC
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardMarkerC Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist4SpawnMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist4SpawnMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardAImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardAImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BolgeirBearclaw
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BolgeirBearclaw Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Fighter2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Fighter2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY DeadFriend
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_DeadFriend Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy11
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy11 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BoethiahsConduit
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BoethiahsConduit Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy12
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy12 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardDSons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardDSons Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Pillar
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Pillar Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy4
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy4 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ShrineCenterMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ShrineCenterMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ElisifAfraidTrigger
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ElisifAfraidTrigger Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PillarLookUpMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PillarLookUpMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Fighter2Spawn
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Fighter2Spawn Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardMarkerB
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardMarkerB Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist3SpawnMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist3SpawnMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PalaceWarnTrigger
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PalaceWarnTrigger Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardASons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardASons Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy2
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy2 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PalaceAttackTrigger
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PalaceAttackTrigger Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Elisif
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Elisif Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist2SpawnMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist2SpawnMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Dungeon
;ALIAS PROPERTY TYPE LocationAlias
LocationAlias Property Alias_Dungeon Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardMarkerD
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardMarkerD Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy13
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy13 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy6
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy6 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist5SpawnMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist5SpawnMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardCSons
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardCSons Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist1SpawnMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist1SpawnMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist3
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist3 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Cultist5
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Cultist5 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Champion
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Champion Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardCImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardCImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy9
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy9 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY DungeonMapMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_DungeonMapMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY BoethiahsVoiceXMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_BoethiahsVoiceXMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardBImperial
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardBImperial Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY Enemy8
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_Enemy8 Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY GuardMarkerA
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_GuardMarkerA Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY FriendEscort
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_FriendEscort Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PalaceFollowTriggerB
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PalaceFollowTriggerB Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY PalaceFollowTriggerC
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_PalaceFollowTriggerC Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY ElisifMarker
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_ElisifMarker Auto
;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY DungeonToggle
;ALIAS PROPERTY TYPE ReferenceAlias
ReferenceAlias Property Alias_DungeonToggle Auto
;END ALIAS PROPERTY

;BEGIN FRAGMENT Fragment_38
Function Fragment_38()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;Boethiah's cultists should fight each other
; debug.trace("DA02 Stage 15")

setObjectiveCompleted(5)
setObjectiveCompleted(10)
setObjectiveDisplayed(15)

kmyquest.releaseConduit()

kmyquest.DA02FightScene2.Stop()
kmyquest.DA02BoethiahScene1.Stop()

Alias_Cultist1.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Cultist2.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Cultist3.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Cultist4.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Cultist5.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Fighter1.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)
Alias_Fighter2.GetActorRef().AddToFaction(kmyquest.DA02CultistsAreEnemies)

Alias_Cultist1.GetActorRef().SetAV("Aggression", 3)
Alias_Cultist2.GetActorRef().SetAV("Aggression", 3)
Alias_Cultist3.GetActorRef().SetAV("Aggression", 3)
Alias_Cultist4.GetActorRef().SetAV("Aggression", 3)
Alias_Cultist5.GetActorRef().SetAV("Aggression", 3)
Alias_Fighter1.GetActorRef().SetAV("Aggression", 3)
Alias_Fighter2.GetActorRef().SetAV("Aggression", 3)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_12
Function Fragment_12()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 20")
Alias_DungeonMapMarker.GetReference().addToMap()
setObjectiveCompleted(15)
setObjectiveDisplayed(20)

kmyquest.releaseConduit()

kmyquest.PillarStop()

if IsObjectiveDisplayed(100) && IsObjectiveCompleted(100) == false
   setObjectiveCompleted(100)
endif

if IsObjectiveDisplayed(101) && IsObjectiveCompleted(101) == false
   setObjectiveCompleted(101)
endif

Alias_Champion.GetReference().Enable()
; debug.trace("DA02 RESET Knivepoint Ridge")

Alias_Enemy1.TryToReset()
Alias_Enemy2.TryToReset()
Alias_Enemy3.TryToReset()
Alias_Enemy4.TryToReset()
Alias_Enemy5.TryToReset()
Alias_Enemy6.TryToReset()
Alias_Enemy7.TryToReset()
Alias_Enemy8.TryToReset()
Alias_Enemy9.TryToReset()
Alias_Enemy10.TryToReset()
Alias_Enemy11.TryToReset()
Alias_Enemy12.TryToReset()
Alias_Enemy13.TryToReset()
Alias_Enemy14.TryToReset()

Alias_DungeonToggle.GetReference().disable()

;THIS SHOULD NO LONGER BE POSSIBLE
;if the player already has killed the champion call that stage
if Alias_Champion.GetActorReference().isDead()
	setstage(30)
endif
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_27
Function Fragment_27()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 100")

kmyquest.resurrectCounduit(Alias_Elisif)
kmyquest.DA02BoethiahElisifScene.Start()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_32
Function Fragment_32()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 10")
setObjectiveCompleted(5)
setObjectiveDisplayed(10)

ObjectReference PlayerRef = Game.GetPlayer()

PlayerRef .AddItem(kmyquest.DA02Dagger)

if PlayerRef.GetItemCount(kmyquest.DA02Book) < 1
	PlayerRef.AddItem(kmyquest.DA02Book)
endif
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_54
Function Fragment_54()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;Elisif opens the door
(Alias_ElisifDoor as DA02ElisifDoorScript).UnlockDoor()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_50
Function Fragment_50()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;Player has done something to cause the guards to cause an alarm
;See DA02Script TestGuardDetection() which starts DA02SoundAlarmScene which sets this stage

; debug.trace("DA02 stage 70, SOUND ALARM!")
kmyquest.soundAlarm(Game.GetPlayer())
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_35
Function Fragment_35()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 5")
setObjectiveCompleted(1)
setObjectiveDisplayed(5)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_36
Function Fragment_36()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 4")

;START FIGHT SCENE 2
kmyquest.DA02FightScene2.Start()

;we make the combatants ghosts so the fight lasts a while (might change this to temporarily boosting hitpoints, or something)
Alias_Fighter1.GetActorRef().SetGhost()
Alias_Fighter2.GetActorRef().SetGhost()
;SEE STAGE 6 for unghosting
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_11
Function Fragment_11()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;All of the Cultists are dead
; debug.trace("DA02 Stage 17")

;Boethiah possesses the last dead cultist and forcegreets the player (see DA02Script.checkDeadAndSetStage() and BoethiahsConduit alias)

;make sure the scene where she tells you to kill the cultists isn't already running first
;fixes #68052
if kmyquest.DA02BoethiahScene2.IsPlaying()
	kmyquest.DA02BoethiahScene2.stop()

	int WaitingFor = 0

	while kmyquest.DA02BoethiahScene2.IsPlaying()
; 		debug.trace("DA02 Stage 17 WAITING for DA02BoethiahScene2.IsPlaying() == False. Waiting for:" + WaitingFor)
		utility.wait(1)
		waitingFor += 1

	endWhile

endif



;resurrect
kmyquest.resurrectCounduit()  ;Alias_BoethiahsConduit forced to last dead cultist via checkDeadAndSetStage() called by DA02FighterScript or DA02ShrineDeathScript

Alias_BoethiahsConduit.GetActorReference().EvaluatePackage()

if getStageDone(15) ;Boethiah told the player to kill the other cultists
	SetObjectiveCompleted(15)
endif

setObjectiveDisplayed(101)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_40
Function Fragment_40()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 11")

setObjectiveCompleted(10)

;PLAYER KILLED FRIEND

;just incase another scene is still playing, stop them
kmyquest.DA02FightScene2.Stop()
Alias_Fighter1.GetActorReference().StopCombat()
Alias_Fighter2.GetActorReference().StopCombat()
Alias_Fighter1.GetActorRef().SetGhost(false)
Alias_Fighter2.GetActorRef().SetGhost(false)

;resurrect
kmyquest.resurrectCounduit() 

;start scene
kmyquest.DA02BoethiahScene1.Start()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_52
Function Fragment_52()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;friend has escorted player to elisif's door, and will start a scene to get her to open the door
kmyquest.DA02FriendEscortScene.start()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_55
Function Fragment_55()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;Elisif is afraid of player (enemy) so she runs detection and flees from him
;set by DA02ElisifAfraidTriggerScript

Alias_Elisif.GetActorReference().AddToFaction(kmyquest.DA02ElisifAfraidOfPlayer)
Alias_Elisif.GetActorReference().SetAv("Aggression", 2)
Alias_Elisif.GetActorReference().SetAv("Confidence", 0)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_29
Function Fragment_29()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 200, setStage 200 on DA02KillObj, and stop this quest")

kmyquest.DA02KillObj.setStage(200)

kmyquest.releaseConduit()
kmyquest.DA02Post.Start()   ;makes the new Jarl like you and has some dialogue
stop()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_57
Function Fragment_57()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;player slayed the cultists first before slaying the friend and boethiah talked to him directly
setStage(10)  ;in case player didn't get objective from talking to priestess
setObjectiveCompleted(101)
kmyquest.releaseConduit()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_43
Function Fragment_43()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 30")
;player killed Champion and everyone at the dungeon - see MonitorAliveCountScript

if GetStageDone(20)

	setObjectiveCompleted(20)
	setObjectiveDisplayed(30) ;player should put on the armor

else
; 	debug.trace("DA02 Stage 30 - hasn't gotten the objective to kill Oengul yet, so we aren't displaying the objective to put on the Ebony Mail.", 1)

endif

;if the player already is wearing the armor, call that stage
if Game.GetPlayer().IsEquipped(kmyquest.DA02Cuirass)
	setstage(40)
endif
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_37
Function Fragment_37()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 6")
;Called in dialogue with the Priestess
;ALSO called in MakeCultistsAggressive() in DA02Script
;unghost the fighters (see stage 4)
Alias_Fighter1.GetActorRef().SetGhost(false)
Alias_Fighter2.GetActorRef().SetGhost(false)
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_2
Function Fragment_2()
;BEGIN CODE
; debug.trace("DA02 Stage 7")

;SECOND FIGHT SCENE AT SHRINE IS DONE, Scene should end
;see DA02FighterScript
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_42
Function Fragment_42()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
;Boethiah will tell her followers to fight to the death
; debug.trace("DA02 Stage12")

kmyquest.FXShrineofBoethiaOrbRef.playAnimation("playanim01") ;turns off the bubble effect

kmyquest.DA02FightScene2.Stop()
kmyquest.DA02BoethiahScene1.Stop()

kmyquest.DA02BoethiahScene2.Start()
kmyquest.PillarTrappedVictim = 2
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_46
Function Fragment_46()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 40")
setObjectiveCompleted(30)
AchievementsQuest.IncDaedricArtifacts()
;player is wearing the armor, and the champion is slain. Boethiah will tell him what to do next.
Alias_BoethiahsVoiceXMarker.GetReference().MoveTo(Game.GetPlayer())
Alias_BoethiahsConduit.ForceRefTo(Alias_BoethiahsVoiceXMarker.GetReference())
kmyquest.DA02BoethiahArmorWornScene.Start()
(Alias_BoethiahsConduit as DA02BoethiahsConduitScript).startIMODs()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_47
Function Fragment_47()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 50, Complete Quest, setStage 50 on DA02KillObj quest")
AchievementsQuest.IncDaedricQuests()
(Alias_BoethiahsConduit as DA02BoethiahsConduitScript).stopIMODs(CompletelyStop = true)
;Alias_Elisif.GetActorReference().GetActorBase().SetEssential(false)
;Alias_ElisifIsEssential.Clear()
;Alias_Elisif.TryToMoveTo(Alias_ElisifMarker.GetReference())
;(Alias_ElisifDoor as DA02ElisifDoorScript).LockDoor()
;
;kmyquest.DA02KillObj.setStage(50)

stop()
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_48
Function Fragment_48()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
kmyquest.warnedChampion = 1
;END CODE
EndFunction
;END FRAGMENT

;BEGIN FRAGMENT Fragment_30
Function Fragment_30()
;BEGIN AUTOCAST TYPE DA02Script
Quest __temp = self as Quest
DA02Script kmyQuest = __temp as DA02Script
;END AUTOCAST
;BEGIN CODE
; debug.trace("DA02 Stage 1")
setObjectiveDisplayed(1)
kmyquest.DA02BoethiahShrineMapMarker.AddToMap()
;END CODE
EndFunction
;END FRAGMENT

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

AchievementsScript Property AchievementsQuest  Auto  
