[SOLVED] Passing Through


#1

Hi guys! Too bad I’m still stuck on Passing Through. When it said #Else: I looked at the Programmaticon 2 else. But it says if hero is ready cleave. Can you guys help me please?

Thank you all :heart:


#2

You must make an if that will test if your hero is ready to cleave. Is he is ready, use cleave, and else just attack in normal way. Tell if you need more help.


#3

@xantar, the ogres are peaceful.


#4

One of the goals is too “Not insult the peaceful ogres.”


#5

Wait, Ill see the level…


#6

But I will try and tell you if it works. Thanks! :smiley:


#7

Where is the level is on the map? (for example right,up) And what are? (Kithgard dungeon, forest…)


#8

It’s backwoods forest. It’s up and near that silver castle.


#9

Ok…
You don’t make ANYTHING to attack them.
You just need to collect all the gems, following your wolf


#10

But the wolf always stops and Anya keeps getting the gems. I don’t know the code for her not to get them though.


#11

Can you give me your code? Then Ill tell you whats wrong


#12

While True:
item = hero.findNearestItem()
if item:
# If item.type IS NOT EQUAL TO “gem”
if item.type != “gem”:
# Then follow your pet wolf.
hero.moveXY(pet.pos.x, pet.pos.y)
# Else:
if hero.isReady(“cleave”):
hero.cleave(enemy)
else:
hero.attack(enemy)
# Move to the gem’s position.


#13

Btw formatting your code:
You click on the </> button and then write inside the signs,like this
Its much more easier to understand it then
Delete the part about killing ogres (You don’t have to attack them)


#14

I still don’t understand; what are the signs and like this mean?


#15

I will delete the part about killing ogres, @xantar.


#16

When you write your code inside these signs -> ``, its much more clearer. Click the </> button to get them


#17

Instead you should move to gem position using moveXY


#18

Okay. I’ll try that.


#19

And try doing that with the code.

if SwordandShield.hasPostedCorrectly():
    hero.say("Well done!")

#20

:+1: Thanks, @xantar! It worked.