Save Merch Store for PW?
![Buddywarrior](https://forums.beamdog.com/uploads/userpics/751/n9NRLFWE1FFDG.jpg)
Is there a way to save items sold on merchants so they will be there after a server restart?
I'm trying to make Vendors sell items that have been picked up by players. The modules OnAcquire script just adds the item to a merchant store. This works fine, but once I restart the server, it's wiped.
I'm trying to make Vendors sell items that have been picked up by players. The modules OnAcquire script just adds the item to a merchant store. This works fine, but once I restart the server, it's wiped.
0
Comments
Can you be a little more specific?
Like: do you want the sate of the merchant inventory to be saved, or just any items sold to it to be restored over a reset?
1: 'Player A' picks up an item with a value over 2k.
2: Module adds it to the merchant inventory.
3: 'Player B' can see the item being sold by the merchant.
4: On Server reset, the inventory state of merchant remains unchanged.
5: Buddywarrior is gitty with excitement.
And, does the merchant already have items to sell? (A little harder because you need to make a way to populate the database that does not create duplicates every time the server resets.)
Are item blueprint references fine, or are there modified items that will be picked up?
Merch will start with nothing.
resrefs are fine, I'm getting that info as it's being called.
Are there more than one locations where players can access this store?
Am I missing something? Would you rather do it when the player sells the item to the store?
It's not perfect. Here's what I have:
OnClientEnter: Block items already in inventory from being added. OnAcquireItem: The main magic. OnModuleLoad: Load all items into the store OnStoreClose: Refresh the database so that it doesn't have a bunch of blank entries.
It's a little more complicated than I thought it would be. Please ask if you need anything explained. I kind of started to, then stopped when it got super long.
Be sure to change all the names of things like tags and the database if you wish.
There is one issue I don't know how to account for right now: If a player drops an item and picks it back up, it will add it to the store. I could make it so that it won't if they pick it up off the floor, but not if they put it in a chest and take it back out.