Spielerando

Keep a gatherer's load and carried item right when orders change halfway

Villagers get new orders all the time: the tree is gone, the player picks another resource, the storehouse burns. A naive loop then lets them carry wood in their hands while mining stone, or vanish their load. This entry shows the small set of states that keeps the body, the item and the numbers in agreement.

Why this works

What a worker carries is a fact about the worker, while what it is doing is only its current errand. Keeping the two apart means a change of orders never loses goods or shows a wrong picture, because the load changes only where goods are actually taken or handed over.

When not to use it

Overkill when workers carry nothing, or when the job is a single trip with no choice, like a farmer who simply grows crops. If your game has only one resource and one order, a simple busy-or-free flag is enough.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • A diagram of every state
  • 43 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 "Keep a gatherer's load and carried item right when orders change halfway" (read_entry gatherer-keeps-its-load-when-the-job-changes-halfway) 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