[SOLVED] I'm stuck at Backwoods Forest

Hi! I’m a new member at code combat and so far loving it! But now I’m really stuck, I’ve been trying for hours and days but I’m not getting forward… Please help, maybe it’s something I just don’t see or it might be a bug?

Backwoods Forest, same problem with “Arcane Ally” and “Munchkin Harvest”.
Your supposed to use If/Else Statements and while True to get trough this level, also on “Munchkin Harvest” I need to upgrade my armor, which I have done. Lots of new armor…
When starting this level, Arcane Ally says “Stand your ground against large orges with a new hero: Ms. Hushbaum” and at Munchkin harvest it says “Join forces with a new hero: Amara Arrowhead”, the problem is that when I go to change hero, I cannot change to either one of them, it says that both of them are restricted at this level…

This is how my code looks like:

while True:
    enemy = hero.findNearestEnemy()
    if hero.isReady("cleave"):
        hero.cleave(enemy)
        
    else:
        hero.attack(enemy)
   

I have tried having two attack statements aswell but this doesn’t work either.
(it does not show here how many “space” I’ve used after the while True statement but there is no code problem with that when I run the game, so I just fail to survive because of some reason I cannot understand just yet…) Help please! :slight_smile:

@stephanie

Please format your code using the </> button.

Hello and welcome to codecombat discourse @maryam.ristimaki! :partying_face: This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Can you please format your code as it is described below so we will be able to help you solve the level? And can you please send us a screenshot of the heroes problem?

Andrei

Also, on what specific level are you stuck on? Backwoods forest is the forest in general.

Oh, sorry. I’m at Level 20

What title does it have?

The code that I’ve posted was on “Munchkin Harvest” but I have the same problem with “Arcane Ally”, as it says above.

Sorry, I did not know this was a sub-only level. I am also on iPad so I have no clue what this level looks like. Please ask @AnSeDra for more help.

Okay, thank you anyways! Hope to get help from @AnSeDra then, or someone else who can solve this problem for that matter :slight_smile:

1 Like

I think @PeterPalov might be able to help. He used to be a subscriber

@maryam.ristimaki can you please try to do this first?

Andrei

The problem is that in both of your statements you haven’t checked if the enemy exists. If it doesn’t, you’re cleaving and attacking nothing, which will cause an error.
About the heroes, you’re only playing with them, as in along side them or next to them hence arcane ally. You only get to play with them if you buy them and are subscribed.
Danny

2 Likes

Welcome welcome @maryam.ristimaki to the forum! It is a lovely place where you can share all kinds of stuff (appropriate of course), share bugs, and even get assistance for code! We suggest that you review this topic which shows all essentials of this board! And we suggest you review this topic which shows how to post your code correctly! Thanks!! :partying_face: :partying_face:

Put all of this inside

if enemy:

Lydia

2 Likes

Thank you so much for all your help! :slight_smile:

1 Like

Thanks @Deadpool198 , I will try to find how to buy them then! Haha I feel really lost right now but I will continue to try and change the code and maybe I’ll figure it out! :wink:
This is how I’ve tried to change the code now with your help but It does not work:

while True:
    enemy = hero.findNearestEnemy()
    if hero.isReady("cleave"):
        hero.cleave(enemy)
        
    else:
        hero.attack(enemy)
    

I’ve also tried to change the code with (as @Lydia_Song suggested)

    if enemy: 

But this doesn’t work either…

1 Like

Can you send us a fresh copy of your code?

Andrei

1 Like

But this doesn’t look any different from the original, have you changed it yet?
Danny

2 Likes

I finally got it to work, with help from my husband haha :wink:
First of all I had to change my statement from

    enemy = hero.findNearestEnemy

to

    enemy = hero.findEnemies()

Also I had to change my sword, the sword I had changed to didn’t have the “cleave” function, so no wonder it didn’t work! Haha…
Thank you all for the support and help! :heart_eyes: :star_struck:

4 Likes

Anytime! And congratulations for completing the level! :partying_face:

Andrei

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.