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!
That's probably because you are looping through all the units on the map every 0.10 seconds, applying conditions, and ordering them to target an item - all of them (that match). So it would not surprise me if it lagged.
Remember, you can manually manage your Unit Groups. It's far easier for the game to process this in multiple steps spread over time:
Events
Unit - A unit Enters playable map area
Conditions
(Owner of (Triggering unit)) Equal to Player 21 (Coal)
Actions
Unit Group - Add (Triggering unit) to Player_Units[21]
^ Or better yet use an Event that's more specific to your situation -> "A unit is Trained/Summoned" or Add them after you Create them with triggers.
Events
Unit - A unit Dies
Conditions
(Owner of (Triggering unit)) Equal to Player 21 (Coal)
Actions
Unit Group - Removes (Triggering unit) from Player_Units[21]
^ We're now doing things in a way that is Event based which is great since it removes the random time element from it. You now know PRECISELY when Player 21 has run out of units which is quite useful. You could even throw in an Integer variable to track the number of these Units so you can display them in a Multiboard or whatever -> "Number of enemies remaining".
Constantly rebuilding the Unit Group over and over again is often unnecessary, inefficient, and just bad triggering practice.
Plus, you can probably narrow it down even further like Pyro suggested. I doubt that you actually need to order ALL of those Units to get the Meat. How about just certain types? Or how about just ordering X amount of them from the Unit Group where X is the number of Meat. There's always optimizations that can be made.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.