I'm trying to make some spells involving unit groups. I also want all the variables to be local, so how do I get a unit group with certain conditions into the function with a local variable? Any help appreciated.
local group MyGroupVar = CreateGroup()
and as for filling the group... go look through common.j for functions that have to do with groups.return IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(bj_lastCreatedUnit))
function Trig_Set_Globals_Actions takes nothing returns nothing
local group SpawnChoosers = CreateGroup()
local unit temp
call GroupEnumUnitsOfType( SpawnChoosers,"Spawn", null)
//Here is my problem
loop
set temp = FirstOfGroup(SpawnChoosers)
exitwhen temp == null
call BJDebugMsg("Ok")
call SetUnitAbilityLevel(temp, 'A000', 21)
call SetUnitAbilityLevel(temp, 'A001', 21)
call SetUnitAbilityLevel(temp, 'A002', 21)
call GroupRemoveUnit(SpawnChoosers, temp)
endloop
set udg_TimerInterval = 45.
set udg_Spawns[0] = GetRectCenter(gg_rct_RedSpawn)
set udg_Spawns[1] = GetRectCenter(gg_rct_BlueSpawn)
set udg_Spawns[2] = GetRectCenter(gg_rct_TealSpawn)
set udg_Spawns[3] = GetRectCenter(gg_rct_PurpleSpawn)
set udg_Spawns[4] = GetRectCenter(gg_rct_YellowSpawn)
set udg_Spawns[5] = GetRectCenter(gg_rct_OrangeSpawn)
set udg_Spawns[6] = GetRectCenter(gg_rct_GreenSpawn)
set udg_Spawns[7] = GetRectCenter(gg_rct_PinkSpawn)
set udg_Spawns[8] = GetRectCenter(gg_rct_GraySpawn)
set udg_Spawns[9] = GetRectCenter(gg_rct_LBSpawn)
set udg_Spawns[10] = GetRectCenter(gg_rct_DGSpawn)
set udg_Spawns[11] = GetRectCenter(gg_rct_BrownSpawn)
call TimerStart(udg_SpawnTimer, udg_TimerInterval, true, null)
call DestroyGroup(SpawnChoosers)
set SpawnChoosers = null
endfunction
//===========================================================================
function InitTrig_Set_Globals takes nothing returns nothing
set gg_trg_Set_Globals = CreateTrigger( )
call TriggerAddAction( gg_trg_Set_Globals, function Trig_Set_Globals_Actions )
call TriggerRegisterTimerEvent( gg_trg_Set_Globals, .01 , false)
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
set udg_xxx = GetUnitName(gg_unit_h005_0016)
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction