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!
了解更多
claiminglight 2019 年 1 月 29 日 下午 3:17
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,"");
}

}
最后由 claiminglight 编辑于; 2019 年 1 月 29 日 下午 3:18
< >
正在显示第 1 - 5 条,共 5 条留言
wendigo211 3 2019 年 1 月 29 日 下午 8:33 
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 2019 年 1 月 29 日 下午 8:38 
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!
Ryuu 2019 年 1 月 30 日 上午 4:15 
Try asking devs if it's a bug
wendigo211 3 2019 年 1 月 30 日 上午 5:23 
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 2019 年 1 月 30 日 上午 10:53 
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.
最后由 claiminglight 编辑于; 2019 年 1 月 30 日 上午 10:55
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50