• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Does this leak?

Status
Not open for further replies.
Level 8
Joined
Jan 16, 2008
Messages
156
I'm having some issues with memory leaking in my game. The newer versions of my game only added a few triggers, one was a playsound trigger, which leaked, I fixed it, but have no way of telling whether or not this fix will fix the issues until I play an extended game online with lots of players (which means releasing a new version).

So I need this trigger checked. Does it leak, if so how do I fix it Is there a better way to do this?

  • Alliance Item Point Divider
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 1 (Red) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldRedDivider = ((Player 1 (Red) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldRedDivider to (Picked player) Current gold)
          • Player - Set Player 1 (Red) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 2 (Blue) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldBlueDivider = ((Player 2 (Blue) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldBlueDivider to (Picked player) Current gold)
          • Player - Set Player 2 (Blue) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 3 (Teal) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldTealDivider = ((Player 3 (Teal) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldTealDivider to (Picked player) Current gold)
          • Player - Set Player 3 (Teal) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 4 (Purple) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldPurpleDivider = ((Player 4 (Purple) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldPurpleDivider to (Picked player) Current gold)
          • Player - Set Player 4 (Purple) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 6 (Orange) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldOrangeDivider = ((Player 6 (Orange) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldOrangeDivider to (Picked player) Current gold)
          • Player - Set Player 6 (Orange) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 7 (Green) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldGreenDivider = ((Player 7 (Green) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldGreenDivider to (Picked player) Current gold)
          • Player - Set Player 7 (Green) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 8 (Pink) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldPinkDivider = ((Player 8 (Pink) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldPinkDivider to (Picked player) Current gold)
          • Player - Set Player 8 (Pink) Current gold to 0
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player 9 (Gray) slot status) Not equal to Is playing
        • Then - Actions
          • Set GoldGrayDivider = ((Player 9 (Gray) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True)))))
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player 1 (Red)) Equal to True))) and do (Player - Add GoldGrayDivider to (Picked player) Current gold)
          • Player - Set Player 9 (Gray) Current gold to 0
        • Else - Actions
          • Do nothing
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
  • Alliance Item Point Divider
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • For each Integer A from 1 to 9 do:
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Player(Integer A) slot status) Not equal to Is playing
            • Then - Actions
              • Set tempForce = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player(Integer A)) Equal to True)))
              • Set GoldDivider = ((Player(Integer A) Current gold) / (Number of players in tempForce)
              • Player Group - Pick every player in tempForce and do (Player - Add GoldRedDivider to (Picked player) Current gold)
              • Custom script: call DestroyForce(udg_tempForce)
              • Player - Set Player(Integer A) Current gold to 0
            • Else - Actions
      • Set GoldDivider = 0
 
Level 5
Joined
May 21, 2006
Messages
174
1) Remove all "Do nothings".
2) Add "Custom script: set bj_wantDestroyGroup = true" in front of all "Pick every player" or "Pick every unit".
3) Use loops
4) Use [ trigger ] tags instead of [ code ].

  • Events
    • Time - Every 60.00 seconds of game time
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 9, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Player((Integer A))) slot status) Not equal to Is playing
          • Then - Actions
            • Set GoldRedDivider = (((Player((Integer A))) Current gold) / (Number of players in (All players matching ((((Matching player) slot status) Equal to Is playing) (((Matching player) is an ally of Player((Integer A))) Equal to True)))))
            • Custom script: set bj_wantDestroyGroup = true
            • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) is an ally of Player((Integer A))) Equal to True))) and do (Player - Add GoldGrayDivider to (Picked player) Current gold)
            • Player - Set Player((Integer A)) Current gold to 0
          • Else - Actions
I have a trigger in my map that is supposed to do something similar as well, I'll post it here just for the sake of it:
  • Set tempPlayer = (Triggering player)
  • Set tempInteger = (tempPlayer Current gold)
  • -------- ------------------------------------------------------------------------------------------------- --------
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Triggering player) is an ally of Player 7 (Green)) Equal to True
    • Then - Actions
      • For each (Integer B) from 1 to 3, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempPlayer Equal to (Player((Integer B)))
            • Then - Actions
              • Set PlayerLeft[(Integer B)] = True
            • Else - Actions
              • Player - Add (tempInteger / 2) to (Player((Integer B))) Current gold
              • Player - For tempPlayer, turn Full shared units On toward (Player((Integer B)))
    • Else - Actions
      • For each (Integer B) from 4 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempPlayer Equal to (Player((Integer B)))
            • Then - Actions
              • Set PlayerLeft[(Integer B)] = True
            • Else - Actions
              • Player - Add (tempInteger / 2) to (Player((Integer B))) Current gold
              • Player - For tempPlayer, turn Full shared units On toward (Player((Integer B)))
  • Player - Set tempPlayer Current gold to 0
 
Status
Not open for further replies.
Top