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!
Hello and welcome to codecombat discourse @maryam.ristimaki! 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?
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
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!!
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!
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)
I finally got it to work, with help from my husband haha
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!