Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   RPGMaker (http://zelaron.com/forum/forumdisplay.php?f=188)
-   -   Economy like Uncharted Waters - Possible? (http://zelaron.com/forum/showthread.php?t=32581)

ograx 2004-08-21 02:04 PM

Question for bluecube.
 
I was wondering bluecube if you have ever played uncharted waters?
The reason I am asking is because I would like to know if it is possible to make an economy like in that game.If you never played it before let me know and I'll give a description of the market.

BlueCube 2004-08-21 06:17 PM

Never played it.

So yeah, tell me about the economy and I'll think about whether or not it's possible. Give as much detail as possible, please.

(Also changed the title to be a bit more.. descriptive.)

ograx 2004-08-21 06:33 PM

Ok here it goes.(This is not exacty like uncharted waters but is the economy I would like to implement.)
1:Every city has trade goods at varying prices.
2:Each city has production rates for the various goods.
3:When you purchase goods the price goes up because you're buying out stock.(Only at the town of purchase.)
4:When you sell goods the price of selling that item goes down.(Same as 3.)
5:There is random shortages and overflows of goods.
6:Items are priced differently in each town.
7:Every city has specialty items which can only be bought there.

The parts I have not been able to figure out are random shortages and overflows,and the changing of price dependent on how much of it you bought or sold.I also cannot figure out the production rates.

BlueCube 2004-08-22 11:28 AM

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.

ograx 2004-08-23 05:33 PM

Nice work again Bluecube,both ways worked fine for me.The cms looks terrible but what the hell it can be fixed.I will probably post the demo I made with the two systems when I fix the cms.

---New question---
Is it possible to use numbers with decimal values in rpgmaker2003?
ie.(100x1.13)
This would be an example of a tax command for the economy.
So as price can also be controlled by separate tax rates.
The 100 represents the value of the variable which is hte price of the items you bought.

BlueCube 2004-08-23 07:15 PM

Quote:

Originally Posted by ograx
---New question---
Is it possible to use numbers with decimal values in rpgmaker2003?
ie.(100x1.13)
This would be an example of a tax command for the economy.
So as price can also be controlled by separate tax rates.
The 100 represents the value of the variable which is hte price of the items you bought.


Nope. Do this:

(Make sure Tax is something like 106 (for 106%, obviously)

<> PriceAfterTax = OriginalTax
<> PriceAfterTax = Itself*OriginalPrice
<> PriceAfterTax = Itself/100

-----

Example Usage:

500 value, 6% tax. Tax would then be 106.

Tax = 106
Tax = 106 * 500 = 53000
Tax = 53000 / 100 = 530

-----

I believe that RPGMaker always rounds down when dealing with division. To fix this, you can simply add 50 before you divide by 100 - this will basically translate into an extra 0.5.

1.2 would round down normally, which is good. Adding 0.5 wouldn't change this (it would be 1.7, which still rounds down to 1).

1.6 would also round down, which is NOT good. Adding 0.5 fixes this (2.1 rounds down to 2)


All times are GMT -6. The time now is 05:00 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.