noob Question about Leaks

Aiden

Member
Reaction score
0
reading some tutorials
im trying to understand why some trigger couse some lag.
but i dont understand at all...

Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Player Group - Pick every player in (REDTEAM) and do (Actions)
Loop - Actions
Player - Add 1 to (Picked player) Current gold


this will cause lag?
in all examples of memory leaks groups i saw generic group ...
if the answer its yes.
to remove this leaks i need to this?:
Set Temp_Group = (RedTEAM)
then in the end of the trigger
Custom script: call call DestroyGroup(udg_Temp_Point)

2)Second Question, i need to create for every trigger a new variable ? then destroy it?
like ... Temp_Point2,Temp_Point3,Temp_Point4 ....
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
>this will cause lag?
>to remove this leaks i need to this?:

Of course not...

>2)Second Question, i need to create for every trigger a new variable ? then destroy it?
like ... Temp_Point2,Temp_Point3,Temp_Point4 ....

No you need only one global Point(location in jass terms) variable called say 'Loc', or Temp_Point
for example.

You don't need to destroy Player Groups (Forces), you "need" to destroy unit groups and that's what DestroyGroup takes a unit group not a Point variable:

That's wrong:
Custom script: call DestroyGroup(udg_Temp_Point)

That's correct:
Custom script: call DestroyGroup(udg_Temp_Group)

Btw you fill the udg_Temp_Group variable with units with one of those Pick every unit in <something>.
 

tommerbob

Minecraft. :D
Reaction score
110
Player groups do leak. You can remove them with this:

Trigger:
  • Custom script: call DestroyForce(udg_Player_Group_Name)


However, you do not need to destroy the (all players) player group. If you do, you will likely end up with some funky bugs.
 

Inflicted

Currently inactive
Reaction score
63
This might not be what is causing the lag.

Disable this trigger and run, and then see if the lag is still there.
Otherwise just do what has been suggested above.
 

vypur85

Hibernate
Reaction score
803
> you need only one global Point

Not exactly.
It depends on situation.

Just remember you can reuse any variable after removing/destroying them.

An example:
Trigger:
  • Actions
    • Set TempPoint1 = (Position of (Triggering unit))
    • Set TempPoiint2 = TempPoint offset by 100.00 towards 0.00 degrees
    • ...do something...
    • Custom script: call RemoveLocation (udg_TempPoint1)
    • Custom script: call RemoveLocation (udg_TempPoint2)
    • Set TempPoint1 = (Position of (Triggering unit))
    • ...do something..
    • Custom script: call RemoveLocation (udg_TempPoint1)


TempPoint1 was reused and doesn't leak. In the above case, one variable just isn't enough. You need more than that.


And just for clarity. 'All players' does not leak. Other than that, they leak.
 

Aiden

Member
Reaction score
0
but its necesary?
i have a lot of this kind of trigger :
Player Group - Pick every player in Losbuenos[1] and do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Then - Actions
Unit - Move (Picked unit) instantly to (Center of RedTeam Spawnpoint <gen>), facing (Position of (Triggering unit))
Unit - Remove All buffs from (Picked unit)
Selection - Select (Picked unit) for (Picked player)
Else - Actions
Do nothing
 

tommerbob

Minecraft. :D
Reaction score
110
You are leaking a lot in that trigger. You are leaking a unit group and 2 points for each enumerated unit in the group. Using the above trigger as an example, this is what it should look like:

Trigger:
  • Events
    • Conditions
    • Actions
      • Player group - Pick every player in losbuenos[1] and do (actions)
        • Loop - Actions
          • custom script set bj_wantDestroyGroup = true
          • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (actions)
            • Loop - Actions
              • If (all conditions are true) then do (then actions) else do (else actions)
                • If - Conditions
                • Then - Actions
                  • Set Temp_Point1 = (center of RedTeam Spawnpoint &lt;gen&gt;)
                  • Set Temp_Point2 = (Position of (Triggering unit))
                  • Unit - Move (Picked unit) instantly to Temp_Point1 facing Temp_Point2
                  • Unit - Remove all buffs from (picked unit)
                  • Selection - Select (picked unit) for (picked player)
                  • Custom script: call RemoveLocation(udg_Temp_Point1)
                  • Custom script: call RemoveLocation(udg_Temp_Point2)
                • Else - Actions


