(python) how do you make my guy ignore sand-yaks?


#1

I cant figure out a way to ignore yaks they are always getting in my way
i just cant define it for some reason( it says the other one is, but its not i checked)
the other ones work exept when i add the sand-yak one


while True:
thrower = self.findNearest(self.findByType(‘thrower’))
shaman = self.findNearest(self.findByType(‘shaman’))
fangrider = self.findNearest(self.findByType(‘fangrider’))
headhunter = self.findNearest(self.findByType(‘brawler’))
ogre = self.findNearest(self.findByType(“ogre”))
sandyak = self.findNearest(self.findByType(“sand-yak”)
if thrower:
self.attack(thrower)
if shaman:
self.attack(shaman)
if fangrider:
self.attack(fangrider)
if headhunter:
self.attack(headhunter)
if ogre:
self.attack(ogre)
if sandyak:
self.moveXY(28, 68)
else:
enemy = self.findNearest(self.findEnemies())
if enemy:
self.attack(enemy)


#2

Read the FAQ before posting code. It will tell you how to format it properly

The error message in your code is because you forgot a ) at the end of line 7.

It should read:

sandyak = self.findNearest(self.findByType("sand-yak"))

#3

ok i solved it thanks