Scriptname _00E_BoundWeaponSC extends ActiveMagicEffect  

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

EVENT OnEffectStart(Actor Target, Actor Caster)
	
	if linkedWeapon.IsBow()
		caster.additem(boundArrow,100,TRUE)
		caster.equipItem(boundArrow, TRUE, TRUE)
	endif
	
endEVENT

EVENT onLoad()
; 	debug.trace("Bound Bow caught Cell Attach")
	if !(getCasterActor().hasMagicEffect(BoundBowFFSelf))
; 		debug.trace("Bound Bow - Cell Attached, script active, but effect not found on "+getCasterActor()coc 
		dispel()
	endif
endEVENT

EVENT OnEffectFinish(Actor Target, Actor Caster)
; 	debug.trace("Bound Bow - Effect Finishing, remove any bound arrows")
	
	if linkedWeapon.IsBow()
		caster.removeitem(boundArrow,caster.getItemCount(boundArrow),TRUE)
	EndIf
	
endEVENT

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

Weapon Property linkedWeapon Auto
Ammo Property boundArrow  Auto  
MagicEffect Property BoundBowFFSelf  Auto