Munchkin Swarm : Help!

this is my code
but it says "please double check your code carefully in line : if self.isReady(“Cleave”)"
whats wrong ???

enemy = self.findNearestenemy()
loop:
    if self.isReady("cleave")
    self.cleave(enemy)
    else:
        self.attack("Chest")

Saw related post. It was said that the following code works:

if self.isReady('cleave'):
self.cleave(enemy)

http://discourse.codecombat.com/t/need-help-on-cleave/1684

Looks like you’re missing a “:”.

You also need to indent it properly:

    if self.isReady("cleave"):
        self.cleave(enemy)
    else:
        self.attack("Chest")
enemy1 = self.findNearestenemy()
loop:  
    if self.isReady("cleave"):
        self.cleave(enemy1)
    else:
        self.attack("Chest")

I tried this but it says “Found a expression but expected a statement: loop” what??? in line 2,
also all of the ‘self’ are in red
and ‘loop’ is not blue.

I thought it was because i changed the programming code but when i checked it, it was still PYTHON (DEFAULT)
i hit save again, and the same thing happened…

Try inserting self.findNearestEnemy() in the loop.
Also i suggest you put a condition if the distance from you to the enemy is less then 10, only then cleave.
Good luck

still says “Found a expression but expected a statement: loop”

someone please help me!!! i have been stuck on this level since 3 days ago…

helpppppppppp please i really want to beat this level… can someone give me a code, i will check it and check what i got wrong in my code I wrote.

@tsepten It was good to check that you were still in Python, but I think it somehow still got you switched to some other language. Can you try switching to Python at the same time as changing your hero?

whenever I put

self.distanceTo(enemy) < 10:

or whatever the code is it says that the parenthesis dont match

I have found that sometimes the error lists the wrong line. You may have problem earlier in your code.

# If the ogres rush at you, cleave them!
# If they stay 10 meters away, attack the "Chest".
loop:
    enemy = self.findNearestEnemy()
    self.distanceTo(enemy.pos)
    if self.distanceTo(enemy) > 10 :
        self.attack("Chest")
    else:
        self.cleave(enemy)
        self.attack(enemy)
        self.attack(enemy)

@ReFinig

that almost worked… It was just that my sword is too weak and I cant buy a new one since i dont have enough gems… the only way is to but extra gems which I will never do.

@tsepten

I don’t know why ppl got problem with gem , I am on the last mission on forest map and still got 1000 gems , and i haven’t bought any sword , use the one u have earned so far and you’re good to go

You don’t need to both cleave and attack an enemy; you can just cleave, which should kill enough of them to scare them off.

THANK YOU SOOOO MUCH!
I HAVE BEEN STUCK ON THIS LEVEL FOR 2 DAYS! :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile: :smile:

i still cant finish it…

It stops in the final hit… if it just hit the chest once more, it would’ve broke<img
just look at the chests health! It stops in the last hit.

almost a week i guess… this level is too hard for me

can someone just tell me the code, i will read carefully in what’s wrong with the code i used.

As you can see in the code i gave you already , i add a normal attack under cleave , so if cleave isn’t enough you gona kill them by attack , that’s it