• 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!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

more efficient

Status
Not open for further replies.
Level 7
Joined
Aug 19, 2009
Messages
278
Which one of the two is more is more efficient of the two?

1. Checking if a unit has a particular buff or not

like

JASS:
function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
if (GetUnitAbilityLevel(GetTriggerUnit(), 'B000') > 0) then
call DisplayTextToForce( GetPlayersAll(), "ok" )
endif

or checking a unit array of 50 and checking is a unit it there or not using loop.

I heard checking unit buff is very less efficient so asking...
 
Level 7
Joined
Aug 19, 2009
Messages
278
Actually i got to do both in yes condition.

Like if unit has the buff.(yes condition)

then search in the array for the unit.

If unit doesn't has the buff.(no condition)

then don't search in the array.

And there is about 95% chance the unit won't have the buff.
 
Status
Not open for further replies.
Top