Everything works intil the where the loop is suppose to begin
JASS:
function Trig_C4_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A005'
endfunction
function Trig_C4_Func014002003001 takes nothing returns boolean
return ( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true )
endfunction
function Trig_C4_Func014002003002001 takes nothing returns boolean
return ( IsUnitDeadBJ(GetFilterUnit()) == false )
endfunction
function Trig_C4_Func014002003002002001 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false )
endfunction
function Trig_C4_Func014002003002002002 takes nothing returns boolean
return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_FLYING) == false )
endfunction
function Trig_C4_Func014002003002002 takes nothing returns boolean
return GetBooleanAnd( Trig_C4_Func014002003002002001(), Trig_C4_Func014002003002002002() )
endfunction
function Trig_C4_Func014002003002 takes nothing returns boolean
return GetBooleanAnd( Trig_C4_Func014002003002001(), Trig_C4_Func014002003002002() )
endfunction
function Trig_C4_Func014002003 takes nothing returns boolean
return GetBooleanAnd( Trig_C4_Func014002003001(), Trig_C4_Func014002003002() )
endfunction
function Trig_C4_Func015002 takes nothing returns nothing
call UnitDamageTargetBJ(e, GetEnumUnit(), 15.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction
function Trig_C4_Func016002 takes nothing returns nothing
call PlaySoundBJ( gg_snd_BoatMissileHit )
endfunction
globals
unit e
endglobals
function Trig_C4_Actions takes nothing returns nothing
local location a
local location b
local unit c
local group d
local integer f = 0
set a = GetUnitLoc(GetTriggerUnit())
call CreateNUnitsAtLoc( 1, 'h007', GetOwningPlayer(GetTriggerUnit()), a, 266.83 )
set c = GetLastCreatedUnit()
set b = GetUnitLoc(GetTriggerUnit())
call SetUnitTimeScalePercent( c, 80.00 )
call SetUnitAnimation( c, "spell four" )
call TriggerSleepAction( 2.00 )
call RemoveUnit( c )
call SetUnitInvulnerable( GetTriggerUnit(), false )
call CreateNUnitsAtLoc( 1, 'h006', GetOwningPlayer(GetTriggerUnit()), b, 266.83 )
set e = GetLastCreatedUnit()
call SetUnitInvulnerable( e, true )
call SetUnitVertexColorBJ( e, 100, 100, 100, 80.00 )
loop
exitwhen f == 20
set d = GetUnitsInRangeOfLocMatching(800.00, b, Condition(function Trig_C4_Func014002003))
call ForGroupBJ( d, function Trig_C4_Func015002 )
call ForGroupBJ( d, function Trig_C4_Func016002 )
call DestroyGroup (d)
set f =(f +1)
call TriggerSleepAction(3.00)
endloop
call RemoveLocation (a)
call RemoveLocation (b)
set d = null
set a = null
set b = null
set c = null
set e = null
endfunction
//===========================================================================
function InitTrig_C4_Copy_4 takes nothing returns nothing
local trigger C4 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( C4, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( C4, Condition( function Trig_C4_Conditions ) )
call TriggerAddAction( C4, function Trig_C4_Actions )
set C4 = null
endfunction