Spielerando

Two different items share one identity after loading and act as one

Every sword the player owns needs its own number so the game can tell them apart. After a load, new items can get a number that is already taken, and picking one up or equipping it changes the other. Here is how to keep the counter honest.

Why this works

A number handed out by a counter is only a promise that it has not been used. Memory of the counter can be stale or missing, but the items themselves tell the truth about which numbers are taken. Trusting the highest of all the evidence never repeats a number.

When not to use it

Do not number items that are all alike and never differ, such as plain coins or arrows: a count is enough. And if items have fixed names from the content, like a unique sword, use that name instead of a minted number.

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 "Two different items share one identity after loading and act as one" (read_entry rpg-item-ids-after-load) 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