Clash of Clones help

I am on clash of clones ive been stuck on it for almost a month my hero used to survive then he would go for a sand yak and get killed by it now he dies cause of the enemy troops and knight/ogres i have 1935 health please help me.

loop:
    enemyIndex = 0
    enemies = self.findEnemies()
    while enemyIndex < len(enemies) and self.health > self.maxHealth / 4:
        enemy = enemies[enemyIndex]
        enemyIndex += 1
        if enemy.type != 'sand-yak':
          while enemy.health > 0:
            if self.isReady("cleave"):
                    self.cleave(enemy)
             else: 
                 self.attack(enemy)
    if self.health <= self.maxHealth / 4:
        enemy = enemies[enemyIndex]
        distance = self.distanceTo(enemy)
        enemyIndex += 1
        if distance > 2:
           if self.isReady("cleave"):
                                 self.cleave(enemy)
            else:
                self.attack(enemy)

can you tell me what im doing wrong

i need help chronist please help

I will help. Please be patient in the future. Contrary to popular belief, I am not omnipotent, nor is anyone else on this forum.

i need help asap i have been stuck for so long i give up

Did I not say to be patient? I was typing a response to your problem. Wait for a few more minutes.

1 Like

Honestly, there isn’t anything wrong with your code at all. You could always try a different strategy. For example, the enemy hero has a very basic program: Look for enemy. If enemy, attack. The clone will not bash or use any other special attacks. What do you think would happen when you don’t equip a weapon? Remember that the clone has the exact same gear as you do.

so what should i do to figure it out

I have just given you a completely viable solution. What do you think you should do?

i just tried and all of my men were killed

[merged triple post]

i unequipped my long sword and then nothing happend my troops all died

what does the level editor do?

That is a completely unrelated question. Let’s try to stay on topic here.

ok so what do i do now

Well, you’ll notice that your clone doesn’t do anything. You’ve just gotten rid of the most powerful enemy. Now, do you have a bashing shield, e.g Steel Striker?

i dont have the steel striker nor do i have enough i think i used to and then i asked nick to reset my gems so i could get better gear

How about you make a list of the gear you have right now, along with the gems you currently have?

i have 227 gems and these
basic flags
programmaticons 1,2,and 3
bronze sheild
long sword
simple wristwatch
softened leather boots
fine telephoto glasses
worn dragon sheild
quartz sense stone
engraved obsidian helmet
obsidian breastplate
crude builders hammer-restricted
wooden builders hammer-restricted
leather boots
wooden sheild
simple sword
crude glasses
faux fur cap
wooden glasses
sundial wristwatch
simple boots

he now survives but then goes for the sand yak and is killed

Your initial code has an “while” loop which iterates over all the enemies and attacks them if they are not yak

and a “if” block in which you attack the ?? last enemy in the list ?? if you are low on health

You are not checking for yak in the if block, so if you are low on health you might attack the yak.

What is the “if” block for anyway?

i beat it i got a simple code which is just bashing

when defining your enemy/target variable, you should ensure that you are not allowing the script to select a yak. Also be careful with Cleave, as it is an area attack. If you’re standing to close too a Yak and you attempt to cleave. There will be trouble. (I used a sword with a power-up instead of a cleave weapon)