Signal Corpse Help Needed


#1

Hello,

So I need some help on the level “Signal Corpse”. Here is my code but, I don’t think it’s the problem.
I’m able to defeat all of the ogres except for the two large ones. It seems that I need many hits to kill them yet they only need about 4 to kill me, making it impossible to win. Any help?

while True:
    green = hero.findFlag("green")
    black = hero.findFlag("black")
    nearest = hero.findNearestEnemy()
    
    if green:
        hero.pickUpFlag(green)
    elif black and hero.isReady("cleave"):
        hero.pickUpFlag(black)
        hero.cleave(nearest)

    elif nearest and hero.distanceTo(nearest) < 10:
        hero.attack(nearest)
        
        pass

#2

Hi, jackattack825!

Thank you for formatting part of your code correctly. Could you include the rest in the code section of your post?

Thanks!


#3

I can’t seem to reformat it correctly. I have tried surrounding it in triple backticks like this:

"```python"
But it isn’t working. By the way just imagine that below the “while True” the parts about the flag are indented in once.


#4

@nick @Bryukh

Somebody help please


#5

Code looks good; sounds like you just need more armor to do the level, since you can’t take on medium ogres yet. If you pick up a good breastplate, shield, or helmet to get more hit points, you may have more luck.


#6

I agree with Nick. To be sure, could you post your equipment list? You can share it as a screenshot - it will be enough. That way we can check it.

Or use a direct message (or slack) here to send your email which you are using for CodeCombat account.


#7

Thanks guys. I figured it out. I thought that in the equipment menu it is required to have a premium account to use the items that cost gems. I also didn’t realize I had gems.


#8

Hey! I’m having trouble passing Signal Corpse. I was wondering if you would be able help me figure out whats wrong.
Heres my code:

loop:
green = self.findFlag(“green”)
black = self.findFlag(“black”)
nearest = self.findNearestEnemy()

if green:
    self.pickUpFlag(green)
    # Cleave!
elif green and self.isReady("cleave"):
    ready = hero.isReady("cleave")
    self.cleave(enemy)
elif nearest and self.distanceTo(nearest) < 10:
    # Attack!
    enemy = hero.findNearestEnemy()
    self.attack(enemy)
    pass

#10

You have two conditional statements involving a green flag and none for the black flag. The central idea of this level is to have your hero do two different things depending upon which flag you use. The instructions are in the comments.


#11

Ah, okay thank you! I’ll try that.


#12


#13

this is your code:

if green:
   hero.pickUpFlag(black)

It’s null because when you place a green flag, there is no black flag.


#14

Sorry! Late respond, but thank you it worked!:hugs: