Enemy tag stuck on a dead enemy

As you can see, my character does not apply “def weakestenemy(enemy):”

This problem starts when the shield condition starts.

I would like to have a character that can bash the enemy when its ready and stay in shield but his “enemy” is dead and doesnt retarget to other enemy, idk why.

i removed 100hp condition from the bash definement but still the same

By looking at the picture I think I know whats happening. The tags of all your enemies are appearing in an array (the have the [#] thing in their name) but you dont have a for loop to control/target every one.
To attack every enemy in an array, you would use something like

while True:
    enemies = hero.findEnemies()
    for enemy in enemies:

Using hero.findEnemies() creates an array of all enemies, but you aren’t targeting them one by one. I think. (someone who understands python better come help. arrays are my least favorite thing coding besides parenthesis)


Aside from that issue, lets take a look at whats up with your bash command. The thing that mainly confuses me is that bash() is already a command, so I dont see the point of defining this? After all you could check in your while loop the health of the enemies…

Actually i have a loop to target every one. Its “def weakestenemy(enemy)” which marks “enemies” as “enemy”. it marks the lowest max hp among the enemies. i guess now i understand. the last enemy has over 1.7k max hp. thats why my target doesnt become him. but why not "sand-yak"s ?

the hp shouldn’t matter, but I dont see what you mean by sand yaks

using bash multiple times, so its better to define i think

the rightmost horned creature xd

mm hmm. Reducing code is always nice

1 Like

"but why not “sand-yak"s ?” Can you explain this to me? O wait heck I’ll be out for an hour (im in school rn) try to explain it ig? and I’ll get back to you

sand-yak has 500hp. my “weakestenemy(enemy)” chooses the lowest max hp as enemy, 2 non-friend lives, 1.7k max hp player and 500hp sand-yak. the target should be sand yak and it must be marked as “enemy” but i shouldnt attack because my condition is if enemy.type != “sand-yak”

BRO I have len(enemies) = 1 and len(friends) = 1 so… WHY THE HELL AM I STILL ON SHIELD AND DONT CHANGE “ENEMY” FROM THE DEAD BODY?

Why this game still counting the dead ones? Is this game is broken? im getting tired of this.

Okay, calm down please! I’ll summon a few to see if they can help you out. @abc, @Anonym, @Eric_Tang.


Currently cant see what you said but you have to first check if the enemy exists and if its health is over 0/

1 Like

Thanks @enPointe77 ! Appreciate the help!


My enemy exists but dead and his health becames -20 or smth after killing it. But the point is that my “enemy” mark stucks on it as you can read it from the Title, why my target ( i mean “enemy” mark ) does not change after i killed the target? Thats the question

Do you understand what i mean?

I said make sure the enemy health IS BIGGER THAN 0

1 Like

Sir, im aware of that, i did my best to be aware of that. But which part do you mean that i must be sure that enemy health is bigger than 0?My codes are given in the picture, may you take some time on it and give me more clear answer. When “enemy” tag is given to enemy, its health is bigger than 0. How can i be sure the enemy’s health is bigger than 0 when its dead? I am saying third time. After killing it, why my target does not change? If you try to be more specific i’ll be very happy about that.

Do you know how to use if operations like bigger than or equal or smaller than.

I know, but i couldn’t find the right place to use it for the solution of this problem. Could you show it with a proper answer please?