HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Removing Items from gameplay?

03-01-2004, 01:40 AM#1
Narwanza
This is in JASS, I tried using
Code:
call RemoveItem(MyItemVar)
but it didn't work. They dropped from hero but were still on the ground. Is there any way to remove them completly?
03-01-2004, 01:47 AM#2
weaaddar
Um that command should remove the item completely.
are you sure your not mistaking it for its verily simmilar cousin
UnitRemoveItem(unit,item)?
03-01-2004, 01:54 AM#3
Narwanza
Positive. Is this one of those things that needs a small wait before it can be removed. Here is a sample of my code.

Code:
		set currentItems[1] = UnitItemInSlot(who,itemslot[1])
		call UnitRemoveItem(who,currentItems[1])
		call RemoveItem(GetLastRemovedItem())

It just lets the item sit there sparkling on the ground.
03-01-2004, 01:59 AM#4
ThyFlame
Add a wait and see. I know in triggers you must have a small wait between losing and item and moving it, this may be the same concept.
03-01-2004, 02:03 AM#5
Narwanza
While on the concept of items, this little bit doesn't seem to be working either.

Code:
		call UnitAddItemById(who,'kysn')
		set fluffItems[x] = GetLastCreatedItem()

It doesn't seem to be setting the fluffItems[x] = to anything.

[edit]oh and BTW, the wait didn't help at all.
03-02-2004, 12:56 AM#6
weaaddar
Bleh, I know your problem its because you expect too much.
Code:
   set currentItems[1] = UnitItemInSlot(who,itemslot[1])
   call UnitRemoveItem(who,currentItems[1])
   call RemoveItem(GetLastRemovedItem())
GetLastRemovedItem() is a bj fluff function. It expects you to set bj_LastRemovedItem to that. UnitRemoveItemBJ or whatever removes the item and sets it.

Anyway heres a quick solution for you I don't know why your doing it so hard but here goes.
Code:
call RemoveItem( UnitItemInSlot(who,itemslot[1]) )
You don't have to remove it from his inventory to destroy it.

Also for the same reason:
Code:
call UnitAddItemById(who,'kysn')
set fluffItems[x] = GetLastCreatedItem()
This doesn't work because your not using hte function (bj one) it wants.
Since jass like most programming language is actually somewhat intelligent all you have to do is combine these two steps into one.
Code:
set fluffItems[x] = UnitAddItemById(who,'kysn')