Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Dust help (python)

Um use the code you posted at the top and make it when it’s smaller or equal to 11


Still doen’t work

attacks = 0
while attacks <= 11:
    # Attack the nearest enemy!
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.scattershot(enemy)
        # Incrementing means to increase by 1.
        # Increment the `attacks` variable.
        attacks += 1

# When you're done, retreat to the ambush point.
hero.moveXY(79, 33)

Have you tried switching scattershot to attack()? (For better hit-accuracy)

Yep, still the same thing

change the <= into == and change the 11 into 10 on line 2

Did you try while enemy.health < 0

Both don’t work
20 chars

Try like this:

if enemy:
    while enemy.health > 0:
        attack enemy

Maybe try using flags so ogres won’t attack you?

did you go to the white X? (the ambush point)

Tried it, doesn’t work

Hmm, ill try it

Yes

try changing
while attacks <= 10
to
while attacks < 10

Welp, I solved it, turns out there was an enemy behind the rocks so I had to move to a point where all the enemy could see me
stupid me

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