HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

UnitAddItemToSlotById

07-24-2004, 12:21 PM#1
Arkmage
hI,

having troubles with the UnitAddItemToSlotById(unit, itemid, slotnumber) function. My assumptions was that it would add the item to a particular slot in a units inventory. However it 'drops' the item at the location of the hero. Is my assumption incorrect? or have i done something wrong?

Cheers
Archmage
07-24-2004, 01:35 PM#2
Alfryd
Quote:
Originally Posted by Arkmage
hI,

having troubles with the UnitAddItemToSlotById(unit, itemid, slotnumber) function. My assumptions was that it would add the item to a particular slot in a units inventory. However it 'drops' the item at the location of the hero. Is my assumption incorrect? or have i done something wrong?

Cheers
Archmage

Strange. It should work fine as long as the unit in question has the Hero Inventory ability. Is the hero's inventory already full?
07-24-2004, 02:38 PM#3
Arkmage
hmmm, what if the Hero has Unit Inventory ability? Which i have done to temporary 'disable' items in the hero inventory.

Cheers
Archmage
07-24-2004, 11:25 PM#4
Alfryd
Quote:
Originally Posted by Arkmage
hmmm, what if the Hero has Unit Inventory ability? Which i have done to temporary 'disable' items in the hero inventory.

Cheers
Archmage

I couldn't say, as I haven't made that substitution myself. One problem that springs to mind is that you might not be able to assign items beyond the first two slots. Have you adjusted that field of the unit inventory data?
Failing this, try creating the item elsewhere, then giving it to the hero immediately after. This is something you'll probably just have to experiment with. Sometimes, blizzard functions don't do exactly what they say on the tin.
07-25-2004, 03:43 AM#5
Arkmage
LOL, i finnally figure it out!!! My code was perfect and was working. the problem was that a older obselete trigger was enable as well...the two triggers were conflicting with each other since they rely on the same event and affected the same area. Once i deleted the order trigger, everything was fine.

Actually Alfryd, i created a 6 slot unit inventory to minic the hero inventory. The only thing i don't like about the code is that it destroys the item when it is dropped and then creates the item in the same slot position after the inventory change. The reasons is that i read somewhere that destroy too much items is a no no....o well.

Cheers
Archmage