function Bullet takes integer BulletType,unit Bulleter,real Speed,real Angle,real MaxDist,real Radius,integer Number,real x1,real y1,real x2,real y2,real x3,real y3,real x4,real y4 returns nothing
local location BulleterPos=GetUnitLoc(Bulleter)
local unit array Bullets
local location array BulletShotPos
local integer l=0
set BulletShotPos[1]=OffsetLocation(BulleterPos,x1,y1)
set BulletShotPos[2]=OffsetLocation(BulleterPos,x2,y2)
set BulletShotPos[3]=OffsetLocation(BulleterPos,x3,y3)
set BulletShotPos[4]=OffsetLocation(BulleterPos,x4,y4)
set Bullets[1]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[1],Angle)
call GroupAddUnit(udg_MovingBullets,Bullets[1])
call StoreReal(udg_Cache,"Speed",I2S(H2I(Bullets[1])),Speed)
call StoreReal(udg_Cache,"MaxDist",I2S(H2I(Bullets[1])),MaxDist)
call StoreReal(udg_Cache,"Radius",I2S(H2I(Bullets[1])),Radius)
call StoreReal(udg_Cache,"DistLeft",I2S(H2I(Bullets[1])),0)
if Number>=2 then
set Bullets[2]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[2],Angle)
call GroupAddUnit(udg_MovingBullets,Bullets[2])
call StoreReal(udg_Cache,"Speed",I2S(H2I(Bullets[2])),Speed)
call StoreReal(udg_Cache,"MaxDist",I2S(H2I(Bullets[2])),MaxDist)
call StoreReal(udg_Cache,"Radius",I2S(H2I(Bullets[2])),Radius)
call StoreReal(udg_Cache,"DistLeft",I2S(H2I(Bullets[2])),0)
endif
if Number>=3 then
set Bullets[3]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[3],Angle)
call GroupAddUnit(udg_MovingBullets,Bullets[3])
call StoreReal(udg_Cache,"Speed",I2S(H2I(Bullets[3])),Speed)
call StoreReal(udg_Cache,"MaxDist",I2S(H2I(Bullets[3])),MaxDist)
call StoreReal(udg_Cache,"Radius",I2S(H2I(Bullets[3])),Radius)
call StoreReal(udg_Cache,"DistLeft",I2S(H2I(Bullets[3])),0)
endif
if Number>=4 then
set Bullets[4]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[4],Angle)
call GroupAddUnit(udg_MovingBullets,Bullets[4])
call StoreReal(udg_Cache,"Speed",I2S(H2I(Bullets[4])),Speed)
call StoreReal(udg_Cache,"MaxDist",I2S(H2I(Bullets[4])),MaxDist)
call StoreReal(udg_Cache,"Radius",I2S(H2I(Bullets[4])),Radius)
call StoreReal(udg_Cache,"DistLeft",I2S(H2I(Bullets[4])),0)
endif
loop
exitwhen l==5
call RemoveLocation(BulletShotPos[l])
set Bullets[l]=null
set l=l+1
endloop
call RemoveLocation(BulleterPos)
set Bulleter=null
endfunction