Scriptname BoundJavelinThrowEffectScript extends ActiveMagicEffect  
; Modder's Note - Thank you, JB


Ammo Property boundJavelin  Auto  
MagicEffect Property _B02BoundJavelinThrowFFSelf  Auto  

EVENT OnEffectStart(Actor Target, Actor Caster)
; 	debug.trace("Bound Javelin - Effect Starting - add and equip bound javelins")
	caster.additem(boundJavelin,20,TRUE)
	caster.equipItem(boundJavelin, TRUE, TRUE)
endEVENT

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

EVENT OnEffectFinish(Actor Target, Actor Caster)
; 	debug.trace("Bound Javelin - Effect Finishing, remove any bound javelins")
	caster.removeitem(boundJavelin,caster.getItemCount(boundJavelin),TRUE)
endEVENT