• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Quick question about leaks

Status
Not open for further replies.
Level 5
Joined
Apr 6, 2008
Messages
96
OK, I'm kinda new to this whole "remove memory leaks" stuff, and while I really want to learn how to do it, I have a problem right with the first step :S

So, my trigger looks like this:
Event:
-A unit starts the effect of an ability
Condition:
-Ability being cast equal to XY
Action:
-Custom script: Set tempGroup = units in Region
-Unit group- Pick every unit in (Units in Region) and do (Action)
-Custom script: call DestroyGroup( udg_tempGroup )

This trigger doesn't work, and the editor keeps telling me that it is expecting a "code statement" and a "name" (whatever those things are).

Could anyone help me out please?
 
Level 11
Joined
Mar 31, 2009
Messages
732
"-Unit group- Pick every unit in (Units in Region) and do (Action)"
change to:
"-Unit group- Pick every unit in (tempGroup) and do (Action)"

"Custom script - Set tempGroup = Units in region"
change to:
"Custom script - call GroupEnumUnitsInRect(udg_tempGroup, gg_rct_name_of_region, null)"
 
Level 5
Joined
Apr 6, 2008
Messages
96
It is still expecting a code statement here:
Set tempGroup = units in Region <gen>


Ohh didn't see that you've added something.
Changed to "Custom script - call GroupEnumUnitsInRect(udg_tempGroup, gg_rct_Region 034, null)", now it is expecting a name instead of a code statement.
 
Level 4
Joined
Mar 14, 2009
Messages
98
There's actually a "Set Variable" action somewhere in the GUI menu. Use that to set tempGroup. Don't use custom script, it's unnecessarily complicated and ugly-looking. Besides, you get to skip seeing that GroupEnumUnitsInRect function call.

An unrelated note, every variable you create with the variable editor will have the prefix "udg_" right before them. I think it stands for User Defined Global. It's Blizzard's way of making your variables not affect their variables. In GUI, the "udg_" prefix is automatically omitted, but when using custom script, you will have to type "udg_" right before the variable name, which is why you destroy udg_tempGroup and not tempGroup. (There is no variable known as tempGroup.)
 
Level 5
Joined
Apr 6, 2008
Messages
96
OK, I sort of rewrote the whole stuff.
Right now it looks like this:
-Unit group - pick every unit in (Units in Region) and do (Action)
-Set tempGroup = Last created unit group
-Custom script- Call DestroyGroup( udg_tempGroup)

Does it work this way? Is the trigger not leaking anymore?
 
Status
Not open for further replies.
Top