Munchkin Swarm : Help!


#1

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")

#3

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 “:”.


#4

You also need to indent it properly:

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

#5
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…


#6

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


#7

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


#8

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


#9

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.


#10

@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?


#11

whenever I put

self.distanceTo(enemy) < 10:

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


#12

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


#13
# 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)

#14

@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.


#15

@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


#16

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.


#17

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:


#18

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.


#19

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


#20

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


#21

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