I have a placeable (representing a crafting bench) that you can place items on 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 device. I’m hoping for a code solution. Any ideas?
// This script is on the onDistrubed trigger for the crafting bench.
// A grinder, in this case.
void main()
{
object oItem = GetInventoryDisturbItem();
string sTag = GetTag(oItem);
object oNew;
if(GetInventoryDisturbType()==INVENTORY_DISTURB_TYPE_REMOVED || GetInventoryDisturbType() == INVENTORY_DISTURB_TYPE_STOLEN){
return;
}
if(sTag == “someItem”){
ExecuteScript(“grind_success_fx”,OBJECT_SELF); // This is just a sound and visual effect
DestroyObject(oItem);
oNew = CreateItemOnObject(“someChangedItem”,OBJECT_SELF,1,"");
}
}