Basically, my cleave code… i dont know what do do with it. It just says If you want to call hero.isReady as a function you need parentheses but i already have parentheses
heres my code:
# Help your friends beat the minions that Thoktar sends against you.
# You'll need great equipment and strategy to win.
# Flags might help, but it's up to you–be creative!
# There is a doctor behind the fence. Move to the X to get healed!!
while True:
enemy = hero.findNearestEnemy()
flag = hero.findFlag("green")
if enemy and enemy.type == "munchkin" and cleave == "ready":
hero.cleave(enemy)
else: hero.isReady("cleave"):
hero.attack(enemy)
elif enemy and enemy.type == "ogre":
hero.say("EEEK!")
hero.moveXY(19, 69)
if flag:
hero.pickUpFlag(flag)
Why don’t you use the bottom code in the top example? The correct way to check if something is ready is if hero.isReady(“cleave”).
Again, I’ll say the exact same thing. The bottom usage of elif is correct. Else doesn’t take a condition (like if something is ready). Use elif like in the second bit of code.
Danny
Wait a sec. I tried to do that but then realized im trying to say “If the cleave isn’t ready, attack” to the game. On the other hand, thanks for the Elif.
Such a cruel world)
But a lot of people prefer not to respond if they have nothing to say in order to not create junk messages.
In other words, which of your posts you’d like to be replied?
Also, all that is wrong with my code is
1:elif hero.isReady("cleave"): hero.attack(enemy)
2:if enemy and enemy.type == "munchkin" and hero.isReady("cleave") hero.cleave(enemy)
# Help your friends beat the minions that Thoktar sends against you.
# You'll need great equipment and strategy to win.
# Flags might help, but it's up to you–be creative!
# There is a doctor behind the fence. Move to the X to get healed!!
while True:
enemy = hero.findNearestEnemy()
flag = hero.findFlag("green")
if enemy and enemy.type == "munchkin" and hero.isReady("cleave"):
hero.cleave(enemy)
elif hero.isReady("cleave"):
hero.attack(enemy)
elif enemy and enemy.type == "ogre":
hero.say("EEEK!")
hero.moveXY(19, 69)
if flag:
hero.pickUpFlag(flag)
I would suggest simplify this part and leave only smth like
if enemy and hero.isReady("cleave"):
Self.cleave
I started this level with 844 HP. And I didn’t ran from ogres. Don’t think you need too.
How much health does your hero have? @WaWa_Yang is right, saying something always take a little time. Some spare seconds are important.
358 i dont have premium so i cant get that really good armor, i used the say for no reason, but ogres typically do 30 or 40 damage per hit, and munchkins do… what, five? So if i get hit by X number of munchkins and i now have 250 health, i can afford to lose a little bit on the trip to the doctor. I think i will use an attack and cleave against ogres.