• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Finding leak in trigger

Status
Not open for further replies.
Level 8
Joined
Jul 15, 2012
Messages
143
Please help me find the leak of this trigger and also the right trigger

  • setup trap
    • Events
      • Time - Every 10.30 seconds of game time
    • Conditions
    • Actions
      • Set Unit_Groups_Copy = (Units owned by Player 1 (Red) matching (((Matching unit) is Mechanical) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Unit_Groups_Copy) Greater than 15
          • (Unit-type of Acc1) Equal to P.Shadow
        • Then - Actions
          • Set Unit_Groups = (Random 1 units from (Units in (Entire map) matching (((Owner of (Matching unit)) Equal to Player 1 (Red)) and (((Matching unit) is Mechanical) Equal to True))))
          • Unit Group - Pick every unit in Unit_Groups and do (Unit - Remove (Picked unit) from the game)
          • Game - Display to (Player group(Player 1 (Red))) the text: Maximum trap 15
          • Custom script: call DestroyGroup(udg_Unit_Groups)
          • Custom script: set udg_Unit_Groups = null
        • Else - Actions
          • Do nothing
      • Custom script: call DestroyGroup(udg_Unit_Groups_Copy)
      • Custom script: set udg_Unit_Groups_Copy = null
      • Wait 1.00 seconds
      • Set Unit_Groups_Copy = (Units owned by Player 2 (Blue) matching (((Matching unit) is Mechanical) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Unit_Groups_Copy) Greater than 15
          • (Unit-type of Acc2) Equal to P.Shadow
        • Then - Actions
          • Set Unit_Groups = (Random 1 units from (Units in (Entire map) matching (((Owner of (Matching unit)) Equal to Player 2 (Blue)) and (((Matching unit) is Mechanical) Equal to True))))
          • Unit Group - Pick every unit in Unit_Groups and do (Unit - Remove (Picked unit) from the game)
          • Game - Display to (Player group(Player 2 (Blue))) the text: Maximum trap 15
          • Custom script: call DestroyGroup(udg_Unit_Groups)
          • Custom script: set udg_Unit_Groups = null
        • Else - Actions
          • Do nothing
      • Custom script: call DestroyGroup(udg_Unit_Groups_Copy)
      • Custom script: set udg_Unit_Groups_Copy = null
 

Attachments

  • chat log.JPG
    chat log.JPG
    12.9 KB · Views: 657
Last edited by a moderator:
Level 28
Joined
Sep 26, 2009
Messages
2,520
You don't need to create the same group 2 times. Instead of the second unit group, just use this:
  • Unit - Remove (Random unit from Unit_Groups_Copy) from the game
Remove Do Nothing

You could improve your trigger by using an array called Acc (e.g. Acc[1] for player 1, Acc[2] for player 2) and integer loop.
Also, is there a need for the 1 second wait?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
you could cut this down with a for each temp int, or you may want to create a whole new trig, although I don't know what your goal is, seems to me if the player goes from 15 to 17 you only remove 1 keeping them at 16, and if they keep this up they could go as big as they want.
 
Status
Not open for further replies.
Top