www.sc2modding.info, www.wc3modding.info and www.wc3jass.com are now part of Blizzard Modding Network. You can check them out using their respective links
The first thing is to start using some libraries to speed up your code, the first one is an indexing library like ALLOC: http://blizzardmodding.info/5012/snippet-allocloop-aka-alloc-2/With this one the allocation of things would be dramatically increased. And it works because it's slower to create/destroy handles than reusing it.
Let's start with timers:Code: jass [Select] function RunThis takes nothing returns nothing // code here. The timer hancle can be managed in this function to destroy or pause... endfunction function InitTrig_test takes nothing returns nothing call TimerStart(CreateTimer(),0.25,true,function RunThis) // with this you save a variable assignation... endfunctionUsing periodic triggers is a BIG no no. triggers are not recyclable as timers. And for time recycling there's a tool called timerutils.
About Unit grouping, the fastest way is the one you posted:Code: jass [Select] function GroupExec takes nothing returns nothing // As you can see, I use an already created group, a bj one in order to make it faster in use, and you don't need to destroy it, it's cleaned up by the same loop... local unit c = GetTriggerUnit() local real x = GetUnitX(c) local real y = GetUnitY(c) local unit temp call GroupEnumUnitsInRange(bj_lastCreatedGroup,x,y,300,null) loop set temp = FirstOfGroup(bj_lastCreatedGroup) exitwhen temp == null if IsUnitEnemy(temp,GetOwningPlayer(c)) then //execute each valid unit endif call GroupRemoveUnit(bj_lastCreatedGroup,temp) endloop set c = null endfunction
Page created in 0.795 seconds with 34 queries.