[Trigger] My new trigger causes lag, but old one doesnt, why?

Level 8
Joined
Nov 21, 2008
Messages
318
In my original trigger, i had a problem becasue grunts would just lock on to a targeted unit, and not hit anyone in there way or any one attacking. Now that i changed the trigger to hit ppl in there path, it lags, why is this?

Old Non-laggy trigger(they never hit other people)
  • Grunt Wave
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • Set TempGroup2 = (Units in (Playable map area) matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 3)])
          • Unit - Create 1 Grunt for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack (Random unit from TempGroup2)
          • Unit - Create 1 Grunt for Player 11 (Dark Green) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack (Random unit from TempGroup2)
          • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
          • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
          • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
New Laggy trigger(Now they hit ppl in there way)
  • Grunt Wave
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching (((Owner of (Matching unit)) Equal to Player 11 (Dark Green)) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
      • Set TempGroup2 = (Units in (Playable map area) matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True))
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Spawn_Point2[1] = (Random point in SpawnRegions2[(Random integer number between 1 and 3)])
          • Unit - Create 1 Grunt for Player 12 (Brown) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To (Position of (Random unit from TempGroup2))
          • Unit - Create 1 Grunt for Player 11 (Dark Green) at Spawn_Point2[1] facing Default building facing degrees
          • Unit - Order (Last created unit) to Attack-Move To (Position of (Random unit from TempGroup2))
          • Custom script: call RemoveLocation (udg_Spawn_Point2[1])
          • Custom script: call RemoveLocation (udg_Spawn_Point2[bj_forLoopAIndex])
          • Wait 0.00 seconds
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup2)
 
Level 8
Joined
Nov 21, 2008
Messages
318
the first one is the same, but it doesnt lag, it was after i changed this

Unit - Order (Last created unit) to Attack (Random unit from TempGroup2)

to

Unit - Order (Last created unit) to Attack-Move To (Position of (Random unit from TempGroup2))

thts when the trigger ebcame differnt n made the map lag, any ideas wat part of tht makes it lag?
 
Level 13
Joined
Jun 22, 2004
Messages
783
Unit - Order (Last created unit) to Attack-Move To (Position of (Random unit from TempGroup2))
Unit - Order (Last created unit) to Attack-Move To (Position of (Random unit from TempGroup2))

these functions leak cause you use a point (position of random unit in unit group)for a certain object to go to, but do not remove it on a later point.

GUI triggers will let the editor remember each point you will create, and unless you save (so put it in an container/variable) and later on destroy it, it will become an unused mark point in the game, which it has to keep remembering itself to.
The more mark points, the more the game has to remember and the less it has left to perform your other actions, this will cause lagg and ultimately start feeding on your computers memory.
 
Top