Make a shopkeeper's prices follow friendship without letting players profit
A friendlier shopkeeper should charge less and pay more, but at some point a player can buy an item and sell it right back for a gain, or items cost nothing at all. Here is how to shape both prices and check them for every standing.
Why this works
A shop earns by the gap between what it asks and what it pays. If friendship may only move both prices inside their own bands, and rounding always favours the shop, the gap can never close, so no loop of buying and selling pays.
When not to use it
Wrong for rare quest items and for games built around trading, where profit is the point. Give quest items a fixed price, and for a trading game design the margin and the market on purpose instead.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 21 lines of example code with 5 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Make a shopkeeper's prices follow friendship without letting players profit" (read_entry shop-prices-by-standing-no-arbitrage) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP