JASS:
function F22Strike takes nothing returns nothing
local integer i = 1
local group missiles
local unit u
local real x = GetUnitX(udg_Boss)
local real y = GetUnitY(udg_Boss)
local real dx = GetUnitX(udg_F22Raptor[1]) - x
local real dy = GetUnitY(udg_F22Raptor[1]) - y
local real dx2 = GetUnitX(udg_F22Raptor[2]) - x
local real dy2 = GetUnitY(udg_F22Raptor[2]) - y
local real angle = bj_RADTODEG * Atan2(y - GetUnitY(udg_F22Raptor[1]), x - GetUnitX(udg_F22Raptor[1]))
local real x2 = x + 800.0*Cos(angle*bj_DEGTORAD)
local real y2 = y + 800.0*Sin(angle*bj_DEGTORAD)
call IssuePointOrder(udg_F22Raptor[1],"move",x2,y2)
call IssuePointOrder(udg_F22Raptor[2],"move",x2+60.0,y2+60.0)
call IssuePointOrder(udg_F22Raptor[3],"move",x2-60.0,y2-60.0)
if GetWidgetLife(udg_Boss)<2500.0 then
call DestroyTrigger(GetTriggeringTrigger())
call GeneralText(8.0, "|cfff3ad00F-22 Pilot|r : Target neutralized. Aborting mission." )
call SetUnitFlyHeight(udg_F22Raptor[1], 1200.0, 200.0)
call SetUnitFlyHeight(udg_F22Raptor[2], 1200.0, 200.0)
call SetUnitFlyHeight(udg_F22Raptor[3], 1200.0, 200.0)
call PolledWait(2.)
call RemoveUnit(udg_F22Raptor[1])
call RemoveUnit(udg_F22Raptor[2])
call RemoveUnit(udg_F22Raptor[3])
elseif (dx*dx+dy*dy<=4000000.0) or (dx2*dx2+dy2*dy2<=4000000.0) then //2000 radius
call DestroyTrigger(GetTriggeringTrigger())
set udg_AirstrikeTarget = GetUnitLoc(udg_Boss)
call GeneralText(8.0, "|cfff3ad00F-22 Pilot|r : Missiles fired. He039;s all yours." )
set missiles = CreateGroup()
loop
exitwhen i>3
set u = CreateUnit( Player(9), 039;h00C039;, GetUnitX(udg_F22Raptor<i>)+8.0, GetUnitY(udg_F22Raptor<i>)+8.0 ,0 )
call IssuePointOrder(u,"attackground",x,y)
call GroupAddUnit(missiles,u)
set u = CreateUnit( Player(9), 039;h00C039;, GetUnitX(udg_F22Raptor<i>)-8.0, GetUnitY(udg_F22Raptor<i>)-8.0 ,0 )
call IssuePointOrder(u,"attackground",x,y)
call GroupAddUnit(missiles,u)
if GetRandomInt(0,1)==1 then
call TriggerSleepAction(0.)
endif
set i=i+1
endloop
set u = null
call SetUnitFlyHeight(udg_F22Raptor[1],1000.0,200.0)
call SetUnitFlyHeight(udg_F22Raptor[2],800.0,200.0)
call SetUnitFlyHeight(udg_F22Raptor[3],1200.0,200.0)
call SetUnitMoveSpeed(udg_Boss,GetUnitDefaultMoveSpeed(udg_Boss))
call PolledWait(1.)
call RemoveLocation(udg_AirstrikeTarget)
call ForGroup(missiles,function RemoveUnitAll)
call DestroyGroup(missiles)
set missiles = null
call PolledWait(0.5)
call RemoveUnit(udg_F22Raptor[1])
call RemoveUnit(udg_F22Raptor[2])
call RemoveUnit(udg_F22Raptor[3])
endif
endfunction
function F22MissionConditions takes nothing returns boolean
local unit u = GetTriggerUnit()
local real hp = GetWidgetLife(u)
return (GetUnitTypeId(u)==039;N006039;)
endfunction
function F22Mission takes nothing returns nothing
local integer i = 1
local trigger t = CreateTrigger()
call DestroyTrigger(GetTriggeringTrigger())
call PolledWait(2.)
call GeneralText(5.0, "|cfff3ad00Battalion|r : Birds are inbound. Hang on, Marines." )
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 3
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, 039;h00B039;, Player(0), GetRandomLocInRect(gg_rct_Region_000), bj_UNIT_FACING )
set udg_F22Raptor[GetForLoopIndexA()] = GetLastCreatedUnit()
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call PolledWait(2.)
call TriggerAddAction(t, function F22Strike)
call TriggerRegisterTimerEvent(t,0.2,true)
set t = null
call PolledWait(4.)
call SetUnitMoveSpeed(udg_Boss,GetUnitDefaultMoveSpeed(udg_Boss)*0.6)
endfunction
//===========================================================================
function InitTrig_F22_Formation takes nothing returns nothing
set gg_trg_F22_Formation = CreateTrigger()
call TriggerAddCondition( gg_trg_F22_Formation, Condition( function F22MissionConditions ) )
call TriggerAddAction( gg_trg_F22_Formation, function F22Mission )
endfunction</i></i></i></i>
I get the error for this line.
JASS:
call ForGroup(missiles,function RemoveUnitAll)
So the missles keep shooting and they dont get removed.
P.S I've got the udg_boss already set to a unit and ive already taken care of the event