Known Enemy bug? [SOLVED]

Known Enemy Level code stops running after killing the first enemy. Will not run to second or third enemy. Editor arrow literally stops at second instance of “hero.attack(enemy1)” and will not throw any errors or warnings, just stops (Used both Chrome and Firefox). Here is my code:

enemy1 = “Kratt”
enemy2 = “Gert”
enemy3 = “Ursa”

hero.attack(enemy1)
hero.attack(enemy1)

hero.attack(enemy2)
hero.attack(enemy2)

hero.attack(enemy3)
hero.attack(enemy3)

This should work. Hmmm @maka can help you, he fixes bugs.

Hey thank you very much for the swift reply. I will reach out to him.

What weapon are you using? I want to know this because you could have a weapon that kills on one hit, such as the sharpened sword. If you are using that, then your hero should say something like “But… It’s dead!”. You can fix this by simply reducing the amount of times that you hit an ogre, like instead of hero.attack(enemy1) hero.attack(enemy1), just take away one hero.attack(enemy1) and this is the result: hero.attack(enemy1). If this isn’t the case, I can’t help you.

Test to see if your weapon is a one hit weapon by deleting all the default code and typing just one “hero.attack(enemy1)”. Also, you can’t bash. it just doesn’t work.

1 Like

instead of saying enemy1, just use the name itself inside the attack like this:

hero.attack("Kratt")

Do you mind pasting the console messages here? Or take a screenshot of it?

Thank you for the help this i did get a response from the console. It threw an error saying to use a variable.

Ducky I was using the simple katana which is a one strike weapon. I modified my code to reflect your suggestion and it works. Thank you very much!

And thank you all for the out pouring of support in helping me resolve this issue. You guys are awesome!

1 Like