I'm building an singleplayer adventure map, and need a bunch of "Flags"(a few hundred maybe), which are basically variables to indicate, whether the player has visited certian places/killed enemies, etc.

I can think of two ways to do this:

  1. Scoreboard objectives
  2. Blocks at specific positions

I would just use the scoreboard, but I want the player to be able to save/load the state of all flags(at once). With blocks, you could just use the /clone command, but scoreboards would require two commandblocks per flag to save and restore, whereas one /clone can copy up to 32768 blocks/flags at once.


Advantages: Easy to set/check, because you can give names like visitedCityXYZ

Disadvantages: Very hard to copy/restore, because every flag would need 1 commandblock for saving and one for loading


Advantages: Easy saving/loading with /clone

Disadvantages: Harder to set/check, because you would need to remember/look up the coordinates of every flag. The Chunk containing the blocks may unload, and all /clone, /setblock and /testforblock commands would fail.

Main question: Does anyone know a better way of building a "Flag"-system, which I can save/load, or an easier way to copy scoreboard values from/to the player.

Edit: I totally forgot, I could just put the blocks/containers into my Spawnchunk... I was placing commandblocks there to be always active, but didn't thought about using it for the flags.

  • I wonder if you can manage the flags as different kinds of items in a container, then clone/replace the container as save/load.
    – SF.
    Commented Nov 5, 2015 at 14:26
  • Very good idea, but this improves "my" block method only in terms of compression. My major point was, that the blocks could be in an unloaded chunk, producing unpredictable results. Using containers doesn't change that.
    – Mystery
    Commented Nov 5, 2015 at 14:51
  • You can still have the clones of the chest "follow" the player between chunks (e.g. if the player moves more than several chunks distance, clone the chest to land under his current chunk). And it drops the need to remember hundreds of locations, just the "offset" of the "save chests".
    – SF.
    Commented Nov 5, 2015 at 15:27
  • Yeah, maybe I could use a marker-ArmorStand to track the chest, which again, tracks the player...
    – Mystery
    Commented Nov 5, 2015 at 15:29
  • You might want to edit the title for the benefit of future readers. What you describe is not what is commonly called a "state machine" (i.e. an automaton that has rules to change between different states based on input stimuli). I'd rather call it "saving and restoring the state of many flags" or something similar.
    – Fritz
    Commented Nov 5, 2015 at 23:25

1 Answer 1


Store the values in armor stands and switch the armor stands' name when saving and loading a state.

The armor stands' name will be n, where N equals the id of the set. When using the data pull it from set 0 and when saving/loading switch the names of the desired set with set 0.

Switch sets:

/entitydata @e[type=ArmorStand,name=0] {CustomName:9999}
/entitydata @e[type=ArmorStand,name=<id of desired set>] {CustomName:0}
/entitydata @e[type=ArmorStand,name=9999] {CustomName:<id of desired set>}
  • Problably wasn't clear in my question, but i want to be able to load/save these flags like im saving a file. For example load the state, modify it a bit, and load it again, discarding the modifications. I edited the question. I don't want pre defined states to be loaded, like a gallery, but instead save/load a game state
    – Mystery
    Commented Nov 5, 2015 at 0:49
  • So you want something that allows for reloading the same file right?
    – Moddl
    Commented Nov 5, 2015 at 0:51
  • well, not really file, but the state of all flags(like a textfile for example)
    – Mystery
    Commented Nov 5, 2015 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .