Skip to content

DestroyObject() Question:

I have a placeable crafting bench that you can place items in and, if they're valid items for the bench, will be replaced with a different item.

The code I've pasted below works-- but it leaves a ghost image of the destroyed item behind while the inventory for the bench remains open. You can even "take" the item-- but you find that it can't be examined and it disappears upon closing and reopening your inventory.

I don't want the ghost image-- it looks sloppy. And I'd rather not force the player to close the inventory to use the bench. I'm hoping for a code solution. Any ideas?

// This script is on the onDistrubed trigger for the crafting bench.<br>// A grinder, in this case.<br>void main()<br>{<br>object oItem = GetInventoryDisturbItem();<br>string sTag = GetTag(oItem);<br>object oNew;<br><br>if(GetInventoryDisturbType()==INVENTORY_DISTURB_TYPE_REMOVED || GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_STOLEN){<br>return;<br>}<br><br>if(sTag == "someItem"){<br>ExecuteScript("grind_success_fx",OBJECT_SELF); // This is just a sound and visual effect<br>DestroyObject(oItem);<br>oNew = CreateItemOnObject("someChangedItem",OBJECT_SELF,1,"");<br>}<br><br>}

Comments

  • HimmelweissHimmelweiss Member Posts: 72
    You could add:
    SetItemStackSize(oItem, 0);

    that would atleast prevent looting the ghost item.

Sign In or Register to comment.