Spielerando

Switch a character to the other side mid-fight without confusing the enemies

A trusted ally turns on you in the middle of a battle, or an enemy changes sides after a speech. Enemies keep attacking their new friend, or ignore the traitor who is hitting them. Here is the cleanup that makes targeting follow the new loyalties at once.

Why this works

Loyalty and memory are separate. Changing sides is not enough, because old grudges and old friendships linger in what each fighter remembers, so the memory must be cleaned on both sides, and a second check at the moment of choosing catches what slips through.

When not to use it

Skip it when the turn is meant to be a surprise that the enemies keep falling for, or when sides never change in your game. There a fresh start for the switcher, with all old enmities kept, may be more fun.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 2 common mistakes and the fix
  • A diagram of every state
  • 37 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 "Switch a character to the other side mid-fight without confusing the enemies" (read_entry defecting-unit-threat-cleanup) 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