Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

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.
// 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,"");
}

}

Comments

Sign In or Register to comment.