You mean adding a unit to a specified group?is there a better way to attach unit groups to a certain unit?
Yep as long as you put them seperatly.
okay thanksIf multiple groups are really needed, so not only needed as temporary group, then it's fully okay.
forgot to mention, he can only be affected by one at a timeoption 2: what if a target is affected by multiple spell instances?
ok, thanksAh, okay. Hm, if you are using unit indexer already, and can avoid group arrays with mentioned way,
then it will be a bit more performant probably. Because groups are a bit more heavy overall.. but if not then I would not think twice/doubt to use groups.
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
call GroupRemoveUnit(g, FoG)
endloop
okay, thanks!It is the good way with using a temp group.
It's explained the last part of this tutorial: vJass Optimization: Using a First of Group Loop for Enumeration
i wouldnt have access to my local variables in the loop functioncall ForGroup(g, function ....)
and then use GetEnumUnit() to get the "picked unit".
loop
set FoG = FirstOfGroup(g)
exitwhen FoG == null
call GroupRemoveUnit(g, FoG)
call GroupAddUnit(g2, FoG)
endloop
set gTemp = g
set g = g2
set g2 = gTemp