• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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 10
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