Spawn create creep



  • Hi,

    I was trying to share the energy load to spwan genral purpose creep (as attacker, healer,...) betwen rooms and found something weird..

     

    function checkAttackFlag(tFlags)
    {
    for(var i = 0; i < tFlags.length; ++i)
    {
    var defender = _.filter(Game.creeps, (minion) => { return minion.memory.role == 'defender' && minion.memory.target == tFlags[i].name})
    var qt = defender.length;

    _.forEach(Game.spawns, function(spawn) {
    if(!(qt < tFlags[i].memory.qt))
    return false;
    if(!_.includes(spawnUsed, spawn.name))
    {
    var newName = Game.spawns.HomeSweetHome.createCreep(defenderLayout[tFlags[i].memory.rank], {role:'defender', criticalStatus:false, target:tFlags[i].name});
    if(_.isString(newName))
    {
    console.log(spawn.name+'=>Spawning new defender('+tFlags[i].name+') '+newName);
    spawnUsed.push(spawn.name);
    ++qt;
    }
    else
    {
    console.log("Busy ("+tFlags[i].name+"): "+spawn.name+" | ");
    }
    }
    });
    }
    }

     

    As you can see 5 creeps were order to be produce but in fact only HomeSweetHome did produce a creep and spawn1 was already producing an other creep but it did return a name and not ERR_BUSY..

     

    Is there a link with loadash I don't know..


  • Culture

     

    Game.spawns.HomeSweetHome.createCreep

     



  • xD

    Let say I was tired ^^