Neverwinter Nights: Enhanced Edition

Neverwinter Nights: Enhanced Edition

Adventures await!
Gather your mods before venturing forth. Discover planes filled with player-created adventures in Steam Workshop, then build your own Neverwinter Nights modules using the Aurora Toolset to share!
Learn More
DestroyObject() Question:
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,"");
}

}
Last edited by claiminglight; 29 Jan, 2019 @ 3:18pm
< >
Showing 1-5 of 5 comments
wendigo211 3 29 Jan, 2019 @ 8:33pm 
I'm not infromt of the toolset right now, I'll take a look in the morning, but it looks like a UI issue to me. You can probably have the script close and open the inventory for the user when it creates the new item. That should fix the problem, but it might not be the most elegant solution.
claiminglight 29 Jan, 2019 @ 8:38pm 
Yeah, that *does* work, but you're right, it isn't the most elegant way around it and I'd probably go for a "lever-based" solution at that point.

Interestingly, the ghost vanishes if you try to change the inventory page on the placeable, even if there isn't another page. So literally any kind of refresh will do it.

Thanks for taking an interest!
Try asking devs if it's a bug
wendigo211 3 30 Jan, 2019 @ 5:23am 
I tried fading to/from black and jumping the item to be destroyed to another container. Neither got rid of the ghost image. Interestingly, when I jumped the item to another container, if I added the ghost object to my inventory, it removed the item from the inventory of the other container and added it to my own. So the ghost image is a pointer to the real object.

It looks like you will have to close/open the inventory or find another solution. Sorry I couldn't help.
claiminglight 30 Jan, 2019 @ 10:53am 
One interesting thing I found: Trying to change the inventory page, even if there is no other page, does fix it. Just wish I knew of a way to script that in. Or some other refresh on the inventory contents.

Thanks for having a look!

And Ryuu, I dunno if it's a bug or not. I could see why someone might want that ghost item, in some instances. But it sure would be nice if I had a method that let be turn that off.
Last edited by claiminglight; 30 Jan, 2019 @ 10:55am
< >
Showing 1-5 of 5 comments
Per page: 1530 50