• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Removing leaks

Status
Not open for further replies.
Level 9
Joined
Apr 6, 2008
Messages
436
I know this section is mostly about requesting resources... Though I've seen someone asking for other things and so here I am.
I'd need someone to remove the leaks in my map. I simply don't know how to do it without creating a ton of variables, and I just have no idea how to do it with unit-groups...

It's maybe the only thing left to do in my map.
The GUI triggers are only 27, and are all quite simple.


Even if you don't answer, thanks for reading, have a nice day :)
I hope this request is not too out of place.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Groups are easy to be cleared.

First make the group:
  • Set Group = (Units within 512.00 of (Area)
After several actions, you must clear it in that way:
  • Custom script: call RemoveLocation (udg_Group/or your group-name)
But, if you are NOT using global veriable (like in trigger #1)
You must make the trigger in that way:

  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units within 512.00 of (Center of (Playable map area))) and do (Actions)
So the custom script will clear the group (units within ...) after actions are done.


If you send me your map somehow I might try to fix the bugs, since you said its very simple.
 
Level 9
Joined
Apr 6, 2008
Messages
436
there's a link to my map in my signature.
Thanks a lot for explaining how to clean non-global variables, I didn't know I could do it!
But what if I have a trigger like this:
  • Unit Group - Pick every Unit in (Region 001) and Do some action at (position of (Picked unit))
Not only I created a Unit Group, I also used a dozen of locations (one for every unit in Region 001).

If you fix the whole map, you can even avoid answering. Or else just answer and I'll slowly and painfully understand what to do.

The problem with leaks is that I can't test the map to see if they're fixed, I need another person to tell me if everything is ok or I did something wrong.
 
Well, in that case, Horizontal, you might need a tutorial.
That Unit Group action indeed creates many leaks, so we can put it this way:
Solution #1 (More efficient than the second):
  • Actions
  • Set Temp_Group = (Units in Region 0001 <gen>)
  • Unit Group - Pick up every unit in (Temp_Group) and do (Actions)
    • Loop - Actions
      • Set Point1 = (Position of (Picked unit))
      • Special Effect - Create a special effect at Point1....
      • Custom script: call RemoveLocation (udg_Point1)
  • Custom script: call DestroyGroup (udg_Temp_Group)
Solution #2:
  • Actions
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Region 0001 <gen>) and do (Actions)
    • Loop - Actions
      • Set Point1 = (Position of (Picked unit))
      • Special Effect - Create a special effect at Point1 ....
      • Custom script: call RemoveLocation (udg_Point1)
I'll test it when I have time. Cheers for the moment :)
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
Well, in that case, Horizontal, you might need a tutorial.
That Unit Group action indeed creates many leaks, so we can put it this way:
Solution #1 (More efficient than the second):
  • Actions
  • Set Temp_Group = (Units in Region 0001 <gen>)
  • Unit Group - Pick up every unit in (Temp_Group) and do (Actions)
    • Loop - Actions
      • Set Point1 = (Position of (Picked unit))
      • Special Effect - Create a special effect at Point1....
      • Custom script: call RemoveLocation (udg_Point1)
  • Custom script: call DestroyGroup (udg_Temp_Group)
Solution #2:
  • Actions
  • Custom script: set bj_wantDestroyGroup = true
  • Unit Group - Pick every unit in (Units in Region 0001 <gen>) and do (Actions)
    • Loop - Actions
      • Set Point1 = (Position of (Picked unit))
      • Special Effect - Create a special effect at Point1 ....
      • Custom script: call RemoveLocation (udg_Point1)
I'll test it when I have time. Cheers for the moment :)
Err, the second is more efficient.

Just plain uglier.
 
Level 6
Joined
Mar 26, 2008
Messages
239
Well, if you use a group in a trigger only once (let it be named "Group"), then you should write "call Remove Location Group" after you use it.
If you use location in any action(let it be Location), you also should remove it by writing "call RemoveLocation Location" after every time you use it
If you use special effect that need to be called once, you should remove it, there is an action for this: "Destroy Special Effect" and choose "Last Created Special Effect"
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Well, if you use a group in a trigger only once (let it be named "Group"), then you should write "call Remove Location Group" after you use it.
If you use location in any action(let it be Location), you also should remove it by writing "call RemoveLocation Location" after every time you use it
If you use special effect that need to be called once, you should remove it, there is an action for this: "Destroy Special Effect" and choose "Last Created Special Effect"

Learn triggering, pl0x.

@HorizonTal
Yes, a simple point can be used as many times you want in a loop.
So if you use loop for picking specified units in an area, the location has to be removed at the end of the loop, which means, you have to add a custom script
  • Custom script: call RemoveLocation (udg_LocationName)
 
