Item Specific Supply and Demand Price Changes

● ARCHIVED · READ-ONLY
Started by Dangime 3 posts View original ↗
  1. I've been working on a project akin to the Uncharted Waters series. If you don't know, this largely involves sailing around the world and trading in various commodities. Sorry if this topic gets complicated but it involves ideas surrounding economics.

    I've already created a mechanic to reflect the change of the supply of money in a given port, IE inflation/deflation. It checks a player's gold level coming in and compares it to what it was exiting, then adjusts a port specific variable in Hime's shop manager to change the price of all items in the port to reflect the new abundance or lack of gold in that particular port.

    I'd like to do the same thing, but more aggressively but only for the specific item being bought or sold. That is if someone comes and dumps 100 units of wine in london, I want the price of wine to crash, more so than just the general price level that the change in money supply will cause (100 units of wine being sold will cause lots of gold to leave the port, so overall price levels will decline anyway, I just want it to decline for wine specifically more.)

    So I thought of one way of doing it...but it seems overly brute force. Any time a player talks to a shop keeper, I would run an event that catalogs their inventory as they enter, then again as they leave. This would basically be like stacking 50 or so fetch quest scipts into the event box twice, since there are about that many commodities. By comparing the two results I would know what goods traded hands. I could then change a variable for local demand of the items that had a big enough change to warrant a price fluxuation in that port. This causes another brute force problem...to store that information I will need about 2500 variables (50 ports x 50 commodities).

    Part of me thinks that the inflation/deflation mechanic is good enough and hardly anyone would appreciate the difference if I went down this road for local pricing. But I wanted to check and see if there were any brilliant minds here who can think of a less lengthy way of achieving the same goals. Thanks in advance for your advice.
  2. I don't think that anyone has made a script that does exactly this, but there are a couple that might do parts of it, like allow you to set a price for good right before the player shops.  One of my first scripts tracked a quantity remaining for each item based on the player's buying and selling and other events (like new shipments), but it was global and didn't adjust the price.  Hime has a script that does it by shop, but I don't think the quantity can be refilled throughout the game.

    Your best bet is probably to learn a little scripting and get used to the flow of Ace's built-in commands, because with some scripting you can definitely make this much easier on yourself.  For example, check out the do_buy and do_sell methods in Scene_Shop.  You can use the item and quantity that the method is already using to adjust the corresponding variable based on the amount bought or sold.  And if you're worried about the huge number of variables this would take, just define your own array as part of $game_player or $game_party or (if you're advanced enough in scripting) as part of its own singleton class.  You could make a 50x50 array where set of 50 elements stores all 50 item prices for one port (for instance, prices[3][27] would refer to the price of Good #27 in Port #3).

    There's a little too much going on here for me to write a whole script up in an hour or two for you (it's something I'd probably only do as a commission), but maybe there's a generous soul around who's willing to make such a script for you.  If you want to take a go at it yourself, I'd certainly be happy to answer any questions I can.
  3. I did realize an array would be the way to go after posting this, but my intro computer science skills are about all I have. I know the logic behind scripting, but the particular syntax is something I'm not at all familar with which is why I guess I stuck using other people's scripts and the event tools. My primary experience before this was the warcraft 3 editor which is similar in it's event structure.

    Anyway...I wouldn't want to discard what I've done so far unless it could address all the functions I have in Hime's system. Currently that's variables for the gold supply and random events like harvests, wars, and exotic goods fads. I knew the day would come when I would have to pay off script owners if I ever sold the game, it's just everyone is very tight liped about exactly what they value their scripting work at so I can't really make a cost benefit choice off of that. If you'd be willing to give me an estimate based on that description, I'd look at it. Somehow I don't think this problem is exactly the one I should try to tackle for my intro to scripting.