# [SOLVED]Distracting dungeon help

``````def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)

peasant = hero.findNearest(hero.findFriends())
while True:
# Command your friend to build a decoy towards x + 1:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
nextPoint = {"x": hero.pos.x, "y": hero.pos.y + 28};
moveBothTo(nextPoint)
# Create a new x/y dict +28 units away in the x dir:
nextPoint = {"x": hero.pos.x + 28, "y": hero.pos.y}
# Find the nearest enemy:
hero.findNearestEnemy()
# While there is an enemy:
while enemy:
# While the enemy's health is > 0:
while enemy.health > 0:
# Attack the enemy:
hero.attack(enemy)
# Update the variable to the next nearest enemy:
hero.command(peasant, āmoveā, tDest)
hero.wait(3)
moveBothTo(nextPoint)

``````

try saving this to a variable

1 Like

oh forgot bout that (20 cahr)

``````enemy = hero.findNearestEnemy()
# While there is an enemy:
while enemy:
# While the enemy's health is > 0:
while enemy.health > 0:
# Attack the enemy:
hero.attack(enemy)
# Update the variable to the next nearest enemy:
hero.command(peasant, "move", nextPoint)
hero.wait(3)
moveBothTo(nextPoint)
still
``````

still not workin 20 chars

Try making these an āif statementā

1 Like

alr # Update the variable to the next nearest enemy
wht should i do?

``````def moveBothTo(point):
while hero.distanceTo(point) > 1:
hero.move(point)
hero.command(peasant, "move", point)

peasant = hero.findNearest(hero.findFriends())
while True:
# Command your friend to build a decoy towards x + 1:
hero.command(peasant, "buildXY", "decoy", peasant.pos.x + 2, peasant.pos.y)
nextPoint = {"x": hero.pos.x, "y": hero.pos.y + 28};
moveBothTo(nextPoint)
# Create a new x/y dict +28 units away in the x dir:
nextPoint = {"x": hero.pos.x + 28, "y": hero.pos.y}
# Find the nearest enemy:
enemy = hero.findNearestEnemy()
# While there is an enemy:
while enemy:
# While the enemy's health is > 0:
if enemy.health > 0:
# Attack the enemy:
hero.attack(enemy)
# Update the variable to the next nearest enemy:

moveBothTo(nextPoint)

``````

i change the code into this

Try making this an āif statementā too

1 Like

hero keep moving at yeti

Then do,

``````if enemy.type!='yeti':
``````

EZ PZ.

1 Like

I have a question, have you took an IQ test before?

Bro please just stop posting off topic things.

3 Likes

clears throat. Thatās a bit rude, also, itās ātakenā not ātookā.

2 Likes

Ok. @Coder3 (20 chars)

peasant keep getting killed

Hmm, Iāll try entering the level myself if itās not a āsubscription requiredā level.

1 Like