HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Problem dropping items

01-05-2004, 11:23 PM#1
SADISM
Before I describe my problem, let me describe what I was trying to achieve. I want an item that can be droppable (this is VERY important) that when dropped, seems as though it was not dropped at all. In other words, have it drop and go right back to its previous spot in inventory.

It's not as easy as UnitAddItem(GetManipulatedItem()) because this crashes WC3.

The below trigger works for any item, so long as it is added to a slot they were not dropped from. So, if I drop an item from slot 1 and create a new one in slot 2, it works. But when I drop an item from slot 1 and create a new one in slot 1, nothing appears. I am just wondering if I am doing anything wrong, or if there is some bug I don't know about. Thanks.

Code:
function Trig_Check_Item_Drop_Actions takes nothing returns nothing
    local unit u=GetManipulatingUnit()
    local integer j=GetConvertedPlayerId(GetOwningPlayer(u))-1
    local item x=GetManipulatedItem()
    if GetItemTypeId(x)=='I000' then
        call RemoveItem(x)
        call UnitAddItemToSlotById(u,'I000',4)          
    endif
endfunction
01-06-2004, 08:44 AM#2
Krakou
Add a short wait between remove and add item?
01-06-2004, 06:59 PM#3
SADISM
Yes, I used a PolledWait in another place, so I figured I would try it before adding the item, and it worked. Thanks for your response though.