Navigation

    forum

    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    1. Home
    2. Yone
    • Flag Profile
    • block_user
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Groups
    • Blog

    Yone

    @Yone

    1
    Posts
    792
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Yone Follow

    Posts made by Yone

    • Why the builder screep is not moving?

      Hello:

      I am beginner, I have just finished the tutorial and I am trying to upgrade the Room Controller, however I realized it is far from the spawn point.

      How could shorten the distance to allow the screeps reach it?

      I tried by myself to use the Construct tool. I drawed a road from the spawn to the Room Controller. However after spawning a screep with the memory 'builder' and setting its scripts for role.builder as follows:

      var roleBuilder = {

      /** @param {Creep} creep **/
      run: function(creep) {
      
          if(creep.carry.energy == 0) {
              creep.memory.building = false;
              creep.say('🔄 harvest');
          }
          if(!creep.memory.building && creep.carry.energy == creep.carryCapacity) {
              creep.memory.building = true;
              creep.say('🚧 build');
          }
      
          if(creep.memory.building) {
              var targets = creep.room.find(FIND_CONSTRUCTION_SITES);
              if(targets.length) {
                  if(creep.build(targets[0]) == ERR_NOT_IN_RANGE) {
                      creep.moveTo(targets[0], {visualizePathStyle: {stroke: '#ffffff'}});
                  }
              }
          }
          else {
              var sources = creep.room.find(FIND_SOURCES);
              if(creep.harvest(sources[0]) == ERR_NOT_IN_RANGE) {
                  creep.moveTo(sources[0], {visualizePathStyle: {stroke: '#ffaa00'}});
              }
          }
      }
      

      };

      module.exports = roleBuilder;

      I have found that it does not move. Why?

      Thank you for your time and help.

      posted in Help
      Yone