not sure right now  and can't try, but most likely it's the same kind of behaviour as with new creeps: they only start to exist the next tick.  However, if you change the line: Game.flags[title].memory.spots = 3; to Memory.flags[title].spots = 3; it should work, because you are accessing Memory directly, without the need for the flag to exist. Just as with creeps, memory is not directly tied to them, and can exist without the flag/creep existing; the Flag.memory property is just a shortcut.