I was looking at trying to create a script that ran from "On Store Close Script." I want the PC to be able to close the store and the next time they open it they will find that everything from the gold limitations to the merchandise will be restocked or cleared of anything the player sold to them. Try to look at it as a sort of default restoration of the store.
When I first conceived this idea I thought it would be pretty straight-forward. However, as I try to reference other scripts to see how they reset either level or roster I go a little cross-eyed.
Does anyone have any leads on how to do this?
Script Idea - reset store
Débuté par
Friar
, janv. 14 2014 03:39
#1
Posté 14 janvier 2014 - 03:39
#2
Posté 14 janvier 2014 - 04:25
Yes, I believe so. Probably the most straightforward would be to destroy the store every time you close it, and then create it anew from its blueprint whenever you choose to open it.
#3
Posté 14 janvier 2014 - 04:32
Wow, thats a really good idea! Thanks Tchos!
#4
Posté 14 janvier 2014 - 04:39
The Bonus Blueprints pack from rjshae has some scripts included. I didn't have the time to look at them yet, but I know that some are called like "store_*_restock", or something like that. It might give you and idea if you look at them.
#5
Posté 14 janvier 2014 - 04:40
The store has an inventory like any creature or container, you can just add items to it's inventory and they'll show up in the store. Likewise, you can iterate through the store's inventory and remove things. I haven't tried with gold, but it should probably work.
Look around in the include script associated with the standard store open script, too, it might help you reset some variables.
Look around in the include script associated with the standard store open script, too, it might help you reset some variables.
#6
Posté 14 janvier 2014 - 05:46
Thanks Lugaid and Andysks,
Restoring the gold is indeed part of what I want to accomplish. All in all, and without disclosing the exciting details, I want to have a place where the player can sell specific inventory.
Once sold it can never be retrieved because it is "shipped out."
Because it is "shipped out" the shop will also have a new supply of gold ready to spend.
Buying things aren't what this store is really about. As a matter of fact, the store has no inventory to sell.
Restoring the gold is indeed part of what I want to accomplish. All in all, and without disclosing the exciting details, I want to have a place where the player can sell specific inventory.
Once sold it can never be retrieved because it is "shipped out."
Because it is "shipped out" the shop will also have a new supply of gold ready to spend.
Buying things aren't what this store is really about. As a matter of fact, the store has no inventory to sell.
Modifié par koundog1, 14 janvier 2014 - 05:47 .
#7
Posté 14 janvier 2014 - 05:51
andysks wrote...
The Bonus Blueprints pack from rjshae has some scripts included. I didn't have the time to look at them yet, but I know that some are called like "store_*_restock", or something like that. It might give you and idea if you look at them.
Yes I did some experimentation in that pack, but tracking all the different resource names just becomes too tedious. If you want to vary and update the stock over time, it would probably be easier just to have two or three similar store sets and periodically swap between them per Tchos.
Modifié par rjshae, 14 janvier 2014 - 05:53 .
#8
Posté 14 janvier 2014 - 06:40
Have you thought about doing the transaction purely through a conversation? One gc script to check if the player has the item, and the NPC has the cash, and a ga script to take the item from the player and give them the money for it, subtracting from the NPC's gold integer. A third script cleans out the NPC's stock and credits them gp.
Different gc scripts can check for different trade items (or just use the parameter), and if you ever want to get fancy, you can have the wholesale price fluctuate with supply and demand.
Different gc scripts can check for different trade items (or just use the parameter), and if you ever want to get fancy, you can have the wholesale price fluctuate with supply and demand.
#9
Posté 14 janvier 2014 - 07:05
Thanks Lugaid,
It's a good idea and I'll jot it down to remember if the vendor needs are very specific. However, for this vendor, he is purchasing most everything the player needs to get rid of. He limits himself to how much gold he will spend per transaction.
rjshae brought another good idea. Multiple stores might be a good alternative. I say that because it seems kind of 'suspicious' how a PC could close out the store and simply reopen it to get a new supply of gold.
I planned on getting around that by simply designing the conversation to say "Come back later after I've gotten this last load off my hands.
I think the way I've got it planned should work well, but right now I'm having trouble getting the store to spawn or open... one of the two.
EDIT: I figured out what I did wrong. I had the object type listed incorrectly in the sObjectType variables when trying to create the store. I had the store listed as W (which is a waypoint) now it is using an S (which is for store).
It's a good idea and I'll jot it down to remember if the vendor needs are very specific. However, for this vendor, he is purchasing most everything the player needs to get rid of. He limits himself to how much gold he will spend per transaction.
rjshae brought another good idea. Multiple stores might be a good alternative. I say that because it seems kind of 'suspicious' how a PC could close out the store and simply reopen it to get a new supply of gold.
I planned on getting around that by simply designing the conversation to say "Come back later after I've gotten this last load off my hands.
I think the way I've got it planned should work well, but right now I'm having trouble getting the store to spawn or open... one of the two.
EDIT: I figured out what I did wrong. I had the object type listed incorrectly in the sObjectType variables when trying to create the store. I had the store listed as W (which is a waypoint) now it is using an S (which is for store).
Modifié par koundog1, 14 janvier 2014 - 07:39 .
#10
Posté 14 janvier 2014 - 07:40
Another random idea - you could have a crate or bin, and the PC could place all their items to be sold into the bin. Ever so often, you have a script that iterates through each item, destroying it (if non-plot) and replacing it with the appropriate amount of gold, up until a certain amount of gold has been reached.
The same script might work on a store, too, destroy the inventory and add gold. Actually, if the store buys items at a discount, and then resells them for full BP price, then the store gold would creep upward as the player sells them more and more stuff, giving the player a nice little sense of accomplishment.
The same script might work on a store, too, destroy the inventory and add gold. Actually, if the store buys items at a discount, and then resells them for full BP price, then the store gold would creep upward as the player sells them more and more stuff, giving the player a nice little sense of accomplishment.
#11
Posté 14 janvier 2014 - 08:34
It's a good idea Lugaid and it isn't terribly random either. I've actually been toying with a similar idea considering the store was located in a warehouse. The individual worth of items seems to be only one of many particulars that make fleshing this idea out kind of difficult.
#12
Posté 14 janvier 2014 - 11:07
There's a function for getting the gold piece value - GetGoldPieceValue - so no need to list every item out individually.
#13
Posté 15 janvier 2014 - 03:41
GetGoldPieceValue? That might change things then.
I'm more inclined to go the route you suggest. In the interests of the story, it would seem that throwing these items into a crate gives the acting 'store' a little more dimension. The reason is because the merchant would probably not want to physically exchange the merchandise the PC is selling him. Then again maybe he would since he wants to know if he is getting what he paid for.
Either way the important thing to remember is that I have some options and thank you for helping me.
I'm more inclined to go the route you suggest. In the interests of the story, it would seem that throwing these items into a crate gives the acting 'store' a little more dimension. The reason is because the merchant would probably not want to physically exchange the merchandise the PC is selling him. Then again maybe he would since he wants to know if he is getting what he paid for.
Either way the important thing to remember is that I have some options and thank you for helping me.
#14
Posté 16 janvier 2014 - 04:25
you could also set the Buy value too high to be worth it, the sell to whaetever you want, and use the area oncliententer script to check the time; if enough time has past since the store was spawned, destroy and remake (basically allowing the "shipment" to happen at a certain time).
You could also do this with onheartbeat, but I've found that client works better for this sort of thing.
How often does he get a shipment? You can have the client:
-check the current time (in whatever unit you need, I'll go with days for my example)
-when first runs (under something that checks for a variable not being 1, then if it's not 1, sets it to one) you spawn the store and note the day Add 30 (or whatever) to this to set the next shipment
-if your check variable is 1, it looks to see if the current day is higher than the saved, if so, add 30 and recheck until it isn't, then reset the store. if not, do nothing.
done and done.
You could also do this with onheartbeat, but I've found that client works better for this sort of thing.
How often does he get a shipment? You can have the client:
-check the current time (in whatever unit you need, I'll go with days for my example)
-when first runs (under something that checks for a variable not being 1, then if it's not 1, sets it to one) you spawn the store and note the day Add 30 (or whatever) to this to set the next shipment
-if your check variable is 1, it looks to see if the current day is higher than the saved, if so, add 30 and recheck until it isn't, then reset the store. if not, do nothing.
done and done.
#15
Posté 16 janvier 2014 - 07:30
Where that wouldn't work though is if you have a bunch of unique content that you don't want to keep showing up in the inventory. In that case you'll need to track the parts individually.





Retour en haut






