function summon(){
if (hero.gold > hero.costOf("soldier")){
hero.summon("soldier");
}
}
function command(){
var friends = hero.findFriends();
var enemy = hero.findNearestEnemy();
for (var friend in friends) {
if (friend.type == "soldier") {
hero.command(friend, "attack", enemy);
}
}
}
function attack(){
var enemy = hero.findNearestEnemy();
if (enemy) {
if (hero.isReady("bash")) {
hero.bash(enemy);
else {
hero.attack(enemy);
}
}
}
}
while(true) {
attack();
summon();
command();
}
i try using summon and command function in village guard but i get error help fix this
Edit: maybe not error, soldier not moving or attacking pls help me fix this. i can’t use “or” statement in javascript
It can’t perform this if it’s in the if statement
(I know!)
1 Like
Yes, @Vanessa is right.
if (hero.isReady("bash)){
} else
1 Like
thank you it works! 2917451
This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.