T
Tooters
Guest
I want to recreate the Starcraft Trigger "Bring" in Jass, and I have some questions about the ForGroups. I don't want to make another function because then I would have to use handles to use the same groups and things like that so I tried putting ( function GroupAddUnitSimple( GetEnumUnit( ), bringGroup ) ) for the part where it says CODE CALLBACK. I did this in the IF COUNTER >= QUANTITY THEN part also. I also tried using a native.. but I don't think the natives would work. At all the spots it gave Syntax Error, Can someone please help me?
Code:
function bring takes player whichPlayer, integer quantity, integer unitId, rect whichRect returns boolean
local group bringGroup
local integer counter
call ForGroup( GetUnitsInRectOfPlayer( whichRect, whichPlayer ), function GroupAddUnitSimple( GetEnumUnit( ), bringGroup ) )
set counter = CountUnitsInGroup( bringGroup )
if counter >= quantity then
call ForGroup( bringGroup, function GroupRemoveUnitSimple( GetEnumUnit( ), bringGroup ) )
call ForGroup( bringGroup, native RemoveUnit( GetEnumUnit( ) ) )
return true
endif
return false
endfunction