I'm trying to figure out how to get every creep with a specific memory or role like harvester in a variable... I can't seem to figure it out.
I already tried:
module.exports = function(){
for(var i in Game.creeps){
if(i.memory == 'Harvester'){
var Harvesters = Game.creeps[i];
if(Harvesters.index < 3){
Game.spawns.Spawn1.createCreep([Game.WORK, Game.CARRY, Game.MOVE],'Harvester'+ Harvesters.length, 'Harvester');
}
}
}
}
But this obviously wouldn't work...
You can create another array from the creeps with
harvester
role:Or using lodash: