using enum func

dansam92

New Member
Reaction score
1
JASS:
globals
    // values to carry to the DoThings function
    real AmountToHeal
endglobals
function DoThings takes nothing returns boolean
                                      /*nothing becomes boolean*/

    call SetWidgetLife(GetFilterUnit(), GetWidgetLife(GetFilterUnit()) + AmountToHeal
                     /*GetEnumUnit() becomes GetFilterUnit()*/
    
    return false
  /*return false appears here*/
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    // Store values before the enum instead
    set AmountToHeal = 200.0
    // Note the next line.
    call GroupEnumUnitsInRect(GROUP, bj_mapInitialPlayableArea, Filter(function DoThings))
    // The end.
endfunction

code from http://www.thehelper.net/forums/showthread.php?t=138374

don't i have to call DestroyGroup(GROUP) when coding like this?
there is no leak without DestroyGroup?
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
if you're gonna use a handle whole game, then you don't really have to worry about leaking it

in the tutorial from the link you posted it clearly says that

notice this:
JASS:
globals
    group GROUP=CreateGroup()
endglobals

it's used whole game as a global group and you don't need to create new group every time
 

Dinowc

don't expect anything, prepare for everything
Reaction score
223
should i destroy GROUP?

no because you wont be able to use it ever again during the game since the group is only created once on map init
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top