So I have this trigger but immensly laggs when it happens.
Force Middle Go
Return Type: (None)
Grammar Text: Force Middle Go()
Hint Text: (None)
Custom Script Code
i = 0 <Integer>
General - For each integer i from 1 to NPlayers with increment 1, do (Actions)
Unit Group - Pick each unit in (Tech Penguin units in (Entire map) owned by player i matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Unit - Move (Picked unit) instantly to (Center of TPMid[i]) (No Blend)
Unit - Make (Picked unit) Invulnerable
Timer - Start Invulnerable Timer as a One Shot timer that will expire in Invulnerable Time Game Time seconds
I think that pathing may be an issue; or the unit selection count. How often does this trigger fire?
It is picking all units owned by each player and moving them to the center of a region, and making them invuln. It then starts a timer.
Unless you are picking many, many, units (hundreds) and they may have footprints (such as buildings) then I dont see why the trigger would cause mass lag, unless maybe it was being run 20 times at once; or NPlayers was set to some insanely high number (though i assume it is the count of active players in the game)
If you are returning many errors, it would cause lag. Have you tried testing it with the debugger open? (file, preferences, test document tab, game start up in windowed mode, checkbox on start trigger debugger, look at the "triggers" tab while this trigger runs)
When using the debugger check to see what the average execution time is.
If the units are made using triggers try using unit groups?
they appear to be faster but i could be wrong
What does the Trigger that calls this Action Definition look like perhaps the lag is from there?