- Joined
- Nov 30, 2007
- Messages
- 1,202
If I Create groups or force, in the globals tag, is it best to create them when they are needed like below, adding another variable for counting them, Or...
... Just looping through them all as seen here, this not a group created counter. Also, can I loop through this entire series?
Perhaps groups and force (and what else there is) is best created using the variable creating menu making them "udg_VARIABLE" and avoiding the problem with creating them? Or do you have to set them up aswell?
How do you do it?
JASS:
globals
group indexGroup_u
unit temp_uForIndex
integer indexMax_u
integer indexMaxRecord_u
unit array index_u
group array index_u_Group
endglobals
function IndexUnit takes nothing returns nothing
if indexMax_u == indexMaxRecord_u then // Creates the Group if a new top is reached.
set indexMaxRecord_u = indexMaxRecord_u + 1
set indexGroup_u[indexMaxRecord_u] = CreateGroup()
endif
set index_u[indexMax_u] = temp_uForIndex
call SetUnitUserData(index_u[indexMax_u], indexMax_u)
call GroupAddUnit(index_u[indexMax_u], indexGroup_u)
set indexMax_u = indexMax_u + 1
endfunction
function DeindexUnit takes nothing returns nothing
endfunction
... Just looping through them all as seen here, this not a group created counter. Also, can I loop through this entire series?
JASS:
function InitTrig_Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
//Setup Variables
loop
exitwhen i > JASS_MAX_ARRAY_SIZE
set index_u_Group[i] = CreateGroup()
set indexGroup_u[i] = CreateGroup()
set i = i + 1
endloop
set t = null
endfunction
Perhaps groups and force (and what else there is) is best created using the variable creating menu making them "udg_VARIABLE" and avoiding the problem with creating them? Or do you have to set them up aswell?
How do you do it?