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

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

Status
Not open for further replies.
Level 8
Joined
Nov 21, 2008
Messages
316
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
316
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.
 
Status
Not open for further replies.
Top