Mount & Blade similar trade system

I'm wondering how could i make an economic system based on mount & blade economics.

The price of an item changes accordingly to the Base price of the item and the amount of stock available. Let's say sugar costs 100g, but there is a shortage of sugar in the city i'm trading, i could sell this sugar for, let's say, 175g, because of the high demand.

And it works the other way around too, a city with a heavy sugar production would sell it cheaper, encouraging the player to buy it and travel to another city to maximize profit.


I tried using Yanfly's Shop menu core so i can use variables for the pricing, but i'm having trouble going this far with only this script.
---


Does anyone know how to make it manually trough variables or knows about a script that could do something similar for me?


Thanks in advance.
Bump
Are you asking about how to literally implement such a system via scripts and/or the Yanfly plugin, or are you asking how to manage the variables and/or do math to simulate such a system in the first place?
I don't really have a preference, i would gladly do it with variables but i have no idea how. Whichever sollution bring me to this result, i'll gladly accept it.

I don't really know, how to affect the value of the variable (coin) by counting what the merchant have in stock, and how to save the changes to the stock if the player tries to sell the item, leave map, and sell the items again with a reseted market
Bump?
I found this script for VX ace that does almost everything i need.


Just need to figure it out how to set different prices based on the amount of items remaining, to buy and to sell.

Aaaaand how to port it to MV.
I have bad news for you: VX Ace is in Ruby and MV/MZ are in javascript. The only way to port a VXA script to a MV plugin is to rewrite it entirely in the other programming language.

Original thread: https://forums.rpgmakerweb.com/threads/mount-blade-similar-trade-system.147413/