Memory not being assigned to creeps



  • When I spawn a creep using this function it isn't having role: 'hauler' assigned to its memory,
    The creep will build but wont have anything in memory.

    for (spawn in Game.spawns){
    var spawn = Game.spawns[spawn];
    if (Memory.buildList.length){
    for (var i in Memory.buildList){
    var blueprint = Memory.buildList[i];
    var body = blueprint.body;
    if (!spawn.canCreateCreep(body)){
    console.log(spawn.createCreep(body,null,{role:'hauler'}));
    Memory.buildList.splice(i,1);
    };
    };
    };
    };



  • Attempt {'role':'hauler'} in the options of the spawn, and let me know if that works. I've seen memory issues resolved by this before.



  • That seems to be working thanks!
    though now I will need to figure out how to generalise the script 😞