I believe there seems to be a bug in the move command of the peasant. Please see below for a snippet illustrating the problem.
var peasants = base.getByType(‘peasant’);
for (var peasantIndex = 0; peasantIndex < peasants.length; peasantIndex++) {
var peasant = peasants[peasantIndex];
var xTarget = 0.0;
var yTarget = 0.0;
// I do my targetpos calculations here
base.say("x: " + xTarget + " y: " + yTarget); // This works, which means xTarget and yTarget are valid
base.command(peasant, ‘move’, new Vector(48, 48)); //This also works
base.command(peasant, ‘move’, new Vector(xTarget, yTarget)); // This gives an error saying:
// Cannot read property ‘x’ of null
}
I am filing it under bugs since I am reasonably certain there is nothing wrong with my code. Please re-categorize it if its something I am doing wrong and please point out my error.