@explicit @RayderBlitz Yeah, that was it. Movement is still kinda funky when there is more than one creep out but at least now it's actually going where it is told.
Thanks for the help fellas (o゚v゚)ノ
@explicit @RayderBlitz Yeah, that was it. Movement is still kinda funky when there is more than one creep out but at least now it's actually going where it is told.
Thanks for the help fellas (o゚v゚)ノ
@tigga tried range: 1
but still no results. Even tried range 2 but it's still the same.
Here's a video with range: 1
and pathing visualised: https://streamable.com/iqk38x
Same as before, updated code looks like:
var roleWorker = {
run: function(creep){
var sources = creep.room.find(FIND_SOURCES);
var creepPath = creep.pos.findPathTo(sources[0]);
creep.moveTo(sources[0], {visualizePathStyle:{
fill: 'transparent',
stroke: '#fff',
lineStyle: 'dashed',
strokeWidth: .15,
opacity: .1
}, range: 1});
}
}
module.exports = roleWorker;
forgive the sloppy indentation on the visualizepathstyle option, im in a rush and didn't have time to make it look neat
Having a problem using the moveTo() function in that when giving a creep a position to move to, it'll just go between the same two points that aren't related to its target and sometimes will fix it pathing after making a minute change to the script and saving even though the script was already saved and the change was insignificant (I.E making a comment.) It doesn't even adhere to the pathing it planned when I visualized it.
Here is a video demonstrating that: https://streamable.com/7qoqkb
My code is very simple and I don't understand what particularly is wrong with it. Code being:
Main
var roleWorker = require("role.worker");
var gameSpawns = Game.spawns;
var gameCreeps = Game.creeps;
module.exports.loop = function () {
if(Object.keys(Game.creeps).length < 1){
gameSpawns["Spawn1"].spawnCreep([WORK,MOVE,CARRY], "worker" + Object.keys(Game.creeps).length);
}
for(var creep in gameCreeps){
roleWorker.run(gameCreeps[creep]);
}
}
Worker role
var roleWorker = {
run: function(creep){
var sources = creep.room.find(FIND_SOURCES);
creep.moveTo(sources[0], {visualizePathStyle:{
fill: 'transparent',
stroke: '#fff',
lineStyle: 'dashed',
strokeWidth: .15,
opacity: .1
}});
}
}
module.exports = roleWorker;