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


#1

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


#2

here is my code


#3

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


#4

he still attacks everyone


#5

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


#6

YAY I did it yay, thanks.