• 🏆 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] UnitAddItemById bug?

Status
Not open for further replies.
Level 6
Joined
Oct 23, 2011
Messages
182
hello

I've found this really, really weird glitch with UnitAddItemById.
When it is used in conjunction with RemoveItem() [using some kind of item with same abilities], the item's ability somehow binds to buying unit so that whenever the unit is using an item, the binded ability activates too. For instance, if a scroll of haste is binded this way, a unit with inventory full of healing potions will activate scroll of haste on using each potion (the unit does not have scroll of haste, neither does it have the ability) Anyone know why this is happening and any solution to it
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
I don't get it...

What does "UnitAddItemById()" has to do with "RemoveItem()" thing? You add items, and you remove items.

With "conjunction" do you mean something like "RemoveItem(UnitAddItemById(x))"?
 
Level 6
Joined
Oct 23, 2011
Messages
182
Test map attached. What I meant by conjunction is using UnitAddItemById() after calling RemoveItem() on some other item. Probably one of the weirdest bugs I've seen in 5 years of editing.

To recreate the bug, simply buy Beast Scroll and Heal Scroll from shop, then use Heal Scroll after using Beast Scroll. Rinse and repeat. You'll start activating 'non-existent' items out of the blue. They even stack, so you'll probably start lagging after 50 cycles. There's absolutely no code involved in actually using the items.

I couldn't solidify my thesis, but here's mine:
Assume Item A and Item B has same item abilities, and are consumables.
When Item A is removed from a unit, and Item B is added simultaneously, Item A will bind to unit as an invisible item, not taking up any inventory space. Whenver an item is used from slot other than the 'invisible' Item A's slot, Item A will automatically activate (and continue to activate on every single item use)
 

Attachments

  • test2.w3x
    15.6 KB · Views: 30
Last edited:
Level 6
Joined
Oct 23, 2011
Messages
182
~.~

Known issue.

Do you know any big threads with weird issues like this listed?

I think I've found more weird issues like this: if any unit on map has a channel-based ability with a modified orderid, then that orderid CANNOT be issued to other units alive on the map via trigger (as long as the original unit with that channel-based ability is alive), giving a spellbook ability to unit with hp upgrade kills it immediately, etc.
 
Last edited:
Level 26
Joined
Aug 18, 2009
Messages
4,097
It's not really weird. The item is being handled by the engine when the event occurs. Items always bind their abilities to the unit and take it away when dropped. Blizzard just did not expect the item going missing on this access point, therefore failed to insert checks and cleanup. I do not know of such list.
 
Yeah, that's pretty logical since you remove an item by the time you create it so it's bound to produce some bugs...

if any unit on map has a channel-based ability with a modified orderid, then that orderid CANNOT be issued to other units alive on the map via trigger (as long as the original unit with that channel-based ability is alive)

That's weird, I don't have that same problem with Channel...
 
Status
Not open for further replies.
Top