Lost role's in memory



  • Some times my creeps just lost role's in memory and then just stay! 😞



  • It's spawn with empty object wtf



  • Do you have some code similar to this

    for(var creep in Memory.creeps){
        if(!Game.creeps[creep]){
            delete Memory.creeps[creep];
        }   
    }

    If so, when a creep is still spawning, it will exist in Memory.creeps, but not in Game.creeps. I changed mine to this to deal with the issue.

    // Clean up memory
    if(Game.time % 1000 == 0){
        for(var creep in Memory.creeps){
            if(!Game.creeps[creep]){
                // Oddball, a bunch of active creeps memory got deleted, so delete only if they fail the find 2x.
                if(Memory.creeps[creep].safeToDelete){
                    delete Memory.creeps[creep];
                } else {
                    Memory.creeps[creep].safeToDelete = true;
                }
            }
        }
    };


  • i havent got any code for delete some in memory



  • The other thing I have noticed that could cause this is setting memory with the debug memory editor. When you save your changes, you are saving the whole tree you are under. So possibly, you were editing a different creep under the creeps tree, and when you saved, you overwrote the entire Memory.creeps.