In my mod, I have a quest that involves giving the PC a plot item.
Is there a way to make sure the PC has room in their inventory for the item? Can this be done within the dialog conversation?
Or if you have a solution to this problem already can you share what you did?
Thanks ahead of time!
You’d have to write a dialog action script →
i figured something for the OC, when forging the Silver Sword … to try and make sure it ends up in the PC’s inventory.
here’s a link to the function in Nwn2Fixes at github
player/3052a_cut_scar.NSS at master · nwn2fixes/player · GitHub
It’s not 100% robust, i don’t think there is a way to make such a routine 100%. eg, another item must be dropped, or perhaps the new item can be placed in a (not full) bag, etc etc. But there it is …
hm, note that that function is not exactly what you want; you see, i had the luxury of equipping the new item, hence the item that was dropped to make room for the new item gets copied back into PC inventory
but CreateAndEquipSilverSword() is sort of what yer looking for, although there’s probably other ways.
The IsInventoryFull function in the hench_o0_act script will check if there is room in the inventory. It could be put into a dialog action script.
Here is the solution I am using.
I create three dummy items that are not worth anything and those can be obtained via a conversation with NPC.
The player then goes to another NPC that checks for those dummy items, and will destroy those three items making space in the inventory during the conversation dialog. The player cannot interact with the NPC conversation without those three items in their inventory. So the effect is that those three items give you an option in the conversation that will destroy those three items leaving space in player inventory for the plot items I want to give the player in the same conversation.
But how am I able to prevent the player from exploiting the full inventory system that drops items on the ground when inventory is full.
I do not want plot items being dropped to the ground because a player has a full inventory.
The trick was that you have to use the camera for conversation rather than the NWN1 dialog option. Otherwise players can open the inventory and fill up their inventory while still in the conversation dialog window.
Once again I am not a scripter and this is the everything is a hammer solution. I took both of you guy’s advice and found this to work for me.
I was able to find the relevant script in 0o_hench_act, but I had no idea how to implement it as a dialog action script.
Glad you got it working but for the future there is another option without using any items at all…
Just use the journal and/ or a global/local int. Every time the player gets an item the journal says you have 1,2…etc. of that item or you use the invisible int working in the background. Then when you go to the person to hand them in if there are enough journal entries or ints the conversation goes ahead.
You can of course give items and use the journal to be double safe so long as the conversation depends on the journal it doesn’t matter who has them or if they’ve been dropped and during the conversation use destroy on all of them and they’re gone.