Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Need help on Clash Of Clones ASAP

Is this solved? I presume not from your other post (Must have “missed” it, but…-the code for planting a flag in the first place)
If not please post your current code and I’ll see what I can do.

@Deadly_Rice0769 So, you don`t have Emperors Gloves or VIkings Helmet?

self.moveXY(66, 57)
back = 0
while True:
    enemys = self.findEnemies()
    index = 0
    closest_soldier = None
    soldier_dist = 999
    closest_archer = None
    archer_dist = 999
    closest = None
    dist = 999
        distance = self.distanceTo(enemys[index])
        if(enemys[index].health>0 and enemys[index].type != "sand-yak" ):
            if(enemys[index].type == 'archer' and distance<archer_dist):
                closest_archer = enemys[index]
            if(enemys[index].type == 'soldier' and distance<soldier_dist):
                closest_soldier = enemys[index]
                closest = enemys[index]
        index +=1
    if(closest_soldier and soldier_dist<10):
        enemy = closest_soldier
    elif(closest_archer and archer_dist<20):
        enemy = closest_archer
        enemy = closest
        if(<self.maxHealth/2.5 and back==0):
            self.moveXY(40, 85)
            back = 1
        elif(<self.maxHealth/5 and back==1):
            self.moveXY(40, 85)
            back = 2
        elif(self.isReady("jump") and self.distanceTo>15):

@Alexbrand No, I don’t have emperors gloves or viking helmet

1 Like

Do you really need all thees extra brackets?
Try to remove like
if<self.maxHealth/2.5 and back==0

1 Like

What would I do to change that?

That isn’t my post…

Sorry, I’m meant your post at the bottom of that topic.
About the level.
You don’t need to change much of your code.
I won quite easily (using your equipment) when I changed two things:

  1. The sword. Runesword has high damage, but it’s really slow and archers only have 30 life anyway. I would strongly recommend the short sword for killing lots of little enemies quickly.
  2. The way you came towards the archers. Instead of going to the bottom of the archer line, why not go to the top? The ogres will then die on your soldiers and archers while you kill their archers from above.

You definitely still need to run away at the end using that code, though I did it when Tharin had barely any health.

The variable you want is dist and assign the distance. This leaves your soldier_distance variable set for the soldiers only.

                dist = distance

Sorry, I was busy IRL.

So, it takes me a couple of days to beat this level without all this stuff: emperors gloves, viking helmet, invisibility. Interesting, but pretty hard for me)

First, I tried to find health balance. If hero is weak, he can’t survive for the whole quest time. After all, I think the more health you have at the start, the more chances to pass the level you have. With 2850 hp at the start, hero has 160 hp in the end (actaully 12 hp for the first time as i forget to except "sand-yak" from targets).

Then, you need tactics. I’d recommend to stop enemy hero, kill some archers, eleminate shaman, kill the rest of archers, retrieve back.

As for code (Python) I used len(archers) as condition to determine target.
Tricks: “bash”+“bear-trap” to stop enemy hero.

These advices are hints, not the straight instructions. There are many ways to complete the level I think. Hope you’ll find your one.

Good luck!

1 Like

One important thing about equipment - I changed copper ring to damage reflection circlet. My solution didn’t work without it.
And yes, as Deadpool198 said, there is no need in such powerful sword.

1 Like

Frick me, I don’t know how to thank you!
Just that one change and BOOM I completed the level
I :smiley: happily clicked :green_heart: solution and let out a HUGE sigh of relief
Thank you SO MUCH and keep on going…

I shouted out “YEEEES” in my computing class and felt imediatly embarassed but, I didn’t care :blush:

P.P.S. Check out my other topics if u can :slight_smile:

1 Like

Well, I’m glad that it helped) Thank you for feedback)

Someimes even one . or any other symbol in code repairs or ruins the whole success) It happend many times to me. So do equipment things.

Wish you good luck) Try, try and don’t ever give up)

1 Like