somehow my soldiers can’t take over ogres.

somehow my soldiers can’t take over ogres.

Provide full code
If it is still actual for you
What do you need help with?
Basically everything. My code so far is:
hero.moveXY(69, 15)
hero.wait(1.5)
hero.moveXY(38, 21)
hero.moveXY(78, 14)
But I’m not sure how to command my soldiers.
I updated it further but the soldiers won’t move to the final X:
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": 50, "y": 58})
hero.command(friend, "move", {"x": 50, "y": 38})
hero.command(friend, "move", {"x": 78, "y": 40})
hero.moveXY(69, 15)
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": 50, "y": 58})
hero.command(friend, "move", {"x": 50, "y": 38})
hero.command(friend, "move", {"x": 78, "y": 40})
hero.wait(1.5)
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": 50, "y": 58})
hero.command(friend, "move", {"x": 50, "y": 38})
hero.command(friend, "move", {"x": 78, "y": 40})
hero.moveXY(38, 21)
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": 50, "y": 58})
hero.command(friend, "move", {"x": 50, "y": 38})
hero.command(friend, "move", {"x": 78, "y": 40})
hero.moveXY(78, 14)
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy):
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": 50, "y": 58})
hero.command(friend, "move", {"x": 50, "y": 38})
hero.command(friend, "move", {"x": 78, "y": 40})
while True:
enemy = hero.findNearestEnemy()
if hero.canCast("chain-lightning", enemy) and enemy:
hero.cast("chain-lightning", enemy)
friends = hero.findFriends()
for i in range(len(friends)):
flag = hero.findFlag("green")
friend = friends[i]
witch = hero.findByType("witch")[0]
fenemy = friend.findNearestEnemy()
if friend.type == "paladin" and friend.health <= 175:
hero.command(friend, "cast", "heal", friend)
elif witch and friend.type == "paladin":
hero.command(friend, "attack", witch)
elif fenemy:
hero.command(friend, "attack", fenemy)
else:
hero.command(friend, "move", {"x": flag.pos.x, "y": flag.pos.y})
I beat it with this code /\ but I’m limited to three comments so I have to keep editing, but I don’t know how to get the bonus. 
Try to chainlightning the witch first thing using.
hero.cast("chain-lightning","witch name here").
the witch is the meanest one then command them to defeat the rest of the enemies.
Or you can make send 2 people once you kill the witch, you can send 2 ppl to the end while the other 3 units play tag with the skeletons and ogre