Please can you help me with this level - I don’t understand what is making my code wrong!!!
while True: enemy = hero.findNearestEnemy() # Attack only skeletons AND skeletons that are on the "ogres" team. if enemy and enemy.team == "ogres" and enemy.type == "skeleton": hero.attack(enemy) item = hero.findNearestItem() # Take only the items with a "potion" type AND only when your health is less than a quarter of the maxHealth. if "health" < 650: hero.moveXY(item.pos.x, item.pos.y)
.1. Items have types just like enemies.
.2. If you have at least the Quartz Sense Stone you should be able to access
thanks but what do you mean by hero.health and stuff - I do have the quartz sense stone
When having the quartz sense stone equipped try placing the following syntax in the front of your code:
hero.say("The hero’s maxHealth is : " + hero.maxHealth)
hero.say("The hero’s current health is : " + hero.health)
Right now you are simpering a string literal with a numeric. You want to be comparing like with like data types.
Thanks I have solved both my problems due to your help