[SOLVED] I need help with lvl 46 cs3 medical attention

this is my code

while True:
currentHealth = hero.health
healingThreshold = hero.maxHealth / 2
# If your current health is less than the threshold,
# move to the healing point and say, “heal me”.
# Otherwise, attack. You’ll need to fight hard!
if currentHealth < healingThreshold:
hero.moveXY(65, 46)
hero.say(“heal me”)
else:
enemy = hero.findNearestEnemy()
hero.attack(enemy)

this is the problem it shows

i need this tomorrow by 7:00 so can sombody post the code plz

Hello and welcome to codecombat discourse! 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!

1 Like

Hi @jonthebrick, CodeCombat was made to learn to code, so please do not simply ask for solutions. :slight_smile:

2 Likes

Can you format your code using the </> button? Thanks :slight_smile:

1 Like

Since you need it for tomorrow, ive formatted it for you(next time do as @cheddarcheese and @Rachel699 said pls)

while True:
    currentHealth = hero.health
    healingThreshold = hero.maxHealth / 2
    # If your current health is less than the threshold,
    # move to the healing point and say, “heal me”.
    # Otherwise, attack. You’ll need to fight hard!
    if currentHealth < healingThreshold:
    hero.moveXY(65, 46)
    hero.say(“heal me”)
    else:
        enemy = hero.findNearestEnemy()
        hero.attack(enemy)
3 Likes

This is a simple problem, you just need to make the else statement look like this

    else:
        enemy = hero.findNearestEnemy()
       if enemy:
           hero.attack(enemy)
2 Likes

I’m pretty sure those are the Chinese quotes, instead of the quotes the system was built to recognize.
Try change those quotes to these: “”

I can’t really tell though- o.O

3 Likes

isnt it

if banana:
    hero.say("banana")
else pinaple:
    hero.say("pinaple")

If you have an if with no else, nothing happens when there is no enemy.

2 Likes

I know what I am doing. Look at it this way, if you don’t meet x this happens, but only if this person is here. Do you understand?

what in the world is that

Please don’t fight @WaWa_Yang @milton.jinich. you are here to help @jonthebrick not fight about who is right or wrong.

I know, I am trying to explain the concept of what I am suggesting.

chinese quotation marks :slight_smile:

1 Like

Ok that is fine but look.

You make it SOUND like you are trying to fight.

i meant this post :man_shrugging:
the code

2 Likes

I understand what you are trying to say. And @098765432123 I was trying to make sure that everybody would understand what I was saying.

Like I said that is fine but some people may take something like that as an offence. I am just making sure that you to don’t fight while you are helping someone. End of discussion. If you want to continue talking to me please take it to a PM.

I understand. This would also solve the problem:

1 Like