Thanks. That got me a bit closer, but I’m still dying. I’ve selected all the items you said. Do i need to use some sort of shield function for the shield to actually work?
You could use hero.shield(), which is a command that makes you take less damage for a certain amount of time, but you cannot counter attack. There are very rare cases where shield can be used effectively.
The shield just gives you extra health in combat, that is all.
Can you send me a screen of your hero and gear you are using?
Thank you to everyone who helped. My code was right yesterday, I just needed to add the helmet and bronze shield.
Omg Thanks so much helped me so much ur great
Thanks very mouch! #solved
Still not sure why this does not work for me
Reason: Can’t attack with hero.attack(enemy)
No one can assist you if you don’t post your code.
I am having trouble betting this level also my char cleaves just fine but wont attack after the else statement
Hi, it’s because in the first if, you’re checking for an enemy. What happens if there’s always an enemy but you’re not ready to cleave? It won’t go to the else because there is an enemy.
Hi Sonic101light. Welcome to Discourse! There’s a couple of things that need to be done to get this code to work.
First, line 9,
ready = hero.isReady("cleave")
You’ve defined a variable, ready
, but then you never use it. But that’s okay because this line is supposed to check if the hero is able to cleave. We have to check to see if this is possible because cleave has a ten second cooldown period. It cannot be used during the cooldown so we check if it is “ready.”
if hero.isReady("cleave"):
Also, line 13 is an issue. You are already inside a while True
loop and you don’t need another one. If you look at line 12, it tells you that the next line should be an else
conditional. Lines 14 and 16 aren’t necessary because you’ve already defined enemy on line 6.
One more thing - while it is fun to make the hero say fun stuff (I do it sometimes as well), remember that any time you use hero.say("say stuff")
, it consumes a full second of time. It’s up to you to decide when you can do this and when you simply don’t have the time to do so.
It does not work when i do it, or the code
@Proskils7 please show us your code so we can see the problem. Also please be specific about your errors.
when i write the code to attack the nearest enemy at the last line, it does not attack
Hi @ItzYourNightmare, welcome to the CodeCombat Discourse.
If you’re having problems with you code, please post it on the discourse; formatted properly (instructions here: [Essentials] How To Post/Format Your Code Correctly)
Thanks
Danny
Thanks mate, very helpful
This is stupid it dose’t work i tried it. this sucks angry
dose’t work it a rip off don’t use it
Hi @Jannelle_Westersea, welcome to the forum.
What doesn’t work? Is it someone else’s code?
If you need help with a level, please post your own code and describe your problem. Make sure your code is formatted like it says here:
Thanks,
Danny