• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Trigger] Increasing lagg problem.

Status
Not open for further replies.
Level 6
Joined
May 31, 2008
Messages
218
Lagg problems(cause of it)

I have tried my map just for fun a few times now, but all the test i have made i have been experiencing an increasing lagg after some time, maybe 30-40 min or more, that is where the lagg get's anoying. I also tried to just start map and let it run without me doing anything. And i got the same lagg that time aswell.

These 3 almost identical triggers might be the problem but i'm not sure, and therefore i ask you.
I checked the amounts of time these triggers are run after 30 minutes, and that is 10800 times if i'm not wrong. They are run each 0.5 sec, and all 3 triggers are checked at that interval, so then i have 6 runs each second, 360 each minute and 10800 times after 30 minutes.

  • Gold
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[0] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[0] and do (Actions)
        • Loop - Actions
          • Set income_done[0] = (Position of (Picked unit))
          • Set gold_horse[0] = (Units within 100.00 of income_done[0] matching ((Unit-type of (Matching unit)) Equal to Gold Horse))
          • Unit Group - Pick every unit in gold_horse[0] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of gold_horse[0] from gold_horse[0]
              • Custom script: call DestroyGroup (udg_gold_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[0])
              • Player - Add 10 to (Owner of (Picked unit)) Current gold
          • Unit Group - Remove all units of regional_capitol[0] from regional_capitol[0]
          • Custom script: call DestroyGroup (udg_regional_capitol[0])
The second 2 triggers are almost identical to the first one, but i post them anyway.

  • Food
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[1] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[1] and do (Actions)
        • Loop - Actions
          • Set income_done[1] = (Position of (Picked unit))
          • Set Food_horse[0] = (Units within 100.00 of income_done[1] matching ((Unit-type of (Matching unit)) Equal to Food Horse))
          • Unit Group - Pick every unit in Food_horse[0] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of Food_horse[0] from Food_horse[0]
              • If (((Owner of (Picked unit)) Food cap) Equal to 20) then do (Do nothing) else do (Player - Add 1 to (Owner of (Picked unit)) Food cap)
              • Custom script: call DestroyGroup (udg_Food_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[1])
          • Unit Group - Remove all units of regional_capitol[1] from regional_capitol[1]
          • Custom script: call DestroyGroup (udg_regional_capitol[1])
  • Wood
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[2] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[2] and do (Actions)
        • Loop - Actions
          • Set income_done[2] = (Position of (Picked unit))
          • Set Wood_horse[0] = (Units within 100.00 of income_done[2] matching ((Unit-type of (Matching unit)) Equal to Wood Horse))
          • Unit Group - Pick every unit in Wood_horse[0] and do (Actions)
            • Loop - Actions
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of Wood_horse[0] from Wood_horse[0]
              • Custom script: call DestroyGroup (udg_Wood_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[2])
              • Player - Add 10 to (Owner of (Picked unit)) Current lumber
          • Unit Group - Remove all units of regional_capitol[2] from regional_capitol[2]
          • Custom script: call DestroyGroup (udg_regional_capitol[2])
 
Last edited:
Level 20
Joined
Jan 6, 2008
Messages
2,627
  • Gold
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[0] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[0] and do (Actions)
        • Loop - Actions
          • Set gold_horse[0] = (Units within 100.00 of income_done[0] matching ((Unit-type of (Matching unit)) Equal to Gold Horse))
          • Unit Group - Pick every unit in gold_horse[0] and do (Actions)
            • Loop - Actions
              • Set income_done[0] = (Position of (Picked unit))
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of gold_horse[0] from gold_horse[0]
              • Custom script: call DestroyGroup (udg_gold_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[0])
              • Player - Add 10 to (Owner of (Picked unit)) Current gold
          • Unit Group - Remove all units of regional_capitol[0] from regional_capitol[0]
          • Custom script: call DestroyGroup (udg_regional_capitol[0])
The second 2 triggers are almost identical to the first one, but i post them anyway.

  • Food
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[1] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[1] and do (Actions)
        • Loop - Actions
          • Set Food_horse[0] = (Units within 100.00 of income_done[1] matching ((Unit-type of (Matching unit)) Equal to Food Horse))
          • Unit Group - Pick every unit in Food_horse[0] and do (Actions)
            • Loop - Actions
              • Set income_done[1] = (Position of (Picked unit))
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of Food_horse[0] from Food_horse[0]
              • If (((Owner of (Picked unit)) Food cap) Equal to 20) then do (Do nothing) else do (Player - Add 1 to (Owner of (Picked unit)) Food cap)
              • Custom script: call DestroyGroup (udg_Food_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[1])
          • Unit Group - Remove all units of regional_capitol[1] from regional_capitol[1]
          • Custom script: call DestroyGroup (udg_regional_capitol[1])
  • Wood
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Set regional_capitol[2] = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Region capitol))
      • Unit Group - Pick every unit in regional_capitol[2] and do (Actions)
        • Loop - Actions
          • Set Wood_horse[0] = (Units within 100.00 of income_done[2] matching ((Unit-type of (Matching unit)) Equal to Wood Horse))
          • Unit Group - Pick every unit in Wood_horse[0] and do (Actions)
            • Loop - Actions
              • Set income_done[2] = (Position of (Picked unit))
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove all units of Wood_horse[0] from Wood_horse[0]
              • Custom script: call DestroyGroup (udg_Wood_horse[0])
              • Custom script: call RemoveLocation (udg_income_done[2])
              • Player - Add 10 to (Owner of (Picked unit)) Current lumber
          • Unit Group - Remove all units of regional_capitol[2] from regional_capitol[2]
          • Custom script: call DestroyGroup (udg_regional_capitol[2])


There
 
Level 20
Joined
Jan 6, 2008
Messages
2,627
It will reduce lag, since you destroy the location several times, so the next stuff will not happen, so the Units in the Unit group will only work on 1 unit, so if he got 2 and you destroy it withouth the variable in the Loop, it will only add 10.
 
Level 6
Joined
May 31, 2008
Messages
218
But i obviously gotta change the variables then? since i don't need the position determined inside the loop.
Or can i redo this trigger completly by placing rects around the map underneath the regional income points units. And then just make it so once the enter that rect, instead of near the regional income unit?
 
Level 20
Joined
Jan 6, 2008
Messages
2,627
just simply put the set variable Income_Done inside the loop, or place the Custom scripts outside, its much easier, and much lagless if you just put the variable in the loop, since if it gets destroyed in the loop, it will only work ONCE, since if you got 3 bananas, and your ordered to pick all the bananas in the group and sell them, but you made the bananas way before you need to pick all, so you give a banana, and then deletes all bananas in your group, you will only sell one, but if you got a unit group that makes an action for every banana, they will set 1 banana, in that position, sell it, destroy the ONE banana, set another banana since there are 3, in ANOTHER position, sell it, destroy the one, Your action will only work for one, just move the Income_Done under the "Loop Actions" so all your actions happen
 
Level 6
Joined
May 31, 2008
Messages
218
But i still gotta change the variables slightly, since now the trigger dosen't work considering the income done variable is looking for a position that i don't need. But i get what you mean. But i still wonder if the lagg would decrease if i would do the other alternative, that i place a rect underneath the units that look for horses in range. So instead i will just have to run the trigger once a unit enter the rect.
 
Level 6
Joined
May 31, 2008
Messages
218
I hope you can just use the trigger parts, i pasted the triggers into a new map, cause the whole map is so big.
 

Attachments

  • skickad för hjälp.w3x
    18 KB · Views: 41
Status
Not open for further replies.
Top