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.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top