• 🏆 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!

Item removed from hero and returned to the same inventory slot?

Status
Not open for further replies.
Level 2
Joined
Nov 18, 2010
Messages
7
I can't figure this one out. I want to make something like the Blink item in DotA. When you take damage the item should be replaced by another item that does nothing and has different icon and after a few seconds the real item is returned so the player can once again use the item.
The problem here is:

Hero has item in slot 3.
Hero takes damage the item is removed from slot 3
A new item is created for hero and is given to him in slot 1? (this is the problem)

How can i give the item to the hero in the same slot where the previous item was?
 
Level 2
Joined
Nov 18, 2010
Messages
7
How can i move it? I don't see an action in world editor that can manipulate with items in inventory slots :/

EDIT: OK found it :)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
JASS:
// makes a new item and adds it to the item slot (0-5) and returns sucess
native UnitAddItemToSlotById takes unit whichUnit,integer itemId,integer itemSlot returns boolean
// returns the item carried in the slot of a unit (0-5 and returns null if no item is in slot)
native UnitItemInSlot takes unit whichUnit,integer itemSlot returns item
// I forget exact use functionality, I think it drops the item in the slot (0-5) of a unit directly to the ground instantly and returns the item
native UnitRemoveItemFromSlot takes unit whichUnit,integer itemSlot returns item
// use this to move items inside a unit, get the item (one native above does this) and then drop it on the new slot you want it to have
native UnitDropItemSlot takes unit whichUnit,item whichItem,integer slot returns boolean
If GUI does not have them, complain to blizzard.
 
Status
Not open for further replies.
Top