Scriptname KA_dlcRitualFXscript extends ObjectReference  
{plays effects for dlc resurrection}

float property newPriestCount auto
float property reanimTime auto

objectReference Property SummonMarker auto

KA_revRitualMaster property master auto
KA_RevRitualSCRIPT property bust01 auto
KA_RevRitualSCRIPT property bust02 auto
KA_RevRitualSCRIPT property bust03 auto
KA_RevRitualSCRIPT property soulgem01 auto
KA_RevRitualSCRIPT property soulgem02 auto
KA_RevRitualSCRIPT property soulgem03 auto

objectReference property gemACT01 auto
objectReference property gemACT02 auto
objectReference property gemACT03 auto
objectReference property maskACT01 auto
objectReference property maskACT02 auto
objectReference property maskACT03 auto

objectReference property PriestRef01 auto
objectReference property PriestRef02 auto
objectReference property PriestRef03 auto
objectReference property Trigger01 auto
objectReference property Trigger02 auto
objectReference property Trigger03 auto

objectReference property gate auto
objectReference property bubbles auto
objectReference property bubblesSFX auto

actorbase property priest01 auto
actorbase property priest02 auto
actorbase property priest03 auto

sound property mySFX auto
sound property mySFX2 auto
sound property mySFXBegin auto

spell property gooFX auto

Auto STATE waiting
EVENT onActivate (objectReference triggerRef)
if  ((master.mask01placed && master.gem01placed) || (master.mask02placed && master.gem02placed) || (master.mask03placed && master.gem03placed)) 
gotoState ("busy")
self.PlayAnimation("on")
gate.activate(self)
utility.wait(1.0)
bubblesSFX.enable()
bubbles.TranslateTo(-24.0, -8.0, 24.0, 0.0, 0.0, 291.0, 50.0)
;============
; 	eerie sound 
;============	
	int soundInstance1 = mySFXBegin.play(Self) 
	Sound.SetInstanceVolume(soundInstance1, 1)
;============
; 	Soul Trap Sound
;============	
	int soundInstance2 = mySFX.play(Self)
	Sound.SetInstanceVolume(soundInstance2, 1)
;============
; 	Wind Sound
;============	
	int soundInstance3 = mySFX2.play(SummonMarker)
	Sound.SetInstanceVolume(soundInstance3, 1)	
	utility.wait(reanimTime)
	summonPriest()
	bubblesSFX.disable()
	utility.wait(reanimTime)
	bubbles.TranslateTo(-24.0, -8.0, -240.0, 0.0, 0.0, 291.0, 50.0)
endif
endEVENT
endSTATE

STATE busy
	EVENT onActivate (objectReference triggerRef)
			;do nothing
	endEVENT
endSTATE

;=================/
;	Unblock All					/
;=================/
FUNCTION unblockAll()
	self.PlayAnimation("off")
	gate.activate(self)
	gotoState ("waiting")
endFUNCTION

;=================/
;	Summon				/
;=================/
FUNCTION summonPriest()
if (master.mask01placed && master.gem01placed)
	bust01.clearAltar()
	soulgem01.clearAltar()
	Trigger01.enable()
	PriestRef01.moveto(summonMarker)
	gooFX.cast(PriestRef01, PriestRef01)
	updateDPCount()
	Trigger01.disable()
endif
if (master.mask02placed && master.gem02placed)
	bust02.clearAltar()
	soulgem02.clearAltar()
	Trigger02.enable()
	PriestRef02.moveto(summonMarker)
	gooFX.cast(PriestRef02, PriestRef02)
	updateDPCount()
	Trigger02.disable()
endif
if (master.mask03placed && master.gem03placed)
	bust03.clearAltar()
	soulgem03.clearAltar()
	Trigger03.enable()
	PriestRef03.moveto(summonMarker)
	gooFX.cast(PriestRef03, PriestRef03)
	updateDPCount()
	Trigger03.disable()
endif
endFUNCTION

;=================/
;	update DP count		/
;=================/
FUNCTION updateDPCount()
newPriestCount = (master.priestCount + 1)
master.priestCount = newPriestCount
endFUNCTION