Scriptname TEG_DemonsEye06script extends Quest  

SPELL Property houndspell  Auto  
Actor Property warmage01  Auto  
Actor Property de06jon  Auto  
Actor Property Eye01  Auto  
Actor Property Dremora01 Auto  
Actor Property Dremora02  Auto  
Actor Property Dremora03  Auto 
Actor Property Dremora04  Auto  
Actor Property missile02  Auto  
Actor Property melee03  Auto 
Actor Property magic04  Auto  
Actor Property dregas01  Auto 
Quest Property TEGTelDremorFollower  Auto  
int doonce01
int doonce02
int doonce03
int doonce04
int doonce05

Function DE06followermissile01()
missile02.enable()
dregas01.disable()
TEGTelDremorFollower.Start()
endfunction

Function DE06followermelee01()
melee03.enable()
dregas01.disable()
TEGTelDremorFollower.Start()
endfunction

Function DE06followermagic01()
magic04.enable()
dregas01.disable()
TEGTelDremorFollower.Start()
endfunction

Function DE06Warmage01()
Eye01.enable()
Dremora01.enable()
Dremora02.enable()
Dremora03.enable()
Dremora04.enable()
SetCurrentStageID(10)  
RegisterForUpdate(5)
Game.GetPlayer().AddSpell(houndspell)
SetObjectiveDisplayed(10)
SetObjectiveDisplayed(11)
SetObjectiveDisplayed(12)
SetObjectiveDisplayed(13)
SetObjectiveDisplayed(14)
endfunction

Function DE06Jon01()
SetObjectiveCompleted(20)
SetObjectiveDisplayed(30) 
SetCurrentStageID(30)  
endfunction

Function DE06Jon02()
SetCurrentStageID(40)  
endfunction

Function cleanup()
SetObjectiveCompleted(30)
warmage01.disable()
Eye01.disable()
Dremora01.disable()
Dremora02.disable()
Dremora03.disable()
Dremora04.disable()
UnregisterForUpdate()
CompleteQuest()
endfunction

Event OnUpdate()
if (Eye01.IsDead() == 1) && (doonce01 != 1)
SetCurrentStageID(20) 
SetObjectiveCompleted(10)
SetObjectiveDisplayed(20) 
doonce01 = 1
endif

if (Dremora01.IsDead() == 1) && (doonce02 != 1)
SetObjectiveCompleted(11)
doonce02 = 1
endif

if (Dremora02.IsDead() == 1) && (doonce03 != 1)
SetObjectiveCompleted(12)
doonce03 = 1
endif

if (Dremora03.IsDead() == 1) && (doonce04 != 1)
SetObjectiveCompleted(13)
doonce04 = 1
endif

if (Dremora04.IsDead() == 1) && (doonce05 != 1)
SetObjectiveCompleted(14)
doonce05 = 1
endif
EndEvent
