Scriptname _00E_PosessionFXScript extends activeMagicEffect


import utility
import form

;===============================================

Actor selfRef
ActorBase myActorBase
int PosessedSex
VisualEffect Property _00E_FXPosessedMaleEyeEffect Auto
VisualEffect Property _00E_FXPosessedFemaleEyeEffect Auto
TextureSet Property _00E_MaleEyesPosessed Auto
Sound Property _00E_VisionGlimpseWhisperM Auto

	EVENT OnEffectStart(Actor Target, Actor Caster)	
		
		
		selfRef = caster
		myActorBase = caster.GetLeveledActorBase()
		;If sex is male (only one currently working) play glow eye art
		
		_00E_VisionGlimpseWhisperM.Play(SelfRef)
		SelfRef.SetEyeTexture(_00E_MaleEyesPosessed)
		
		if myActorBase.GetSex() == 0
			_00E_FXPosessedMaleEyeEffect.Play(selfRef, -1)
		endif
		
		endif
		;if sex is female (currently not returned) play debug text to say this is now working
		if myActorBase.GetSex() == 1
			if (selfRef.GetSleepState() == 3)
; 				Debug.Trace("Draugr fem is sleeping! 3")
			else
				_00E_FXPosessedFemaleEyeEffect.Play(selfRef, -1)
			endIf
		endif
	ENDEVENT
	
	Event OnGetUp(ObjectReference akFurniture)
; 		Debug.Trace("Draugr just got up from " )
		if myActorBase.GetSex() == 0
			;Play glow art
			_00E_FXPosessedMaleEyeEffect.Play(selfRef, -1)
		endif
		;if sex is female (currently not returned) play debug text to say this is now working
		if myActorBase.GetSex() == 1
			_00E_FXPosessedFemaleEyeEffect.Play(selfRef, -1)
		endif
	EndEvent
	
	EVENT onDeath(actor myKiller)

		_00E_FXPosessedMaleEyeEffect.Stop(selfRef)
		_00E_FXPosessedFemaleEyeEffect.Stop(selfRef)

	ENDEVENT