MasterRofl
New Member
- Reaction score
- 8
JASS:
private function Actions takes nothing returns nothing
local location TargetPoint = GetSpellTargetLoc()
local group TargetUnits
local unit TargetUnit
local location TargetUnitLoc
local unit DummyUnit
set udg_Map_TempPlayer = GetOwningPlayer(GetSpellAbilityUnit())
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 10
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set TargetUnits = GetUnitsInRangeOfLocMatching( 400.00, TargetPoint, Condition(function Filter) )
set TargetUnit = GroupPickRandomUnit( TargetUnits )
set TargetUnitLoc = GetUnitLoc( TargetUnit )
set DummyUnit = CreateUnitAtLoc( GetOwningPlayer(GetSpellAbilityUnit()), 039;n009039;, TargetUnitLoc, bj_UNIT_FACING )
call UnitApplyTimedLife( DummyUnit, 039;BTLF039;, 1.00 )
call UnitAddAbility( DummyUnit, 039;A00J039; )
call SetUnitAbilityLevel( DummyUnit, 039;A00J039;, GetUnitAbilityLevel(GetSpellAbilityUnit(), GetSpellAbilityId()) )
call IssueTargetOrder( DummyUnit, "chainlightning", TargetUnit )
call TriggerSleepAction( 0.2 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call RemoveLocation(TargetPoint)
call RemoveLocation(TargetUnitLoc)
call DestroyGroup(TargetUnits)
set TargetPoint = null
set TargetUnit = null
set DummyUnit = null
endfunction
When I use this trigger, it only runs once. How can I modify it so that it runs 10x?
Also, does this trigger leak?
Much thanks!