Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

List of Enemy Types?


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).


I figured it would be something simple like this. thank you


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:

enemyArchers = self.findByType("archer", self.findEnemies())

If you don’t have the findByType() method, you can do it this way:

enemies = self.findEnemies()
enemyArchers = []
for enemy in enemies:
    if enemy.type == "archer":
        # append it to the list

Or with list comprehension (warning! advanced trickery! :smile:)

enemyArchers = [enemy for enemy in self.findEnemies() if enemy.type == "archer"]


this is helpful, thank you, but what if you do not know the enemy unit type? Like for example a yak, which type would that be?


it would be a yak. that’s the enemy type. The name is the enemy type itself.


If you don’t know the enemy type, just click on it, as explained about 3 comments above

it would be a yak. that’s the enemy type. The name is the enemy type itself.
Wrong. The enemy type for yaks is “sand-yak”.


Yeah that’s what I meant, thanks for clearing that up! :+1: