Thanks a lot @Calfa and @o4kapuk it seems to be working now. else if(!creep.memory.harvesting){ var targets = creep.room.find(FIND_STRUCTURES, { filter: (structure) => { return (structure.structureType == STRUCTURE_EXTENSION || structure.structureType == STRUCTURE_SPAWN || structure.structureType == STRUCTURE_CONTAINER) && structure.energy < structure.energyCapacity || _.sum(structure.store) < structure.storeCapacity; } }); really appreciate the help.