Removing Leaks

SwedishChef

New Member
Reaction score
32
Trigger:
  • Move Hero
    • Events
    • Conditions
    • Actions
      • Set ArenaFacing = (Center of Arena Face Point <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Mode Equal to 1
        • Then - Actions
          • Set Integer = 1
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set Integer = (Integer + ((IntegerA - 1) x 6))
              • Player Group - Pick every player in Teams[(Integer A)] and do (Actions)
                • Loop - Actions
                  • Set MyLocation = (Center of Team_Region[Integer])
                  • Set MyUnitGroup = (Units owned by (Picked player) matching (((Matching unit) is alive) Equal to True))
                  • Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to MyLocation)
                  • Set Integer = (Integer + 1)
                  • Custom script: call DestroyGroup(udg_MyUnitGroup)
                  • Custom script: call RemoveLocation(udg_MyLocation)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Mode Equal to 2
        • Then - Actions
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Player Group - Pick every player in Teams[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (Lifes[(Player number of (Picked player))] Greater than TempMaxKill) then do (Set TempMaxKill = Lifes[(Player number of (Picked player))]) else do (Do nothing)
              • Player Group - Pick every player in Teams[(Integer A)] and do (Actions)
                • Loop - Actions
                  • If (Lifes[(Player number of (Picked player))] Equal to TempMaxKill) then do (Set TeamLeader[(Integer A)] = (Player number of (Picked player))) else do (Do nothing)
              • Set MyLocation = (Center of Single_Duell[(Integer A)])
              • Set MyUnitGroup = (Units owned by (Player(TeamLeader[(Integer A)])) matching (((Matching unit) is alive) Equal to True))
              • Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to MyLocation)
              • Set TempMaxKill = 0
              • Custom script: call DestroyGroup(udg_MyUnitGroup)
              • Custom script: call RemoveLocation(udg_MyLocation)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Mode Equal to 3
        • Then - Actions
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Set MyLocation = (Center of Single_Duell[(Integer A)])
              • Set MyUnitGroup = (Units owned by (Random player from Teams[(Integer A)]) matching (((Matching unit) is alive) Equal to True))
              • Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to MyLocation)
              • Custom script: call DestroyGroup(udg_MyUnitGroup)
              • Custom script: call RemoveLocation(udg_MyLocation)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Game_Mode Equal to 4
        • Then - Actions
          • Set Integer = 1
          • Player Group - Pick every player in All_Players and do (Actions)
            • Loop - Actions
              • Set MyLocation = (Center of Arena_Region[Integer])
              • Set MyUnitGroup = (Units owned by (Picked player) matching (((Matching unit) is alive) Equal to True))
              • Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to MyLocation)
              • Set Integer = (Integer + 1)
              • If (Integer Greater than 12) then do (Set Integer = 1) else do (Do nothing)
              • Custom script: call DestroyGroup(udg_MyUnitGroup)
              • Custom script: call RemoveLocation(udg_MyLocation)
        • Else - Actions
      • Set MyUnitGroup = (Units in Arena <gen>)
      • Unit Group - Pick every unit in MyUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Pause (Picked unit)
          • Unit - Make (Picked unit) Invulnerable
      • Custom script: call DestroyGroup(udg_MyUnitGroup)
      • Custom script: call RemoveLocation(udg_ArenaFacing)
 

Komaqtion

You can change this now in User CP.
Reaction score
469
No, the second one will leaks the most, since you're not ever destroying the point or group (The custom scripts for this is in the "Else" part, and the other stuff is in the "Then" part XD)

The first one is the one to use ;)

Also, this isn't needed:
Trigger:
  • If ((Integer A) Equal to 2) then do (Set Integer = 7) else do (Do nothing)
    • If ((Integer A) Equal to 3) then do (Set Integer = 13) else do (Do nothing)
    • If ((Integer A) Equal to 4) then do (Set Integer = 19) else do (Do nothing)


It can just be this:
Trigger:
  • Set Integer = (Integer + (((Integer A) - 1) * 6))


(Freehanded XD And you still need to set it to 1 first :D)
 

SwedishChef

New Member
Reaction score
32
Hm, okey well I'm actually also sure that you only need to clear them after like in trigger 2. Just wanted to make sure since I'm fixing old triggers I made a while ago. Anyone else who is sure about it?

E: didnt see you post komat. but in the other trigger the leaks removal arent in the else it supposed to come afterwards. It was freehand the last part. Do you get it how it should be?
 

keeper77

New Member
Reaction score
3
Hmm... but if they weren't in the else part, and just at the end of trigger (probably error), would it still clean up fine? (I'm curoius :D)

edit: Posted at same time for same question *woops*
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Erm, basically clear variables that you won't be using anymore. Putting it at the end of everything should work because, no matter what outcome, the variables will be cleared. But if

If/then/else
If
blah blah blah
Then
Set temppoint = ....
Create unit at temppoint
Else
set integer = .....

In this case, you can always do this

If/then/else
If
blah blah blah
Then
Set temppoint = ....
Create unit at temppoint
call RemoveLocation (udg_temppoint)
Else
set integer = .....
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Hmm... but if they weren't in the else part, and just at the end of trigger (probably error), would it still clean up fine? (I'm curoius )

No... Since bot the point variable and unit group variable get overwritten 4 * (Whatever number of players in "Teams[(Integer A)], let's say 6) and that makes it leaks 24 * 2 leaks, which is 48 leaks, - the two leaks removed in the end, so a total of 46 leaks in that trigger (Depending on the number of players in Teams[(Integer A)])

Get it ? :eek:
 

SwedishChef

New Member
Reaction score
32
No... Since bot the point variable and unit group variable get overwritten 4 * (Whatever number of players in "Teams[(Integer A)], let's say 6) and that makes it leaks 24 * 2 leaks, which is 48 leaks, - the two leaks removed in the end, so a total of 46 leaks in that trigger (Depending on the number of players in Teams[(Integer A)])

Get it ? :eek:

Ah lol so if you look at the second trigger again it still leaks right? I will post the whole trigger if you say yes so that you can check it.

E: Hoppas du är säker på detta nu.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Yes, I explained the updated trigger there (46 leaks...)

EDIT: Wait a minute...

I'll redo the trigger entirely, with not leaks:
Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Game_Mode Equal to 1
    • Then - Actions
      • Set Integer = 1
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set Integer = (Integer + (((Integer A) - 1) * 6))
          • Player Group - Pick every player in Teams[(Integer A)] and do (Actions)
            • Loop - Actions
              • Set MyUnitGroup = (Units owned by (Picked player) matching ((((Matching unit) is an illusion) Equal to False) and ((Matching unit) Equal to Hero[(Player number of (Picked player))])))
              • Set MyLocation = (Center of Team_Region[Integer])
              • Unit Group - Pick every unit in MyUnitGroup and do (Actions)
                • Loop - Actions
                  • Unit - Move (Picked unit) instantly to MyLocation, facing ArenaFacing
              • Set Integer = (Integer + 1)
              • Custom script: call RemoveLocation(udg_MyLocation)
              • Custom script: call DestroyGroup(udg_MyUnitGroup)
        • Else - Actions


This has no leaks...
 

skyblader

You're living only because it's illegal killing.
Reaction score
159
Oooops, my bad. I thought the variables were used only once.
 

SwedishChef

New Member
Reaction score
32
There updated first post so take a look, I saw that you posted a trigger Komaqtion but this new is a bit different so please check the new one.
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Code:
Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to [COLOR="Red"](Center of Team_Region[Integer])[/COLOR])
Code:
Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to [COLOR="Red"](Center of Single_Duell[(Integer A)])[/COLOR])
Code:
Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to [COLOR="Red"](Center of Single_Duell[(Integer A)])[/COLOR])
Code:
Unit Group - Pick every unit in MyUnitGroup and do (Unit - Move (Picked unit) instantly to [COLOR="Red"](Center of Arena_Region[Integer])[/COLOR])

Still leaks...

And also, I don't see you using this variable, so why destroy it ?
Trigger:
  • Custom script: call RemoveLocation(udg_MyLocation)
 

SwedishChef

New Member
Reaction score
32
Ah okey those still leaks...was kinda obvious when I think about it. Will update soon wait :p.

E: If I would remake those region variables to point variables instead and use that in the trigger it would still leak right?
 

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, if I understand you correctly, you make one variable for each (Center of (region)) used in that trigger, then it would be fine :D
You'd still leak those 4 points, but only once, and it would take some load of the CPU, because it doesn't have to reset those variables all the time...

