Scriptname aaaTKCmultishot extends activemagiceffect  

Activator Property FXEmptyActivator Auto
spell Property Multishot Auto

Event OnEffectStart(Actor akTarget, Actor akCaster)

int NumTotal = 9
int CountCast =0
float Distance = 500
float Degrees = 10

ObjectReference StartBox
ObjectReference EndBox


StartBox	= akCaster.placeAtMe(FXEmptyActivator)
EndBox		= akCaster.placeAtMe(FXEmptyActivator)

float StartAngle= akCaster.GetAngleZ()
float StartLocX = 150 * math.sin(StartAngle)
float StartLocY = 150 * math.cos(StartAngle)

StartBox.MoveTo(akCaster, StartLocX, StartLocY, 85)

float CasterDegrees = -(akCaster.GetAngleX())

While CountCast < NumTotal 

	float CasterAngleZ = akCaster.GetAngleZ() + Degrees
	float LocX = Distance * math.sin(CasterAngleZ)
	float LocY = Distance * math.cos(CasterAngleZ)
	float LocZ = (Distance * math.tan(CasterDegrees)) + 100
	
	EndBox.MoveTo(akCaster, LocX, LocY,LocZ)
	Multishot.RemoteCast(StartBox, akCaster,EndBox)
	Degrees	-= 2.5
	CountCast	+= 1
	Utility.Wait(0.05)

EndWhile

StartBox.Delete()
EndBox.Delete()

endEvent