JASS:
function DoThings takes nothing returns boolean
call KillUnit(GetFilterUnit())
return false
endfunction
function My_Function takes real x, real y returns nothing
call GroupEnumUnitsInRange (udg_GROUP, x, y, 1000.00, Condition(function DoThings))
call DisplayTextToForce( GetPlayersAll(), "Work Done" )
endfunction
It meant to be a trigger that kills all unit in range of 1000 yards around a point with coordinates x, y.
I choose to use "call GroupEnumUnitsInRange (udg_GROUP, x, y, 1000.00, Condition(function DoThings))" to avoid leaks problems in storing the unit in a group. This is a pattern that will run several times (leaking of groups are a unsolved problem for me) in my map and so I prefer not to create billion of leaking groups^^.
Well, the point is it doesen't work. Function "My_Function" starts enumerating units, DoThing takes the first unit (i put around 300 test units at x, y to be sure that THERE ARE units in range), it kills the first GetFilterUnit() and then it stop running and it print out "Work Done". It doesen't kill other units. WorldEditor seams to be too kind^^, but I want a really mass KillUnit()^^.
Why it stops?
Whats wrong with him?
Now I talk more in general.
I found that if I put an operation like KillUnit() or UnitDamageTargetBJ() into a Condition function (like in the example) it leads to a interruption of the Enumerating operation of the generic GroupEnumUnitsIn*Range/Rect/ecc...* function.
Someone has comment, suggestion or whatever about this?
Thanks a lot.
I hope you have not made any stupid mistake.
P.S. Sry for my bad english^^
EDIT 1: main was a generic name. Changed to My_Function.
EDIT 2: there was a syntax error (now correct); GroupEnumUnitInRange() is obviously GroupEnumUnitsInRange()
Last edited: