• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

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