• 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.

[Solved] Lag Eliminating Mission

Status
Not open for further replies.
Level 8
Joined
Jul 18, 2010
Messages
332
I'm gonna try to post all the most frequently running triggers in my map. Please tell me if these triggers have memory leaks or will they cause any lag?

  • camera
    • Events
      • Time - Every 0.08 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Camera - Set (Picked player)'s camera Distance to target to 2000.00 over 0.00 seconds)
these next two triggers are executed together and there are many more like this in my map.
  • dash attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Harpy Claws
      • (Unit-type of (Triggering unit)) Equal to Harpy
    • Actions
      • Unit - Make (Triggering unit) Invulnerable
      • Set harpyunit = (Triggering unit)
      • Set harpytarget = (Target point of ability being cast)
      • Set dashattacktime = 0.80
      • Unit - Hide harpyunit
      • Unit - Unhide harpyunit
      • Selection - Add harpyunit to selection for (Owner of harpyunit)
      • Animation - Play harpyunit's attack animation
      • Trigger - Turn on dash attack 2 Copy <gen>
      • Hashtable - Save dashattacktime as 1 of (Key (Triggering unit)) in dashattackhashtable
      • Unit Group - Add (Triggering unit) to dashattackgroup
  • dash attack 2 Copy
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in dashattackgroup and do (Actions)
        • Loop - Actions
          • Set dashattacktime = (Load 1 of (Key (Picked unit)) from dashattackhashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • dashattacktime Greater than 0.00
            • Then - Actions
              • Set harpyunit = (Picked unit)
              • Set harpypoint = (Position of harpyunit)
              • Set harpypoint2 = (harpypoint offset by 28.00 towards (Facing of harpyunit) degrees)
              • Special Effect - Create a special effect attached to the origin of harpyunit using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Move harpyunit instantly to harpypoint2, facing (Facing of harpyunit) degrees
              • Set harpytargetz = (Units within 175.00 of harpypoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an ally of (Owner of harpyunit)) Equal to False) and ((((Matching unit) is dead) E
              • Unit Group - Pick every unit in harpytargetz and do (Actions)
                • Loop - Actions
                  • If ((Unit-type of harpyunit) Equal to Harpy) then do (Unit - Cause harpyunit to damage (Picked unit), dealing 37.50 damage of attack type Chaos and damage type Normal) else do (Do nothing)
              • Custom script: call RemoveLocation(udg_harpypoint)
              • Custom script: call RemoveLocation(udg_harpypoint2)
              • Custom script: call DestroyGroup (udg_harpytargetz)
              • Hashtable - Save (dashattacktime - 0.03) as 1 of (Key (Picked unit)) in dashattackhashtable
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in dashattackhashtable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • dashattacktime Equal to 0.00
            • Then - Actions
              • Animation - Reset (Picked unit)'s animation
              • Unit - Make (Picked unit) Vulnerable
              • Custom script: call RemoveLocation (udg_harpytarget)
              • Unit Group - Remove (Picked unit) from dashattackgroup
            • Else - Actions
Really need help on this one because i've already finished my map, only problem is that it still lags. A slight lag occurs after 20 - 30 min of game time in my map. Then it gets worse every after 20 - 30 min. So I need an expert on this one who could help me quickly.
This is my map if someone wants to check it out. There are a tons of variables and triggers there which is definitely gonna give you a headache. But I suggest if you're going to look at it, just check out the ones with periodic events.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Unit - Make (Triggering unit) Invulnerable
  • Set harpyunit = (Triggering unit)
Should ve reversed
  • Set harpyunit = (Triggering unit)
  • Unit - Make harpyunit Invulnerable
  • Unit Group - Add harpyunit to dashattackgroup
I can't see any "Turn off dash attack 2 copy" if the group is empty.

Besides that, I don't see any leak or major lag cause
 
Level 8
Joined
Jul 18, 2010
Messages
332
thank you for the response, but is the camera trigger above leaks? If yes, how would I fix this?

Here's another trigger that runs most frequently in my map, please tell me if there are problems in it.
This one is how i trigger the enemy units to use spells that's why it's too long so don't bother to read it all and the
other one below is my enemy unit spawning trigger which checks if there are already few units in the map every 30 seconds.
  • ai command
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Set dungeongroup = (Units in (Entire map) owned by Neutral Hostile)
      • Unit Group - Pick every unit in dungeongroup and do (Actions)
        • Loop - Actions
          • Set neutralpoint = (Position of (Picked unit))
          • Set dungeongroup_Copy_9 = (Units within 1250.00 of neutralpoint matching ((((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((Owner of (Matching unit
          • Set dungeongroup_Copy_10 = (Units within 950.00 of neutralpoint matching ((((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((Owner of (Matching unit)
          • Set dungeongroup_Copy_11 = (Units within 800.00 of neutralpoint matching ((((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((Owner of (Matching unit)
          • Set dungeongroup_Copy_12 = (Units within 1250.00 of neutralpoint matching ((((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((Owner of (Matching unit
          • Set dungeongroup_Copy_15 = (Units within 1500.00 of neutralpoint matching ((((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((Owner of (Matching unit
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and (((Picked unit) is A town-hall-type unit) Equal to True)
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is A town-hall-type unit) Equal to True))
              • (Number of units in dungeongroup_Copy_10) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_10))
              • Unit - Order (Picked unit) to Undead Crypt Lord - Impale neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and (((Picked unit) is Undead) Equal to True)
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Undead) Equal to True))
              • (Number of units in dungeongroup_Copy_11) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - War Stomp
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and (((Picked unit) is Mechanical) Equal to True)
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Mechanical) Equal to True))
              • (Number of units in dungeongroup_Copy_9) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_9))
              • Unit - Order (Picked unit) to Undead Dreadlord - Carrion Swarm neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and (((Picked unit) is Summoned) Equal to True)
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Summoned) Equal to True))
              • (Number of units in dungeongroup_Copy_11) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_11))
              • Unit - Order (Picked unit) to Orc Tauren Chieftain - Shockwave neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Undead) Equal to True)
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Undead) Equal to True))
              • (Number of units in dungeongroup_Copy_9) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_9))
              • Unit - Order (Picked unit) to Neutral Tinker - Cluster Rockets neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Mechanical) Equal to True)
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Mechanical) Equal to True))
              • (Number of units in dungeongroup_Copy_9) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_9))
              • Unit - Order (Picked unit) to Human Archmage - Blizzard neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Summoned) Equal to True)
                  • (((Picked unit) is A town-hall-type unit) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Summoned) Equal to True))
              • (Number of units in dungeongroup_Copy_10) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Far Seer - Chain Lightning (Random unit from dungeongroup_Copy_10)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is Mechanical) Equal to True) and (((Picked unit) is Undead) Equal to True)
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Undead) Equal to True))
              • (Number of units in dungeongroup_Copy_11) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Human Mountain King - Thunder Clap
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is Summoned) Equal to True) and (((Picked unit) is Undead) Equal to True)
                  • (((Picked unit) is Summoned) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and (((Picked unit) is Undead) Equal to True))
              • (Number of units in dungeongroup_Copy_11) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Blademaster - Bladestorm
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Mechanical) Equal to True))
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Mechanical) Equal to True)))
              • (Number of units in dungeongroup_Copy_11) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Special Rexxar - Battle Roar
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Undead) Equal to True))
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Undead) Equal to True)))
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_12))
              • Unit - Order (Picked unit) to Neutral Dark Ranger - Silence neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Summoned) Equal to True))
                  • (((Picked unit) is A sapper) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Summoned) Equal to True)))
              • (Number of units in dungeongroup_Copy_15) Greater than or equal to 1
            • Then - Actions
              • Set neutraltarget = (Position of (Random unit from dungeongroup_Copy_15))
              • Unit - Order (Picked unit) to Night Elf Warden - Blink neutraltarget
              • Custom script: call RemoveLocation(udg_neutraltarget)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Undead) Equal to True))
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Undead) Equal to True)))
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Human Priest - Inner Fire (Random unit from dungeongroup_Copy_12)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Summoned) Equal to True))
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is A town-hall-type unit) Equal to True) and (((Picked unit) is Summoned) Equal to True)))
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Far Seer - Feral Spirit
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Fanatic Leader
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Shadow Hunter - Healing Wave (Random unit from dungeongroup_Copy_12)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Cursed Cairn Stones
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Night Elf Demon Hunter - Mana Burn (Random unit from dungeongroup_Copy_12)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is Undead) Equal to True) and (((Picked unit) is Summoned) Equal to True))
                  • (((Picked unit) is Mechanical) Equal to True) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is Undead) Equal to True) and (((Picked unit) is Summoned) Equal to True)))
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Human Paladin - Resurrection
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Lord Perseo
              • (Number of units in dungeongroup_Copy_15) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Undead Death Knight - Death Pact (Random unit from dungeongroup_Copy_12)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((((Picked unit) is A sapper) Equal to True) and (((Picked unit) is Mechanical) Equal to True)) and ((((Picked unit) is Undead) Equal to True) and (((Picked unit) is Summoned) Equal to True))
                  • ((((Picked unit) is A sapper) Equal to True) and (((Picked unit) is Mechanical) Equal to True)) and ((((Picked unit) is An Ancient) Equal to True) and ((((Picked unit) is Undead) Equal to True) and (((Picked unit) is Summoned) Equal to True)))
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Orc Troll Berserker - Berserk
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Wooden
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Night Elf Keeper Of The Grove - Tranquility
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Thanatos (Release Form)
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Night Elf Priestess Of The Moon - Starfall
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Picked unit)) Equal to Nemophila
              • (Number of units in dungeongroup_Copy_12) Greater than or equal to 1
            • Then - Actions
              • Unit - Order (Picked unit) to Human Mountain King - Storm Bolt (Random unit from dungeongroup_Copy_12)
            • Else - Actions
          • Custom script: call RemoveLocation(udg_neutraltarget)
          • Custom script: call RemoveLocation(udg_neutralpoint)
          • Custom script: call RemoveLocation(udg_neutralpoint_Copy)
          • Custom script: call DestroyGroup(udg_dungeongroup_Copy_9)
          • Custom script: call DestroyGroup(udg_dungeongroup_Copy_10)
          • Custom script: call DestroyGroup(udg_dungeongroup_Copy_11)
          • Custom script: call DestroyGroup(udg_dungeongroup_Copy_12)
          • Custom script: call DestroyGroup(udg_dungeongroup_Copy_15)
      • Custom script: call DestroyGroup(udg_dungeongroup)
  • outer wall of serdin
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Set dungeongroup_Copy = (Units in Region 001 <gen> matching (((Unit-type of (Matching unit)) Equal to Goblin) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • Set dungeongroup_Copy_2 = (Units in Region 004 <gen> matching (((Unit-type of (Matching unit)) Equal to Goblin) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • Set dungeongroup_Copy_3 = (Units in Region 001 <gen> matching (((Unit-type of (Matching unit)) Equal to Stone Goblin) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • Set dungeongroup_Copy_4 = (Units in Region 004 <gen> matching (((Unit-type of (Matching unit)) Equal to Stone Goblin) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • Set dungeongroup_Copy_5 = (Units in Region 001 <gen> matching (((Unit-type of (Matching unit)) Equal to Orc) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • Set dungeongroup_Copy_6 = (Units in Region 004 <gen> matching (((Unit-type of (Matching unit)) Equal to Orc) and ((Owner of (Matching unit)) Equal to Neutral Hostile)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy) Less than or equal to 3
        • Then - Actions
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy_2) Less than or equal to 3
        • Then - Actions
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy_3) Less than or equal to 2
        • Then - Actions
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy_4) Less than or equal to 2
        • Then - Actions
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Stone Goblin for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy_5) Less than or equal to 1
        • Then - Actions
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Orc for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
          • Set Region1 = (Random point in Region 001 <gen>)
          • Unit - Create 1 Orc for Neutral Hostile at Region1 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region1)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in dungeongroup_Copy_6) Less than or equal to 1
        • Then - Actions
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Orc for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
          • Set Region4 = (Random point in Region 004 <gen>)
          • Unit - Create 1 Orc for Neutral Hostile at Region4 facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_Region4)
        • Else - Actions
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy)
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy_2)
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy_3)
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy_4)
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy_5)
      • Custom script: call DestroyGroup(udg_dungeongroup_Copy_6)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No, camera Trigger doesn't leak.

One tip: Try to reduce your parentheses as much as possible. Each pair represents a function or data calling.

If you create the variable (Picked Unit) and use that variable on each function where you need to do something with the (Picked Unit) The system will already know which unit you wan't to manipulate, insead to looking over and over for the same (Picked Unit) So...

Create a "TempUnit" variable, set it in the beginning of the loop (Set TUnit = Picked Unit) and replace all the (Picked unit) inside the loop with (TUnit). The lag reduction will be noticeable.

  • Set Region1 = (Random point in Region 001 <gen>)
  • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Region1)
  • Set Region1 = (Random point in Region 001 <gen>)
  • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Region1)
  • Set Region1 = (Random point in Region 001 <gen>)
  • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Region1)
  • Set Region1 = (Random point in Region 001 <gen>)
  • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Region1)
  • Set Region1 = (Random point in Region 001 <gen>)
  • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
  • Custom script: call RemoveLocation(udg_Region1)
It's the same than
  • For each Integer A from 1 to 5 do (Actions):
    • Loop - Actions
      • Set Region1 = (Random point in Region 001 <gen>)
      • Unit - Create 1 Goblin for Neutral Hostile at Region1 facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Region1)
but, by far, less eficcient.
 
Status
Not open for further replies.
Top