"Or" issue

Arkan

Nobody rides for free
Reaction score
92
Can't figure out how to write this in JASS, say I have this code

Code:
if(GetUnitTypeId(u)=='h002')then
set blabla=bla[1]
endif

and I want it to be either h002, h003 or h004, how would I write?

something like
Code:
if(GetUnitTypeId(u)=='h002' or 'h003' or 'h004')then
set blabla=bla[1]
endif

get my point?
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> GetUnitTypeId(u)=='h002' or 'h003' or 'h004'

That's almost usable already:
GetUnitTypeId(u)=='h002' or GetUnitTypeId(u)=='h003' or GetUnitTypeId(u)=='h004'


Slightly faster would be:
Set i = GetUnitTypeId(u)
...i == 'h002' or i == 'h003' or i == 'h004'

I.e. only once convert the unit to an id.
 
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