Help in clash of clones

pls help me I have been trying to beat this level for days here is my code:

hero.moveXY(65, 66)
while True:
    enemies = hero.findEnemies()
    enemy = hero.findNearest(enemies)
    if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
        if enemy:
            if hero.isReady("bash"):
                heor.bash(enemy)
                hero.wait(1);
            else:
                hero.attack(enemy)
    else:
        if hero.health>hero.maxHealth/4:
            hero.shield()
        else:
            hero.moveXY(42, 77)

and here is my equipments:

okay tell me what type is knight and how many gems do you have you will need better equipment if you are combating head to head

I have 1.2k gems

must be 20 characters

okay you might want to get a better breast plate if you can afford it

findNearest returns a array of enemies you want to attack a single enemy not a array

Why do you need this line?

I having a coding teacher and he said to add that idk why

So bassicly after you bash you wait one second? yea no you really don’t need that.

You spelled hero wrong right here

so it should be:

hero.moveXY(65, 66)
while True:
    enemies = hero.findEnemies()
    enemy = hero.findNearest(enemies)
    if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
        if enemy:
            if hero.isReady("bash"):
                hero.bash(enemy)
            else:
                hero.attack(enemy)
    else:
        if hero.health>hero.maxHealth/4:
            hero.shield()
        else:
            hero.moveXY(42, 77)

well righyt here your saying to only attack if it is in those types or else he won’t do anything.

Use a weaker sword. Your armor is fine, since you don’t your clone to be too strong.

1 Like


is that fine?

Yes, and if you equip that sword try to use cleave to and chain-lightning

so same code???

Yes and try to improve it.

ok I’ll try thanks for the tip

hero.moveXY(64, 70)
while True:
    enemies = hero.findEnemies()
    enemy = hero.findNearest(enemies)
    if enemy.type=="soldier" or enemy.type=="knight" or enemy=="scout":
        if enemy:
            if hero.isReady("bash"):
                hero.attack(enemy)
            else:
                hero.cast("chain-lightning", enemy)
    else:
        if hero.health>hero.maxHealth/4:
            hero.shield()
        else:
            hero.moveXY(42, 77)

here is my new code but my clone still kills me

you need to say if chain lightning is ready

replace the attack with bash

you only attack enemies in the types you said

this provides a array

1 Like

In your if statement checking if you are able to bash, instead of attacking, bash your enemy with hero.bash(enemy). Next, check if your hero can cast chain-lightning, if he can then make him use chain lightning. Then add an else statement after chain-lightning and attack in the else statement, so if your cannot bash or cast chain-lightning, then he would attack. Another thing is that you should attack all enemies except if they are types sand-yaks or ogres.

1 Like