I’m having trouble targeting enemies by type in the level i’m working on, because i don’t know the names of the enemy types, and the specific type i’m trying to kill I can’t target to learn its type with self:say(enemy.type).
Specifically i’m working on clash of clones and would like to target the archers.
i’ve tried “archer”, “ranger”, and “thrower”, and none of them work.
However, is there a handy reference where one can look up what each type of enemy is? If not, can someone provide a list of enemies and their types?
You could click on an enemy to see it’s type (basically you click on a unit, then at the bottom it shows that unit’s portrait, name, and type like this):
Just make sure to lowercase the name when you check with unit.type or findByType(type).
On the level Clash of Clones the enemy has the same type of units as you, so you would first need to find your enemies, and then identify the different types:
hi, for enemy.type it says there is an eror. could someone help please here. i have put dashes on the incorrect sentece
while True:
enemy = hero.findNearestEnemy()
# With AND, the type is only checked if enemy exists.
///if enemy.type == "munchkin":///
hero.attack(enemy)
# Find the nearest item.
item = hero.findNearestItem()
# Collect item if it exists and its type is "coin".
if item.type == "coin":
hero.moveXY(item.pos.x, item.pos.y)