I have coded my people to attack the witch, but then they just freeze, this seem’s to be a common issue, but nothing on the forums is helping!(Mostly because everything is in Python !) Here’s my code:
// You can find friends through walls, but not enemies.
// Watch out for smooth, frictionless ice patches!
function heroAttack(){
var enemies = hero.findNearest(hero.findByType("brawler"));
hero.attack(enemies);
hero.attack(enemies);
hero.moveXY(8, 14);
enemies = hero.findNearest(hero.findByType("catapult"));
hero.moveXY(62, 16 );
hero.attack(enemies);
hero.attack(enemies);
hero.moveXY(8, 14);
hero.moveXY(78, 14);
}
function alliesRetaliate(){
var friends = hero.findFriends();
var enemy = hero.findNearest(hero.findByType("witch"));
for(var i=0;i<friends.length;i++){
var friend = friends[i];
if(enemy.health > 0){
hero.command(friend, "attack", enemy);
}
else {
hero.command(friend, "attack", friend.findNearestEnemy());
}
}
}
alliesRetaliate();
heroAttack();
Any ideas?