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

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
...
..
..
..
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 18
Joined
Aug 23, 2008
Messages
2,319
Well it's obviously not a problem with the creation of units. Even creating 81 units at the same time wouldn't cause much lag.
Think of TD's. They spawn like 100 units at once and you barely notice anything of that.

I suggest you paste the original trigger here. To do so, right click on the trigger name above the Events and choose Copy As Text. Then you paste it here between trigger tags. Like this:
HTML:
[trigger]Pasted text[/trigger]

Then we can see what's actually wrong with the trigger.
 
Level 2
Joined
Sep 19, 2008
Messages
24
  • 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>)
this is my current trigger
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Is by any chance a trigger that activates when a unit enters the are Spawn 1-7? If that's the case, that trigger would activate 9 times for each create unit command you have, which might cause the lag.

PS: Please post the triggers like I mentioned above. It's a lot easier.
 
Level 2
Joined
Sep 19, 2008
Messages
24
well, i actually have that one, but it only activates 1 time, since it is only to start the spawn.. do i have to post the trigger too? since i don't think the trigger have a problem..
 
I would do it this way:

  • Trigger1
  • Events
    • Unit - A unit enters (Zombie Select <gen>)
  • Conditions
    • ((Entering unit) Equal to (Summoner 0054 <gen)
  • Actions
    • Set Point2 = (Center of (The Summoner Spot <gen>))
    • Unit - Move (Entering unit) instantly to Point2
    • Set Timer1 = (Last created timer)
    • Countdown Timer - Start Timer1 as a repeating timer that will expire in 2.00 seconds
    • Set SpawnPoint[1] = (Center of Spawn 1 <gen>)
    • Set SpawnPoint[2] = (Center of Spawn 2 <gen>)
    • Set SpawnPoint[3] = (Center of Spawn 3 <gen>)
    • Set SpawnPoint[4] = (Center of Spawn 4 <gen>)
    • Set SpawnPoint[5] = (Center of Spawn 5 <gen>)
    • Set SpawnPoint[6] = (Center of Spawn 6 <gen>)
    • Set SpawnPoint[7] = (Center of Spawn 7 <gen>)
    • Set SpawnPoint[8] = (Center of Spawn 8 <gen>)
    • Set SpawnPoint[9] = (Center of Spawn 9 <gen>)
    • Set Point1 = (Position of Zombie 0031 <gen>)
    • Custom script: call RemoveLocation (udg_Point2)
  • Trigger2
  • Events
    • Time - Timer1 expires
  • Conditions
  • Actions
    • Set Integer = ((Integer) + 1)
    • For each (Integer A) from 1 to 9, do Actions
      • Loop - Actions
        • Unit - Create 1 Zombie at SpawnPoint[Integer] facing Point1
        • Custom script: call RemoveLocation (udg_SpawnPoint[Integer])
        • If/ Then/ Else
          • If (Conditions)
            • Integer Equal to 9
          • Then (Actions)
            • Countdown Timer - Pause (Timer1)
            • Custom script: call DestroyTimer (udg_Timer1)
            • Custom script: call RemoveLocation (udg_Point1)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Its caused by making 9 units at the same time at the same physical point on the map. WC3 then tries to displace them all at once and messes up chewing huge ammounts of processor time. To fix simply do not make 2 units or more on top of each other.

I can easilly spawn 8 units multiple times a second with no lag at all as long as I do not make them ontop of already existing units.
 
Level 2
Joined
Sep 19, 2008
Messages
24
okay.. the lags is greatly reduce thanks to the loop trigger

this is my current trigger

  • Spawning Zombie
    • Events
      • Unit - A unit enters Zombie Select <gen>
    • Conditions
      • The Summoner 0054 <gen> Equal to (Entering unit)
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set SpawnPoint = (Center of Spawn 1 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 2 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 3 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 4 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 5 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 7 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 8 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Set SpawnPoint = (Center of Spawn 9 <gen>)
          • Unit - Create 1 Zombie for Player 12 (Brown) at SpawnPoint facing (Position of Zombie 0031 <gen>)
          • Custom script: call RemoveLocation(udg_SpawnPoint)
          • Wait 1.00 seconds
hmm.. i still encounter a little bit of lag, does this trigger still improvable?
 
Status
Not open for further replies.
Top