After sleeping on it: Custom menu system for each store. Hard as heck, but can be done.
We'll say 3 towns, with 20 items for sale + 1 Unique
============
There's two ways I can think of to pull that off.
#1 - Each item at each store has 4 variables - Buying, Selling, Stock, and Refill Rate.
This would be the "long way" to do it (because you'd have to set each and every item's price at every refill and purchase), but you'd have more control over the prices within the game, adjusting them to your whims. Of course, this is completely hidden to the player and is pretty much wasted effort.
-Your events are gonna look like this:
Code:
Bought ItemA:
<>Branch (Stock >= AskingToBuy)
<>TempVar = Price
<>TempVar =* AskingToBuy
<>Branch (GP >= TempVar)
<>GP =- TempVar
<>TownA_ItemA_Stock =-AskingToBuy
<>Price Determination Lines
...Blah More Price
...Blah More Price
...Blah More Price
...Blah More Price
...Blah More Price
...There's probably more to determine price
<>
:End
<>
:End
=====
Sold ItemA:
<>Branch (ItemInYourStock >= AskingToSell
<>TempVar = TownA_ItemA_SellingPrice
<>TempVar =* AskingToSell
<>GP =+ TempVar
<>ItemInYourStock =- AskingToSell
<>Increase TownA_ItemA_Stock by whatever you bought
<>Price Determination Lines
...Blah More Price
...Blah More Price
...Blah More Price
...Blah More Price
...Blah More Price
...There's probably more to determine price
:End |
...for each and every item in your store in every store. This also isn't including the parts where the CMS resides. WAY too much reused code. And then you have to debug this.
#2 -
There's 2 main variables for each item type -
BasePrice,
BaseRefillRate. On each item in each store, there's the variables
ItemStock,
ItemBuyingPrice,
ItemSellingPrice, and
ItemRefill. The price is calculated via an event, one for each store, and selling is a percentage of the normal price.
This will make your efforts MUCH easier, from a programming standpoint, for these reasons:
-You'll declare the main variables first, and never have to touch them again. (Make sure they're separate in the variable list).
-The ItemPrice ensures that you won't have to touch price directly within a shopkeeper event. You send this off to a common event whenever the ItemStock variable changes (Just bought 5 Potions? TownA_PotionStock goes down by 5, and you run EventReCalculateTownA. Just sold 3 ethers? TownB_EtherStock goes up by 3, and EventReCalcuateTownB is run.)
The only problem with this, is that the event would pretty much end after each transaction, and you'd have to talk to the shopkeeper again to buy something else. It'd be insanely difficult to figure out where to jump to once the event was done.
Code:
Buying ItemA:
<>TempVar = TownA_ItemA_BuyingPrice
<>TempVar =* AskingToBuy
<>Branch (GP >= TempVar)
<>GP =- TownA_ItemA_BuyingPrice
<>TownA_ItemA_Stock =- whatever
<>Run EventReCalculateTownA
<>
:End
====
Selling ItemA:
<>Branch "Have enough items to sell"
<>TempVar = TownA_ItemA_SellingPrice
<>TempVar =* AskingToSell
<>GP =+ TempVar
<>TownA_ItemA_Stock =- AskingToSell
<>Run EventReCalculateTownA
<>
:End |
---
Basically, some key points:
-- You'd have a cycle for restocking based on the production rates (an overall timer is best, say 100 seconds).
-- A small subroutine for price adjustment, based on "Base Price" and current stock. This would actually be the same subroutine for when the price goes up OR down. You'd just call that after every purchase, and for each product restocking schedule to calculate the new price. Not sure how Uncharted Waters calcuates it, but there's probably an upper and lower limit on it as well - that can be hardcoded into the subroutine for each store.