Level 6
Joined
Mar 26, 2008
Messages
239
Learn triggering, pl0x.

@HorizonTal
Yes, a simple point can be used as many times you want in a loop.
So if you use loop for picking specified units in an area, the location has to be removed at the end of the loop, which means, you have to add a custom script
  • Custom script: call RemoveLocation (udg_LocationName)
It's not comfortable to write in triggering when you write from mobile phone:p
And you can make location as variable,then you can remove location only once(after loop after all actions),but if you don't then location must be removed every time you use it.
I'm making everything in triggers,them turn it to JASS,add locals,scopes,remove BJ functions,and I advise you to do the same,it's not as difficult as it can seem,I thought that it is difficult too,but it's worth it))
 
Level 6
Joined
Mar 26, 2008
Messages
239
Try my map and then speak about my abilities,you don't know me so you should shut your mouth,I didn't say anything bad about you
And every time you use location it creates this location,and loop only repeats actions,but when you use variable then it creates location only 1 time and uses it as much times as you need,I mean not instant triggers but those in which such locations as position of unit and other change with some time
And I'm not computer worm which tells about a man of his abilities in triggering :p
 
Level 6
Joined
Mar 26, 2008
Messages
239
Shut you fucking mouth (moderators,sorry,his started first)
I repeat,try map and see, and I saw that you couldn't remove group leak in your spell until somebody wrote it to you,so not me is an idiot
And if you use something like making special effect at position of unit every some seconds,then it creates unit location every time,because location changes every time,that is why it is removed every time in every leakless spell
 
Level 6
Joined
Mar 26, 2008
Messages
239
And you should remove locations in a loop and not outside(if in a loop and,because it uses different locations (if you use pick every unit and position of picked unit in it or like that,because location of every picked unit is different location,and not the same)
If saying shortly,if location is not the same in loop or elsewhere them it must be removed,because locations don't move to other places,they are created every time
Of course you can use position of triggering unit as many times as you want,and them remove it,but only if it doesn't change during the work of trigger,and if it does,them you should remove it every time it's going to change
 
Level 6
Joined
Mar 26, 2008
Messages
239
You know,this thread is not about leaks that can be in your trigger,it is about leaks that just can be,and I wrote not about leaks that can be in your trigger but about leaks that just can be!
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Damn, this will be my last post and I will try to explain this thing to you

So, we have a target-ground ability which damages all units in an area
We make the all actions before the loop for the damage.
So, when WE use "Unit - Pick every unit within 200 of (location1) - then do
-LOOP (A FREAKING LOOP)
Which means, THE ACTION IN THE LOOP WILL BE REPEATED UNTIL ALL ACTIONS ARE APPLIED
So, when units are picked, no matter we use global unit-group veriable, WE CAN MAKE LIEK 50 SPECIAL EFFECTS IN THAT LOOP WITHOUT USING 50 ARRAYS FOR THE LOCATION.
EVEN IF WE USE A FUCKING UNIT-VERIABLE (NOT PICKED UNIT) IT STILL WON'T LEAK/BUG IF WE CLEAR THE VERIABLE AT THE END OF THE LOOP (WHICH IS INSIDE THE LOOP) NOT OUTSIDE.

DO YOU FUCKING UNDERSTAND ME NOW?
 
Level 6
Joined
Mar 26, 2008
Messages
239
Well,I knew that even before you wrote that))
Of course if you use special effect at ONE location many times,then you can remove location after the loop))
But if you want to add special effects at positions of every picked unit,just to make the ability more beautiful for example,then you should remove these locations in the loop,I mean,add 'RemoveLocation (GetUnitLoc(GetEnumUnit()))
I think we were just talking about different things))
Oh...I meant not in the loop but inside 'pick every unit' action))
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
Using GetUnitLoc is count as a leak, im talking about a global-veriable
Made via the trigger-editor (as location1), which can be used multiple times as long as the loop runs. So the things are talking about are, im talling you, that you can use global veriable (like location1) for the loops, and you talk about (Position of (Blah Unit)).

End of story, problem is solved anyway.
 
Level 6
Joined
Mar 26, 2008
Messages
239
And I know what loop and other functions mean,I work with triggers for about 4-5 years,and with JASS for about 2 years,so I do know what functions mean(I repeated it specially)
You can assure yourself in it just by trying my map:p
I did everything myself except 2 or 3 systems(I remember only Telura beam,custom stun and recently added better recipe system):p
 
Level 6
Joined
Mar 26, 2008
Messages
239
Well,it is your decision))
But I told you to test it not to enjoy playing but to get to know that you are wrong about my abilities:p
That is all,you told 'that is my last post' about 2-3 post before:p
 
Status
Not open for further replies.
Top