- Joined
- Jul 10, 2013
- Messages
- 73
Can you guys please help me figure out why my map is lagging?
Thank you!
Thank you!
Those microseconds must really count! To think I have probably wasted more time writing this message and everyone who will ever play the map's computers would compiling that extra script...for this small trigger that don't seems much, but in your map it accumulates to a large amount of wasted space and loading time !
To deal with this one could move away from an attack based anti TK system to an order based one. One can cancel out attack orders targeting team mates using a stop order issued after a 0 timeout delay. Orders are generally infrequent compared with units attacks which can be as high as 50 per second for a single unit in extreme circumstances.-> The anti-TeamKill system does a lot of stress to the map. Everything that attacks something else ask quite a lot of conditions at once, so that may slow down the map.
function CountLivingPlayerUnitsOfTypeId takes integer unitId,player whichPlayer returns integer
local group g
local integer matchedCount
set g = CreateGroup()
set bj_livingPlayerUnitsTypeId = unitId
call GroupEnumUnitsOfPlayer(g, whichPlayer, filterLivingPlayerUnitsOfTypeId)
set matchedCount = CountUnitsInGroup(g)
call DestroyGroup(g)
return matchedCount
endfunction