Living economy: supply, demand, finite stock and trade routes - BazaarCore.js
Living economy: supply, demand, finite stock and trade routes(Author:CSAF — Core Systems Asset Factory) - BazaarCore.js
https://en.plugin-mz.fungamemake.com/archives/12491
The economy under the shop: finite stock, prices derived from supply and demand, regional price spread and trade routes. Sits underneath your existing shop plugin rather than replacing it.
Plugin desc :
The economy under the shop: finite stock, prices derived from supply and demand, regional price spread and trade routes. Sits underneath your existing shop plugin rather than replacing it.
License :
・Copyright: Retained
・Commercial Use: Allowed
・Modification: Allowed
・Redistribution: Prohibited (This does not apply to works made using the material.)
・Details: See Download Page / In-plugin documentation
============================================================================
Bazaar Core — the economy under the shop
============================================================================
Every shop plugin decides what a shop LOOKS like and WHAT IS ON the shelf.
None of them decides what anything is WORTH. That is this plugin.
- Stock is finite. Buying a vendor out empties the shelf, and it stays
empty until the market recovers over game days.
- A price is never stored. It is derived, every time it is asked for, from
base value, this market's stock against what it wants to hold, its own
appetite, and any running event. So the economy cannot disagree with
itself.
- The same good is worth different money in different towns, which is what
makes a trade route a mechanic rather than a menu.
----------------------------------------------------------------------------
Setting it up
----------------------------------------------------------------------------
1. Add Commodities. Each needs an id, a base value, and — if you want a shop
to price it — a database item to bind to.
2. Add Markets. Each lists what it holds, what it wants to hold, and what it
is hungry for.
3. Set Starting Market, or call the Set Market command when the player
enters a town.
4. Use Shop Processing exactly as you always have. Governed items are priced
and stocked by the economy; everything else is left completely alone.
The "target" quantity is the level at which a good sells for its base value.
Above it the price falls, below it the price rises, and at zero it reaches
the Scarcity Ceiling.
----------------------------------------------------------------------------
Binding items without the parameter list
----------------------------------------------------------------------------
A commodity can name its database item, or the item can name the commodity.
Put this in an Item, Weapon or Armor note box, wrapped in angle brackets:
bazaar: iron_ore
(This page strips angle brackets from submitted text, so they cannot be
shown above. The plugin’s own help, inside the download, prints the tag in
its exact form.)
Either direction works. The notetag wins if both are set, because it is the
one sitting next to the thing it describes.
----------------------------------------------------------------------------
Time
----------------------------------------------------------------------------
The economy has no opinion about your clock. It moves when you tell it to,
with the Advance Days command — on sleeping at an inn, on a day/night plugin
firing, on a fast-travel, or on nothing at all if you want a fixed world.
Time is never read from a global, which is why a hundred days can be tested
in a millisecond.
----------------------------------------------------------------------------
Script calls
----------------------------------------------------------------------------
Safe from a Conditional Branch or a Script command:
Bazaar.price('harbour', 'iron_ore') // what it charges
Bazaar.sellPrice('harbour', 'iron_ore') // what it pays
Bazaar.stock('harbour', 'iron_ore') // how much is left
Bazaar.market() // current market id
Bazaar.day() // days elapsed
Bazaar.advance(3) // move time on
Bazaar.route('harbour', 'highlands') // best good to carry, or null
Bazaar.profit() // earned less spent, all game
----------------------------------------------------------------------------
Compatibility
----------------------------------------------------------------------------
Nothing here overwrites a core method. Every hook saves the original and
calls it, so this sits alongside other shop plugins rather than fighting
them. If another plugin has already changed a price, Bazaar's governed items
still resolve through this plugin's own path and untracked items keep
whatever the other plugin decided.
Terms of use: see LICENSE.txt in the product root.
Every shop plugin for RPG Maker MZ decides what a shop looks like and what is on the shelf. None of them decides what anything is worth. Bazaar Core is the layer underneath: it governs stock, demand, supply, regional price spread and trade routes, so “buy low, sell high” becomes a real mechanic instead of a menu.
It is not a shop replacement. Your existing shop plugin keeps doing its job and Shop Processing works exactly as it always has — governed items are priced and stocked by the economy, and everything else is left completely alone.
What it does
Stock is finite. Buying a vendor out empties the shelf, and it stays empty until the market recovers over game days.
A price is never stored. It is derived every time it is asked for — from base value, this market’s stock against what it wants to hold, its own appetite, and any running event. The economy cannot disagree with itself.
Regional price spread. The same good is worth different money in different towns, which is what makes a trade route a mechanic rather than a menu.
Shortage and Glut events that move prices for as long as they run.
A dedicated market ledger scene with its own custom UI — it does not use the stock MZ window look.
Requires: RPG Maker MZ.
Licence: commercial use is fine, no royalties, and you may modify the source for your own games. Redistributing or reselling the plugin file itself is not permitted — so this entry is an introduction and a link only, and no file is attached. Full terms ship as LICENSE.txt inside the download.
Price: pay-what-you-want on itch.io (paying $0 is allowed).
AI disclosure: the code and the store images for this plugin were generated with AI assistance, and this is disclosed on the itch.io listing as well. The source ships as readable, unobfuscated JavaScript.