pos.findPathTo error not respecting roads as it should



  • Hi, I have encountered persisting error on path creation. As far as I know new PathFinder is not enabled. It does not respect roads as it should. I tried to increase maxOps but there is no change. Without range also returns the same result (but in a different place). Maybe I do something wrong here.

    Code that creates path:

    structure = creep.room.controller;
    
     if (structure != null) {
    
        creep.memory.path = creep.pos.findPathTo(structure, { maxOps: 1000, ignoreCreeps: true, maxRooms: 1, range: 2});
    
         Game.rooms[creep.room.name].visual.poly(creep.memory.path, { stroke: '#00ff00', strokeWidth: .1, opacity: .5, lineStyle: 'dashed' });}
    

    With range: 0_1588156383388_a1a8d2d2-3bc9-4a34-972b-1b1ba1cb8787-image.png

    No range or 0: 0_1588158103808_467ff548-e254-4177-93f4-c7619ac7957e-image.png



  • you need to adjust the cost for the roads in costCallback



  • Actually, you need to adjust the cost of the plains and swamps. They're the problem. They default to 1 and 5, which leaves no room for the roads to be.

    WHY are the defaults for plains and swamps set at 1 and 5? Where are the roads going to be?

    {ignoreCreeps:true,plainCost:2,swampCost:10,range:range} is what I am using for the default options (unless the creep puts in it's own special stuff, all it needs supply is the range.)



  • @smokeman It did not solve the problem to put " plainCost: 2, swampCost: 10". Still the same result