First, please read at least the relevant section of the FAQ to learn how to insert your code here properly.
(Hint: use 3 backticks before and after)
Now about your code:
-
archer = self.findByType("Archer")
is unnecessary, as you don’t use it later
(and you should use lowarcase for the types, e.g:"archer"
) -
for friend in friend:
is a wrong statement (see my first reply) -
you want to do too many things with your friends at the same time:
-
move to a location
-
attack the witch
-
attack your(!) nearest enemy
-
attack the witch (again!)
-
you then move around, attack, wait, but don’t order your friends to do anything
-
then the loop restarts…
Here is a pseudo-code outline of what you probably want to do:
-
command your friends:
-
if the witch is alive: attack the witch
-
if there is any other enemy: attack the nearest one
(note: the one nearest to your friend, not you!) -
otherwise: move to the exit
-
in the meantime, move the hero around to get rid of the brawlers
Unfortunately, I have to tell you that it’s not going to be this simple: it takes a lot of trial and error to get it done correctly.
Probably it’s better to redo some earlier levels to get more practice with loops, targeting, etc.
I suggest once again to read the relevant topics already existing on the forum to get more hints.
Cheers