Help me fix leak plz

Venge22

New Member
Reaction score
10
Can sum 1 help me fix this leak in this trigger? +rep if u do.

function Trig_Untitled_Trigger_002_Func001002 takes nothing returns nothing
call GroupPointOrderLocBJ( GetUnitsInRectAll(gg_rct_demon), "attack", GetRectCenter(gg_rct_middle) )
endfunction

function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectAll(GetPlayableMapRect()), function Trig_Untitled_Trigger_002_Func001002 )
call CreateNUnitsAtLocFacingLocBJ( 1, 'hfoo', Player(11), GetRandomLocInRect(gg_rct_demon), GetRandomLocInRect(gg_rct_demon) )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set gg_trg_Untitled_Trigger_002 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_002, 2 )
call TriggerAddAction( gg_trg_Untitled_Trigger_002, function Trig_Untitled_Trigger_002_Actions )
endfunction
 

Flare

Stops copies me!
Reaction score
662
First of all, I assume you just converted this from GUI to JASS so you could copy-paste? If so, you shouldn't really do that (unless you specifically want it done in JASS) since it's only complicating things if you don't know JASS - if you want to copy-paste the GUI trigger, right-click the trigger's name that's shown immediately above the Events and select Copy As Text

Code:
gg_rct_demon
That's not leaking at all Renendaru - the GetRectCenter and GetRandomLocInRect do leak, but not that region - to fix the location leaks, you must assign a var to them i.e.
JASS:
function CallbackFunction takes nothing returns nothing
//Issue the order to a single unit, not the whole group
local location l = GetRectCenter (gg_rct_demon)
call IssuePointOrderLoc (GetEnumUnit (), "attack", l)
call RemoveLocation (l)
set l = null
endfunction

function YourFunction takes nothing returns nothing
local location l = GetRectCenter (gg_rct_demon)
local location l2 = GetRandomLocInRect (gg_rct_demon)
local group g = GetUnitsInRectAll (GetPlayableMapRect ())
call ForGroup (g, function CallbackFunction)
call DestroyGroup (g)
call RemoveLocation (l)
call RemoveLocation (l2)
set g = null
set l = null
set l2 = null
//Use these locations instead of what you're using now
endfunction


Code:
GetPlayableMapRect
No, that's not leaking either - take a look at TESH, and you'll see that it's returning an existing rect (which was already made when you created the map) as opposed to creating a brand-new rect
JASS:
function GetPlayableMapRect takes nothing returns rect
    return bj_mapInitialPlayableArea
endfunction
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Hmm... I've been using GUI too much.... I was initially a JASS user...
 

Venge22

New Member
Reaction score
10
Um, i have RoC. DOes that change anything. And i dont really know much about JASS, this guy just reccomended me to change the trigger to JASS so it would be eaiser to fix the leak or sumtin.:D
 

Sevion

The DIY Ninja
Reaction score
413
You may only bump every 24 hours.

Please use JASS tags when posting JASS triggers and CODE tags when posting other scripts, like GUI.

Now, to the trigger, I believe Flare has the correct answer. (He knows his stuff :thup:)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top