Depending on how often you use the above trigger will depend on how much the game will lag over time. The more you leak over time, the more it will lag. A few leaks here and there will not make a difference, but it is good to clean them anyway. However, if you use a trigger like that one above often, it can start to lag the game over time, and this lag will multiply itself depending on how many players are in the Losbuenos[1] player group.
 

Aiden

Member
Reaction score
0
You are leaking a lot in that trigger. You are leaking a unit group and 2 points for each enumerated unit in the group. Using the above trigger as an example, this is what it should look like:

Trigger:
  • Events
    • Conditions
    • Actions
      • Player group - Pick every player in losbuenos[1] and do (actions)
        • Loop - Actions
        • <b> custom script set bj_wantDestroyGroup = true</b>
          • Unit Group - Pick every unit in (Units owned by (Picked player)) and do (actions)
            • Loop - Actions
              • If (all conditions are true) then do (then actions) else do (else actions)
                • If - Conditions
                • Then - Actions
                  • Set Temp_Point1 = (center of RedTeam Spawnpoint &lt;gen&gt;)
                  • Set Temp_Point2 = (Position of (Triggering unit))
                  • Unit - Move (Picked unit) instantly to Temp_Point1 facing Temp_Point2
                  • Unit - Remove all buffs from (picked unit)
                  • Selection - Select (picked unit) for (picked player)
                  • Custom script: call RemoveLocation(udg_Temp_Point1)
                  • Custom script: call RemoveLocation(udg_Temp_Point2)
                • Else - Actions


Depending on how often you use the above trigger will depend on how much the game will lag over time. The more you leak over time, the more it will lag. A few leaks here and there will not make a difference, but it is good to clean them anyway. However, if you use a trigger like that one above often, it can start to lag the game over time, and this lag will multiply itself depending on how many players are in the Losbuenos[1] player group.

What does that custom script ? =o
custom script set bj_wantDestroyGroup = true
 

Aiden

Member
Reaction score
0
> you need only one global Point

Not exactly.
It depends on situation.

Just remember you can reuse any variable after removing/destroying them.

An example:
Trigger:
  • Actions
    • Set TempPoint1 = (Position of (Triggering unit))
    • Set TempPoiint2 = TempPoint offset by 100.00 towards 0.00 degrees
    • ...do something...
    • Custom script: call RemoveLocation (udg_TempPoint1)
    • Custom script: call RemoveLocation (udg_TempPoint2)
    • Set TempPoint1 = (Position of (Triggering unit))
    • ...do something..
    • Custom script: call RemoveLocation (udg_TempPoint1)


TempPoint1 was reused and doesn't leak. In the above case, one variable just isn't enough. You need more than that.


And just for clarity. 'All players' does not leak. Other than that, they leak.
Other question.
my trigger event is this:
Trigger:
  • Events
    • Unit - A unit Dies

If i use a Custom script to destroy a variable, just like a point or playergroup, will works a second time when unit die?
sound more convenient to reuse, im right?
 

Aiden

Member
Reaction score
0
and in this case what i would do?
Trigger:
  • Balanced Gold
    • Events
      • Time - Every 7.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Losbuenos[1] and do (Actions)
        • Loop - Actions
          • Player - Add (42 / (Number of players in Losbuenos[1])) to (Picked player) Current gold
      • -------- Evil ones --------
      • Player Group - Pick every player in LosMalos[1] and do (Actions)
        • Loop - Actions
          • Player - Add (42 / (Number of players in LosMalos[1])) to (Picked player) Current gold
 

tommerbob

Minecraft. :D
Reaction score
110
Nothing. You are using player groups, that is different from unit groups.

As long as you are reusing the same player group instead of constantly creating new ones, you are fine.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top