HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

More Proof of GUI Suckage

07-19-2009, 04:28 PM#1
Dark.Revenant
Trigger:
Set TempPlayer[1] = LastHit[(Player number of (Owner of DTarget))]
Set TempUnit[6] = (Random unit from Abilities[(Player number of (Owner of DTarget))])
Set TempGroup[1] = Abilities[(Player number of TempPlayer[1])]
Collapse Unit Group - Pick every unit in TempGroup[1] and do (Actions)
Collapse Loop - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of (Picked unit)) Equal to (==) (Unit-type of TempUnit[6])
Collapse Then - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of TempUnit[6]) Equal to (==) |cffcccc66Jew Gun|r
(Custom value of (Picked unit)) Less than (<) 4
Collapse Then - Actions
Game - Display to (Player group(TempPlayer[1])) for 10.00 seconds the text: (|cff999999You have received an upgrade for the|r + (Name of TempUnit[6]))
Unit - Set the custom value of (Picked unit) to ((Custom value of (Picked unit)) + 1)
Unit - Increase level of Jew Gun for PlayerUnit[(Player number of TempPlayer[1])]
Else - Actions
Collapse Else - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of units in Abilities[(Player number of TempPlayer[1])]) Less than (<) 8
Collapse Then - Actions
Collapse Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Unit-type of TempUnit[6]) Equal to (==) |cffcccc66Jew Gun|r
Collapse Then - Actions
Game - Display to (Player group(TempPlayer[1])) for 10.00 seconds the text: (|cff666666You have received the|r + (Name of TempUnit[6]))
Unit - Create 1 |cffcccc66Jew Gun|r for TempPlayer[1] at zzz facing Default building facing (270.0) degrees
Unit - Set the custom value of (Last created unit) to 1
Unit Group - Add (Last created unit) to Abilities[(Player number of TempPlayer[1])]
Unit - Add Jew Gun to PlayerUnit[(Player number of TempPlayer[1])]
Else - Actions
Else - Actions
Custom script: call DestroyGroup(udg_TempGroup[1])

The kicker is, without the "Custom script: call DestroyGroup(udg_TempGroup[1])", it works fine. However, with it added in to "clean a leak" the Abilities[1] unit group is ALSO destroyed. And by destroyed, I mean COMPLETELY destroyed, meaning no additional units can be added to Abilities[1] (but Abilities[2] and beyond are fine). What the fuck is going on here?
07-19-2009, 05:25 PM#2
zeroXD
By destroying your TempGroup, you are also destroying the Abilities group, because both variables point to the same handle id.
You don't even really need the TempGroup, you could just directly use the Abilities group there.
07-19-2009, 06:02 PM#3
Dark.Revenant
Yeah, I know, but it's still pretty stupid that there is no documentation showing that certain variables are referential.
07-20-2009, 10:41 PM#4
Anitarf
Quote:
Originally Posted by Dark.Revenant
Yeah, I know, but it's still pretty stupid that there is no documentation showing that certain variables are referential.
Well, in Blizzard's defense, it's not quite as stupid as some people being around for more than two years and still not knowing the basics of how handles work.
08-06-2009, 04:00 AM#5
RushSecond
Trigger:
Actions
Set TempUnitGroup1 = (Random (Number of units in UG_Abilities) units from UG_Abilities)
Collapse Unit Group - Pick every unit in TempUnitGroup1 and do (Actions)
Loop - Actions
Custom script: call DestroyGroup (udg_TempUnitGroup1)
Fixes all your problems. I did this for Battle Mages to clean up it's most horrendous leaking.

EDIT: actually, perhaps even better is

Trigger:
Actions
Custom script: set TempUnitGroup1 = null
Unit Group - Add all units of UG_Abilities to TempUnitGroup1
Collapse Unit Group - Pick every unit in TempUnitGroup1 and do (Actions)
Loop - Actions
Custom script: call DestroyGroup (udg_TempUnitGroup1)
Anyone know if this works?