Problem reproduction
I have this setup with 2 characters and a machine (save file is attached to this post): 1) I am currently controlling the top character. I shift-right click the assembling machine.2)
Code: Select all
/c game.print(game.player.entity_copy_source.name)
3) I swap characters using this:
Code: Select all
/c local char = game.surfaces.nauvis.find_entities_filtered{name = "character", force = "player", limit = 1, position={4,3}, radius=2}[1]
game.player.set_controller{type=defines.controllers.character, character=char}
5) I swap back to the first character:
Code: Select all
/c local char = game.surfaces.nauvis.find_entities_filtered{name = "character", force = "player", limit = 1, position={4,0}, radius=2}[1]
game.player.set_controller{type=defines.controllers.character, character=char}