So that would be fine ;)
 

SwedishChef

New Member
Reaction score
32
I already have this trigger. If I make the region variables and make them to point variables instead and then use them in the triggers how would this work? Would they leak one time and one time only on the init. or do I have to clean leaks everytime? Beacause if I use removelocation they will be removed right?

Trigger:
  • Arena Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Arena_String1[1] = Game mode is set to team duell, all in the teams will now fight in the arena! If you die you will lose 5 lifes and if you kill someone you will gain 5 lifes.
      • Set Arena_String1[2] = Game mode is set to elite duell. the player in every team with most lifes left fights. If the choosen player dies in the arena the whole team loses 5 lifes and if he wins whole team will gains 5 lifes.
      • Set Arena_String1[3] = Game mode is set to random duell. Random player from every team will fight in the arena. If the choosen player dies in the arena the whole team loses 5 lifes and if he wins the whole team gains 5 lifes.
      • Set Arena_String1[4] = Game mode is set to all vs. all. All players play against each other. If you die in the arena you lose 5 lifes and if you kill someone you will gain 5 lifes.
      • Set Arena_String2[1] = Fun mode is set to mine field. Mines will spawn on random spots in the arena. When they explode they blow you away and deal 20% of your current hp in damage.
      • Set Arena_String2[2] = Fun mode is set to chaos battle. Fire will blast on random places dealing damage and a circle of spikes will spin in the center.
      • Set Arena_String2[3] = Fun mode is set to random. Every time when it's time for the arena a random mode will be picked.
      • Set Arena_Region[1] = Arena Spawn Red <gen>
      • Set Arena_Region[2] = Arena Spawn Blue <gen>
      • Set Arena_Region[3] = Arena Spawn Teal <gen>
      • Set Arena_Region[4] = Arena Spawn Purple <gen>
      • Set Arena_Region[5] = Arena Spawn Yellow <gen>
      • Set Arena_Region[6] = Arena Spawn Orange <gen>
      • Set Arena_Region[7] = Arena Spawn Green <gen>
      • Set Arena_Region[8] = Arena Spawn Pink <gen>
      • Set Arena_Region[9] = Arena Spawn Gray <gen>
      • Set Arena_Region[10] = Arena Spawn Light Blue <gen>
      • Set Arena_Region[11] = Arena Spawn Dark Green <gen>
      • Set Arena_Region[12] = Arena Spawn Brown <gen>
      • Set Team_Region[1] = 1 <gen>
      • Set Team_Region[2] = 2 <gen>
      • Set Team_Region[3] = 3 <gen>
      • Set Team_Region[4] = 4 <gen>
      • Set Team_Region[5] = 5 <gen>
      • Set Team_Region[6] = 6 <gen>
      • Set Team_Region[7] = 7 <gen>
      • Set Team_Region[8] = 8 <gen>
      • Set Team_Region[9] = 9 <gen>
      • Set Team_Region[10] = 10 <gen>
      • Set Team_Region[11] = 11 <gen>
      • Set Team_Region[12] = 12 <gen>
      • Set Team_Region[13] = 13 <gen>
      • Set Team_Region[14] = 14 <gen>
      • Set Team_Region[15] = 15 <gen>
      • Set Team_Region[16] = 16 <gen>
      • Set Team_Region[17] = 17 <gen>
      • Set Team_Region[18] = 18 <gen>
      • Set Team_Region[19] = 19 <gen>
      • Set Team_Region[20] = 20 <gen>
      • Set Team_Region[21] = 21 <gen>
      • Set Team_Region[22] = 22 <gen>
      • Set Team_Region[23] = 23 <gen>
      • Set Team_Region[24] = 24 <gen>
      • Set Single_Duell[1] = Single Duell 1 <gen>
      • Set Single_Duell[2] = Single Duell 2 <gen>
      • Set Single_Duell[3] = Single Duell 3 <gen>
      • Set Single_Duell[4] = Single Duell 4 <gen>
 

Komaqtion

You can change this now in User CP.
Reaction score
469
I already have this trigger. If I make the region variables and make them to point variables instead and then use them in the triggers how would this work? Would they leak one time and one time only on the init. or do I have to clean leaks everytime? Beacause if I use removelocation they will be removed right?

Bolded part is correct ;)
 
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