Periodic Group usage

Arkan

Nobody rides for free
Reaction score
92
I was wondering, which method is best/fastest?

#1
JASS:
function ThisFunctionRunsEverySecond takes nothing returns nothing
  local group g = CreateGroup()
  call GroupEnumUnitsInRange(g,x,y,400,Safe)
  // actions
  call DestroyGroup(g)
  set g = null
endfunction


#2
JASS:
scope something
globals
  private group G = CreateGroup()
endglobals

function ThisFunctionRunsEverySecond takes nothing returns nothing
  call GroupEnumUnitsInRange(G,x,y,400,Safe)
  // actions
  call GroupClear(G)
endfunction


I think #2 would be better, but I could be wrong, what do you think?
 

Artificial

Without Intelligence
Reaction score
326
One group > Recycling groups > Destroying groups.
That's what I've heard. ^_^ So 2 should be better.
 

saw792

Is known to say things. That is all.
Reaction score
280
I would say that #2 is faster, because it only requires CreateGroup() to be called once, while it is called every second in #1. You're hardly going to notice the difference though.
 
Reaction score
333

Arkan

Nobody rides for free
Reaction score
92
Interesting, though that would create many additional functions.
 

Tukki

is Skeleton Pirate.
Reaction score
29
Yeah, but it's more efficient. Another one could be that you use a Condition instead of a function to enum the units. As Conditions are evaluated before the actions are executed.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top