Help with portable chest

Following the post that i made the other day:

I managed to create a fully functional portable chest that you can summon/unsummon by using a feat and storing the object that contains the inventory into a custom database.

The problem that i’m facing is that it can be used to duplicate items. Because i’m storing in the DB, if the player exits the game without saving, it will have the items stored in the chest the next time it load the game but it also will have the items in the inventory.

The PC object remains valid when the player logs out, although GetIsPC checks will fail. Can you use the OnClientExit event to force a save or destroy the container’s inventory? Or a force save every time the box is closed or inventory is disturbed?

2 Likes

The problem is that the database is persistent, is a separated file. Because of that, it can easily be desynchronised with the save file so it seems to be less useful in single player for this case.

I managed to do another method, a persistent scripthidden creature that it will save the items of the chest, the chest also retrieve the stored objects from this scripthidden object. I tested it and i can call it anywhere within the module, even if the scripthidden creature isn’t in the same area as you. The problem comes when you go to another module, lets say you summoned it in NW and stored some objects and then you go to West harbor, if you summon it there, you can’t retrieve what you stored in NW because West harbor is a separated module.

If you’d like to use the db method, you might be able to delete each item from the database as it’s loaded into the chest, then re-added when the chest is closed/saved. Or, for better performance, maybe delete everything from the db and load to the scripthidden object you’re currently using, use that object while the player is in the module, then, on logout, write all the objects back to the db, thereby anyways keeping it in sync.

The db method doesn’t work well in single player in this case, you can have Save 1, Save 2 and Save 3 and the 3 saves will use the same db and records because there isn’t an way to tell to which save the db belongs. The second method that i posted was the right way to do it because it was linked directly to the save but the problem of no being able to move it between modules of the same campaign/module is what make it unusable, i even tried with the limbo functions which worked perfectly within the module but not when you go to the others.

I’m just going to pass on this ability, thematically was cool for what i’m doing but it would be just too much work for something that a Bag of Holding could do.