Shop shelves are full again at once, or stay empty after many days away
Shops that restock only while the player is in town are empty forever, and shops that refill on load make selling out meaningless. Here is how to work out what changed from the days gone by, and what happens to goods the player sold to the shop.
Why this works
A shop only matters when someone looks at it. So skip pretending it lived on, and work out on entering how much time has gone by. Making stock drift back to normal slowly, rather than snap, keeps selling out a shop worth something.
When not to use it
Do not stage the restock yourself when shops are shared between players, as in an online world with a living market. There the stock changes through other people's actions, so the server must keep the real numbers.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 21 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Shop shelves are full again at once, or stay empty after many days away" (read_entry rpg-shop-restock-without-a-clock) 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