• 🏆 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!

Is this triggger working and leakless?

Status
Not open for further replies.
Level 15
Joined
Aug 11, 2009
Messages
1,606
  • Ping Victims
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Matching player) Not equal to Killer
            • Then - Actions
              • Set PingGroup = (Units owned by (Picked player))
              • Unit Group - Pick every unit in PingGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Scared Camper (Male 2)
                    • Then - Actions
                      • Cinematic - Ping minimap for (Player group(Killer)) at (Position of (Picked unit)) for 2.00 seconds
                    • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_PingGroup)
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Better?
  • Ping Victims
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Matching player) Not equal to Killer
            • Then - Actions
              • Set PingGroup = (Units owned by (Picked player))
              • Unit Group - Pick every unit in PingGroup and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of (Picked unit)) Equal to Scared Camper (Male 2)
                    • Then - Actions
                      • Set PingPoint = (Position of (Picked unit))
                      • Cinematic - Ping minimap for (Player group(Killer)) at PingPoint for 2.00 seconds
                    • Else - Actions
            • Else - Actions
      • Custom script: call DestroyGroup(udg_PingGroup)
      • Custom script: call RemoveLocation(udg_PingPoint)
By the way,thx and +rep!
 
Level 13
Joined
Jun 22, 2004
Messages
783
Now you just have to put your call of your point remover in your loop cause now your only removing the last saved variable in your loop to be removed.
if the condition pops twice equal to true, you'd still leak 1 point.
 
Level 15
Joined
Aug 11, 2009
Messages
1,606
Now you just have to put your call of your point remover in your loop cause now your only removing the last saved variable in your loop to be removed.
if the condition pops twice equal to true, you'd still leak 1 point.

I didn't quite understand this...What do you mean the condition pops twice equal to true?It is supposed to be true more than once...

I know you mean to add the custom text just below the ping action,but why?
 
Level 13
Joined
Jun 22, 2004
Messages
783
your code goes linear, which means your computer processes everything from the top to the bottom.

What a loop does, it keeps on going till its done, and then the allows the actions below it (that are outside your loop) to be executed.

so lets test your loop, lets say you have 2 players (example).

First time your loop, loops, it checks your condition, and lets say it's true, you save your point in your variable, and you ping at the variable position.
Now your loop loops for the second time, and lets say it's true again, you save a new position in that variable again, and you ping again.
Your loop ends and you remove the point.

Now what happens is that the second time you gave your variable information, it overwrote your first information, causing a point to go missing.
The second time you gave your variable information, you removed it neatly but thats just because your loop ended.

Imagine you have 12 players, and all of them conditions are true, you would have made 12 points to ping to, but only removed one.

I hope that answers your question as to why, if not, I could explain it a bit more detailed I guess.

As to question, yes you need to put the custom text call under your ping action, cause else it will not remove the point you pinged at right after you used it, but once the loop has ended.
 
Level 6
Joined
Jan 31, 2009
Messages
166
Leak

Player groups leak So you should do this insted

  • Ping Victims
    • Events
    • Conditions
    • Actions
      • Set TempPlayerGroup = (All players)
      • -------- Your existing code here exept pick every player in TempPlayerGroup rather than all players --------
      • Custom script: call DestroyForce( udg_TempPlayerGroup )
Hope that helps
 
Status
Not open for further replies.
Top