- Joined
- Feb 23, 2007
- Messages
- 1,030
JASS:
function NextPreplaceActions takes nothing returns nothing
local integer a = GetPlayerId(GetTriggerPlayer())
local integer b = IAbsBJ(a-1)
local group g = udg_Units[a]
local group g2 = udg_Units[b]
local integer p = CountUnitsInGroup(g)
local integer k = 1
local unit v
loop
exitwhen k>p
set v = FirstOfGroup(g)
call UnitRemoveAbility(v,'A000')
call GroupRemoveUnit(g,v)
set k = k+1
endloop
set p = CountUnitsInGroup(g2)
set k = 1
loop
exitwhen k>p
set v = FirstOfGroup(g2)
call UnitAddAbility(v,'A000')
call GroupRemoveUnit(g2,v)
set k = k+1
endloop
call DestroyGroup(g)
call DestroyGroup(g2)
set g = null
set v = null
endfunction
My question is concerning the groups. Should I use 1 variable, then destroy it at the end of the function, or should I use 1 variable, and destroy it after the 1st loop and set it to a different group and destroy it again after the second loop, or should I use 2 variables like I am currently doing right now?
A) - 1 Group that I destroy at end
B) - 1 Group that I destroy every time I change it
C) - 2 Groups that I destroy at the end