Scriptname _00E_FS_NQ07_LightScript extends activemagiceffect  

;=====================================================================================
;              							EVENTS                  					 
;=====================================================================================

Event OnEffectStart(Actor akTarget, Actor akCaster)

	EnableAllRefsInFormlist()

EndEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)

	DisableAllRefsInFormlist()

EndEvent

;=====================================================================================
;              							FUNCTIONS                  					 
;=====================================================================================

Function EnableAllRefsInFormlist()

	int iIndex = _00E_FS_NQ07_LightList.GetSize()
 
	while iIndex > 0
 
	iIndex -= 1
	ObjectReference ref = _00E_FS_NQ07_LightList.GetAt(iIndex) as ObjectReference
	ref.EnableNoWait()
	_00E_TeleportOutVFX.Play(ref)
	ref.GetLinkedRef().EnableNoWait()
	MAGIllusionNightEyeOn.Play(ref)
  
	endwhile

EndFunction

Function DisableAllRefsInFormlist()

	int iIndex = _00E_FS_NQ07_LightList.GetSize()
 
	while iIndex > 0
 
	iIndex -= 1
	ObjectReference ref = _00E_FS_NQ07_LightList.GetAt(iIndex) as ObjectReference
	ref.DisableNoWait()
	ref.GetLinkedRef().DisableNoWait()
  	MAGIllusionNightEyeOff.Play(ref)
  
	endwhile

EndFunction

;=====================================================================================
;              							PROPERTIES                  					 
;=====================================================================================

VisualEffect Property _00E_TeleportOutVFX Auto

Sound Property MAGIllusionNightEyeOn Auto
Sound Property MAGIllusionNightEyeOff Auto

FormList Property _00E_FS_NQ07_LightList Auto