I am thinking I cannot be the first person to want to do this and rather than re-invent a wheel I’d love to get someone else’s into my system.
Basically I have a couple of containers I want to give players when they start the module.
A coin purse (will have custom coin objects)
A Scroll Case
What I want to do is limit the items that can go in these bags so that if you try and put say armor in the quiver it won’t allow it or at least spits it right back into your main inventory. Would also be nice if it just auto-gathered when you got one of these items but that might be asking a little much.
The problem here is I have never tried to play with inventory of a bag before (from what I can see it’s just considered character inventory) so rather than run down a 4 day rabbit hole I figured I would reach out here.
Is this possible to manage and if so where do I start? Would this require custom 2da entries? Is there something similar here on the vault now that I can learn from / utilize / adapt?
There are a number of difficulties - item containers in inventory don’t have their own OnAction scripts. Also moving an item from general inventory into a container does not trigger the OnDisturbed script for the PC. For myself, the only “simple” solution I found was a “default” script check of the inventory of the container in the character’s inventory every round (6 seconds). Someone else may have a better solution. I will take a peek at my script vaults and see if I have anything similar.
Yeah, I think that’s the option. I have a similar check script for coin purses etc at well. You can optimize it by keeping track of what containers the PC has so you don’t have to scan the whole inventory all the time.
Hmmm I hate to add any heartbeat scripts as they are notorious resource hogs. I suppose I could look at making it an item instead of a container is problematic for me as it would REALLY mess with my custom coin scripting (which I finally have working perfectly) so I would be loathe to mess with that.
I can certainly make sure “on Acquired” the items end up in the right container if the PC has one, but I don’t think that I can stop them manually putting something in there once they have it. At least not easily.
The heartbeat script might be the only way to accomplish this I will have to think about that one. It’s 100% a nice to have sort of thing not a “got to have” situation so if I have to scrap it then I guess I have to scrap it.
Thanks and if anyone things of anything that would work or has some sample code I am 100% willing to look @ it!
Thanks, again Have been out of the scripting game quite a while now and it’s been a heady rush getting back into it. NWN:EE revived my old gaming group though We are going to try running a game every other Thursday and might alternate between 2 if we have multiple DM’s willing!
I guess it could be in the PC module OnAcquire script for the specific items which would be in containers. But the PC would need the containers before they acquire the items.
You could have each newly acquired item checked for item type, and then route the particular types (scroll, potion, gem/coin) to the containers if the PC has them.
It wouldn’t necessarily force those items to be in the container, but it would put them there upon acquisition. The PC would get the hint and put any older items in there for easy sorting.