I
iNsaNe
Guest
im making a function that returns a certain number of randomly picked units in a unit group. The problem is, when I call the function nothing happens.
here's my jass (im new to jass by the way)
and this is how i attempt to use it (so i get 10 units back in the unit group):
and of course udg_HeatPits is a unit group variable
edit:
when i say nothing happens i mean, the code doesn't execute for the function FirePitChoose. The map doesn't freeze, but it's like the code does.
here's my jass (im new to jass by the way)
Code:
function FirePitChoose takes integer NumberOfPits returns group
local unit RUnit
local group Pits = GetUnitsOfTypeIdAll ( 'n001' )
local group ReturnPits
local integer Index = 1
loop
exitwhen Index > NumberOfPits
set RUnit = GroupPickRandomUnit ( Pits )
call GroupAddUnitSimple ( RUnit, ReturnPits )
call GroupRemoveUnitSimple ( RUnit , Pits )
set RUnit = null
set Index = Index + 1
endloop
call DestroyGroup ( Pits )
return ReturnPits
endfunction
and this is how i attempt to use it (so i get 10 units back in the unit group):
Code:
set udg_HeatPits = FirePitChoose ( 10 )
edit:
when i say nothing happens i mean, the code doesn't execute for the function FirePitChoose. The map doesn't freeze, but it's like the code does.