| 09-27-2004, 04:33 PM | #1 |
I have a function that wants to enumerate through the units within range of a specific unit. But I don't want to use the standard ForGroup() with the fuction paramater because I need access to local variables and would greatly prefer not having to assign temporary global values in order to use them. So is there any other way to do it that would keep everything within the same function? |
| 09-27-2004, 04:50 PM | #2 |
you could use gamecache instead of temporary globals. |
| 09-27-2004, 07:15 PM | #3 |
Code:
local group source= ##insert group source here##
local group enumgroup=CreateGroup()
local unit pickedunit
call GroupAddGroup(source,enumgroup)
loop
picked=FirstOfGroup(enumgroup)
exitwhen picked==null
## do things with picked here##
call GroupRemoveUnit(enumgroup,pickedunit)
endloop |
| 09-27-2004, 11:13 PM | #4 |
There is a set missing. Usually you do not really need that GroupAddGroup as you apply that on the result of a "units in range" or similar that you do not really need any more afterwards. |
| 09-28-2004, 01:41 AM | #5 |
set pickedunit=FirstOfGroup(enumgroup) and the whole source thing doesnt seem like it does anything to me. |
| 09-28-2004, 08:00 PM | #6 | |
Quote:
|
