Creep not making path to controller



  • I sent a creep into a new room and it refused to move towards the controller. I even manually sent the creep to the middle of the room then set it to go towards the controller, it flat out refused to make a path to the controller.

    creep.moveTo(creep.room.controller);

    This was the only code it ran as I disabled anything else that might interrupt it.

    I can also confirm that I managed to get a creep to go to a controller in another separate room without issue

     

     


  • Culture

    This should probably be posted in help before being posted here, or at least discussed in the general chat of slack.

     

    It's likely there's just any issue with your call to moveTo, and not a problem with moveTo itself.



  • OK I had a further look at the problem and there was an issue with the moveTo command call. But I noticed something else that was tripping me up.

    I'm not 100% but this is my theory, if a creep moves into a room and you want it to move to the controller of the new room but the controller of the last room is close to the exit you just went through it seems telling the creep to move to the new room controller right after it goes back to the previous room and then the code tells it to exit again, so gets stuck on the exit.

    Only seems to happen on that one exit the controller is close too, so probably need code to get it to move into the room a few steps before telling it to head to the controller.

    Not sure if it's intended but definitely threw me off a bit.