I did what the code told me to but it keeps displaying an error.
var item = hero.findNearestItem();
while (hero.gold < 80) {
var item = hero.findNearestItem();
if (item) {
hero.moveXY(item.pos.x, item.pos.y);
}
}
hero.buildXY("soldier", 13, 73);
hero.buildXY("soldier", 51, 73);
hero.buildXY("soldier", 51, 53);
hero.buildXY("soldier", 90, 53);
var points = [];
points[0] = {
x: 13,
y: 73
};
points[1] = {
x: 51,
y: 73
};
points[2] = {
x: 51,
y: 53
};
points[3] = {
x: 90,
y: 52
};
var friend = hero.findFriends();
if (friend) {
for (var i = 3; i > -1; i){
hero.command(friend, "move", points[i]);
friendIndex++;
}
}