JASS:
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
local integer l2=0
local real NormalEndLoop=MaxDist/Speed
local location array Loc
local location array NextLoc
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)
if Number>=2 then
set Bullets[2]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[2],Angle)
endif
if Number>=3 then
set Bullets[3]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[3],Angle)
endif
if Number>=4 then
set Bullets[4]=CreateUnitAtLoc(Player(12),BulletType,BulletShotPos[4],Angle)
endif
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = R2I(MaxDist/Speed)
loop
call PanCameraToLocForPlayer(Player(l),GetUnitLoc(Bullets[1]))
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
//Actions
loop
exitwhen l==5
set Loc[l]=GetUnitLoc(Bullets[l])
set NextLoc[l]=PolarProjectionBJ(Loc[l],Speed,Angle)
set l=l+1
endloop
if Bullets[1]==null then
call DoNothing()
else
call SetUnitPositionLoc(Bullets[1],NextLoc[1])
endif
if Bullets[2]==null then
call DoNothing()
else
call SetUnitPositionLoc(Bullets[2],NextLoc[2])
endif
if Bullets[3]==null then
call DoNothing()
else
call SetUnitPositionLoc(Bullets[3],NextLoc[3])
endif
if Bullets[4]==null then
call DoNothing()
else
call SetUnitPositionLoc(Bullets[4],NextLoc[4])
endif
//EndActions
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
set l=0
loop
exitwhen l==5
call RemoveLocation(BulletShotPos[l])
call RemoveLocation(Loc[l])
call RemoveLocation(NextLoc[l])
set Bullets[l]=null
set l=l+1
endloop
call RemoveLocation(BulleterPos)
set Bulleter=null
endfunction
I activated the function with this triggger:
JASS:
function Trig_Unbezeichneter_Ausl__ser_001_Action takes nothing returns nothing
call Bullet('BU01',gg_unit_XWIN_0007,5,GetUnitFacing(gg_unit_XWIN_0007),1000,50,1,0,0,0,0,0,0,0,0)
endfunction
//===========================================================================
function InitTrig_gf takes nothing returns nothing
set gg_trg_gf = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_gf, Player(0), "-go", true )
call TriggerAddAction( gg_trg_gf, function Trig_Unbezeichneter_Ausl__ser_001_Action )
endfunction
But there have only been a Gryphon Rider(BU01) spawned...Why?