I dont understand how to command things
Have you done mountain mercenaries and the other levels in that area?
It’s pretty much just for loops over an array of friends, then if friend.type == “soldier” or “archer” then you hero.command(friend, “attack”, anEnemy). You can define the enemy as the friend’s nearest enemy or as your nearest enemy.
Danny
umm I know I shouldnt have done this but i skipped some levels…
For example
while True
friends = hero.findFriends() #finds friends
for friend in friends: #runs through friends one by one
enemy = friend.findNearestEnemy() #finds the enemy closest to the friend
if enemy: #checks if there is an enemy
hero.command(friend, attack, enemy)#makes the friend attack the enemy
Lydia
I am on javascript @Lydia_Song
Please delete that since it is a solution.
Lydia
maybe you should go back and do the levels.
sorry then i am no help i am on my new account and i am python but use the boss stars
Not an expert at JavaScript, but in JavaScript, it would still look very similar just with more brackets.
Lydia
As everyone has said: go back to the first mountain levels and do all of them, while concentrating on what they’re telling you to do. I see you didn’t use a for loop. In the level it clearly tells you to use for loops. Make sure you follow the instructions otherwise you won’t be able to command troops.
Danny
ok @Deadpool198 can you close this topic