My hero isn't attacking king of skeletons, because I don't know his type

I told hero to tell me every name of those skeletons but everybody’s name popped up except king’s

here is my code

The skeleton king cannot be attacked until the majority of his minions are defeated. He has no enemy type, but rather just the name “Skeleton King”. Instead of listing the enemies that you want to attack, try listing the enemies that you DON’T want to attack, as such:
if(enemy && enemy.type != "sand-yak")
which basically says “if there is an enemy and it’s not a sand-yak”.

1 Like

he still attacks everyone

My bad, it should be “sand-yak” not “sand yak”. Edited my original post

YAY I did it yay, thanks.