• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] If unit has item condition

Status
Not open for further replies.
Level 7
Joined
Jul 9, 2008
Messages
253
Hello Hiveworkshop,

I was just busy with a trigger and I was wondering if there is a non-BJ version of UnitHasItemOfTypeBJ. If there is, please let me know.

~Quetzalcotl
 
Level 7
Joined
May 13, 2011
Messages
310
I think that UnitHasItemOfType() exists. Googling "jass unithasitemoftype" yields plenty of results, so unless lots of people forgot to put BJ at the end, it should be a working function.

Copy the BJs' content into your own function and it is no longer BJ.

I don't know how that would help though. I don't think the only reason that Quetzalcotl wants a non-BJ alternative is so that he doesn't have to type the "BJ". I'm sure there is some difference in using BJ functions as opposed to non-BJ functions (although I don't yet know what it is).
 
Level 7
Joined
Jul 9, 2008
Messages
253
I appreciate the posts. I have tried UnitHasItemOfType() with the BJ but it gave an error so I guess it doesn't exist. The reason why I'd rather not use the BJ version is because I have been told that BJ's are inefficient.

~Quetzalcotl
 
Level 7
Joined
May 13, 2011
Messages
310
Hmm. It seems that UnitHasItemOfType() is a vJASS function, as you can see it's not highlighted in JASS tags:

JASS:
if UnitHasItemOfType(myUnit, myItemType) then
    //nyorgmashmorg
endif

Unlike UnitHasItemOfTypeBJ():

JASS:
if UnitHasItemOfTypeBJ(myUnit, myItemType) then
    //nyorgmashmorg
endif

If you want you can use vJASS just to do that, but if that's the only function you would compile in vJASS for, then I suggest just using UnitHasItemOfTypeBJ(), it should be fine.
 
Status
Not open for further replies.
Top