• 🏆 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] Lags when using create units

Status
Not open for further replies.
Level 2
Joined
Sep 19, 2008
Messages
24
okay, i use this trigger

Create 9 Zombie in region a
wait 2 seconds
Create 9 zombie in region b
wait 2 seconds
Create 9 zombie in region c
wait 2 seconds
etc
etc
etc
Create 9 zombie in region i

if i add it up i have created 81 units using that trigger, but the problem is everytime the trigger create units, it will heavily lag, i thought its just too many unit in the same time that's why i add the wait function, but it still lags even when they only create 9 units in one time...

can somebody fix this trigger.?
 
Level 2
Joined
Sep 19, 2008
Messages
24
i tried it several times, it seems everytime the trigger runs... maybe i have to post the trigger? (actually i know it leaks, but doesn't know which part)
 
Level 2
Joined
Sep 19, 2008
Messages
24
okay i haven't tried it yet, but actually it lags when the trigger create units, does it really the region problem?
 
yep, the system creates for that a region, and after the unit spawned, it doesn't remove it.
so after some seconds/minutes, it begins to lag, because there are a lot of regions.


  • Events
  • Your Event
  • Conditions
  • Your Conditions
  • Actions
  • set TempPoint = Center of Playable Map area
  • Unit - Create 1 Zombie for Player 1 at TempPoint facing 270
  • Custom Script - call RemoveLocation(udg_TempPoint)
 
Level 2
Joined
Sep 19, 2008
Messages
24
yep, the system creates for that a region, and after the unit spawned, it doesn't remove it.
so after some seconds/minutes, it begins to lag, because there are a lot of regions.


  • Events
  • Your Event
  • Conditions
  • Your Conditions
  • Actions
  • set TempPoint = Center of Playable Map area
  • Unit - Create 1 Zombie for Player 1 at TempPoint facing 270
  • Custom Script - call RemoveLocation(udg_TempPoint)


my trigger lags only when it create units.... hmm is there any other possibilities? but of course i will try all of this out, thanks

:thumbs_up:
 
Locations must be destroyed. But for groups and globals use
  • Actions
    • Custom script: call GroupClear(udg_VARIABLE)
to clear them, if it will be used again.

If you create a unit with
  • Actions
  • set TempPoint = Center of Playable Map area
  • Unit - Create 1 Footman for (Player 1 Red) at TempPoint facing 270 degrees
  • Custom script: call RemoveLocation(udg_TempPoint)
does it create a unit group which leak?
 
Level 2
Joined
Sep 19, 2008
Messages
24
okay maybe i just post my script here

  • Spawning Zombie
    • Events
      • Unit - A unit enters Zombie Select <gen>
    • Conditions
      • The Summoner 0054 <gen> Equal to (Entering unit)
    • Actions
      • Set SpawnPoint[0] = (Center of Spawn 1 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[0] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[0])
      • Wait 2.00 seconds
      • Set SpawnPoint[1] = (Center of Spawn 2 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[1] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[1])
      • Wait 2.00 seconds
      • Set SpawnPoint[2] = (Center of Spawn 3 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[2] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[2])
      • Wait 2.00 seconds
      • Set SpawnPoint[3] = (Center of Spawn 4 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[3] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[3])
      • Wait 2.00 seconds
      • Set SpawnPoint[4] = (Center of Spawn 5 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at (Center of Spawn 5 <gen>) facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[4])
      • Wait 2.00 seconds
      • Set SpawnPoint[5] = (Center of Spawn 7 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at (Center of Spawn 7 <gen>) facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[5])
      • Wait 2.00 seconds
      • Set SpawnPoint[6] = (Center of Spawn 8 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[6] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[6])
      • Wait 2.00 seconds
      • Set SpawnPoint[7] = (Center of Spawn 9 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[7] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[7])
      • Unit - Move (Entering unit) instantly to (Center of The Summoner Spot <gen>)
i'm curious about the point leaks.. but my trigger use region, so maybe i just have to use destroy region function?
 
Last edited:
do this:
  • Trigger
    • Events
      • Unit - A unit enters YourRect
    • Conditions
      • (Entering unit) Equal to YourUnit
    • Actions
      • Set TempPoint = (YourRect)
      • Unit - Create 9 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • Set TempPoint = (YourRect)
      • Unit - Create 9 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • Set TempPoint = (YourRect)
      • Unit - Create 9 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • Set TempPoint = (YourRect)
      • Unit - Create 9 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • etc.
The variable TempPoint is a Point variable.
Just use this, and your trigger is leakless. :D
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
It is not leaks for crying out loud causing the lag, it is the fact that WC3 sucks when having to displace 9 units which are at the same point so that they are not in each others collision radius.

I easilly can create 8 units at a time with no lag in my green circle TD, but I create each unit at a totally unique position.
However as soon as the pathing system overloads and units are not moving out fast enough, lag starts to occur.
Thus I stick with my diagnosis that it is caused by creating 9 units at the same time at the same point.
 
Level 2
Joined
Sep 19, 2008
Messages
24
Lag is caused by creating too many units at the same location.
Create all 9 of the zombies at different locations and it will not lag.

which means i better to divide the 9 zombie from 1 region to 3 zombie with 3 region right?

oh yeah this is my trigger, edited now with the destroy function (same as page 1)
  • Spawning Zombie
    • Events
      • Unit - A unit enters Zombie Select <gen>
    • Conditions
      • The Summoner 0054 <gen> Equal to (Entering unit)
    • Actions
      • Set SpawnPoint[0] = (Center of Spawn 1 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[0] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[0])
      • Wait 2.00 seconds
      • Set SpawnPoint[1] = (Center of Spawn 2 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[1] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[1])
      • Wait 2.00 seconds
      • Set SpawnPoint[2] = (Center of Spawn 3 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[2] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[2])
      • Wait 2.00 seconds
      • Set SpawnPoint[3] = (Center of Spawn 4 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[3] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[3])
      • Wait 2.00 seconds
      • Set SpawnPoint[4] = (Center of Spawn 5 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at (Center of Spawn 5 <gen>) facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[4])
      • Wait 2.00 seconds
      • Set SpawnPoint[5] = (Center of Spawn 7 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at (Center of Spawn 7 <gen>) facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[5])
      • Wait 2.00 seconds
      • Set SpawnPoint[6] = (Center of Spawn 8 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[6] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[6])
      • Wait 2.00 seconds
      • Set SpawnPoint[7] = (Center of Spawn 9 <gen>)
      • Unit - Create 9 Zombie for Player 12 (Brown) at SpawnPoint[7] facing (Position of Zombie 0031 <gen>)
      • Custom script: call RemoveLocation(udg_SpawnPoint[7])
      • Unit - Move (Entering unit) instantly to (Center of The Summoner Spot <gen>)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
no, you are better to divide the 9 zombies into 9 points. Nothing to do with regions at all. If you mean you have to use the rects as a guide system where to spawn them, then use a random point within the rect as a spawn point and spawn each at a different random point within the rect.
As it then becomes statistically impossiable for 2 points to be exactly the same, it should no longer have to displace units as much and so will not lag.

Remember to remove leaks as well, as they can also create lag if enough occur.
 
Level 2
Joined
Sep 19, 2008
Messages
24
so basically, my current trigger lags when create units because i haven't issued exact position from created unit, which cause two or more created unit have same spot when they are created right?
 
Level 2
Joined
Sep 19, 2008
Messages
24
oh yeaah... the loop function..

i just have to set the TempPoint to integer of the location right?

wait a minute, how do i use the RemoveLocation funcrion? do i have to give

SpawnPoint[0]
SpawnPoint[1]
SpawnPoint[2]
etc
etc

in the RemoveLocation script?
 
  • Spawn Zombies
    • Events
      • Unit - A unit enters YourRect
    • Conditions
      • (Entering unit) Equal to YourUnit
    • Actions
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn1
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn2
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn3
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn4
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn5
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn6
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn7
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Set TempPoint = Spawn8
          • Unit - Create 1 Zombie for Player 12 (Brown) at TempPoint facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation(udg_TempPoint)
      • Set TempPoint = Spawn7
      • Unit - Move (Entering unit) instantly to TempPoint
      • Custom script: call RemoveLocation(udg_TempPoint)
This is the trigger... (I hate it to do the same thing eight times.. xD )
 
Level 20
Joined
Oct 21, 2006
Messages
3,231
  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set SpawnPoint[1] = (Center of Region 1 <gen>)
      • Set SpawnPoint[2] = (Center of Region 2 <gen>)
      • Set SpawnPoint[3] = (Center of Region 3 <gen>)
  • Spawn
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Peon for Player 1 (Red) at SpawnPoint[(Integer A)] facing 0.00 degrees
You could check on second trigger if the point is pathable or not, if not, then set SpawnPoint[(Intger A)] = offset 50 or something. But I couldnt find this action.
 
Status
Not open for further replies.
Top