I have no idea what you are trying to accomplish here but say only has one parameter you pass in, a string of text for your character to say. You can not force it to attack from a say. and i’m not sure what you are trying to do with the defend one.
Actually, in the Dungeon Arena level only, they do listen to you, and you can pass more parameters. The second parameter has to be an object, though, and you are missing one or both curly braces in your examples. Try like this:
This code - self.say(“Defend!”, {“targetPos”: {x: 10, y: 20}}) - works well, many thanks, but
this self.say(“Attack!”, {“target”: boss}) - don’t work. My units continue attacking nearest enemy.
please, see and test my code. I simplify it:
friends = self.getFriends()
enemies = self.getEnemies()
if enemies.length is 0:
____return # Chill if all enemies are dead.
enemy = self.getNearest(enemies)
friend = self.getNearest(friends)
def whois(arrays, types):
____for i in arrays:
________if i.type == types:
____________return i
boss=whois(enemies,“brawler”)
if boss and self.distance(boss.pos)<20 and not self.getCooldown(“terrify”):
____self.terrify()
else:
____self.attack(“Ogre Base”)
____self.say(“Attack!”, {“target”: boss}) - “”“(boss.id, boss.name did not work too)”“”
Please, check this, and help me to understand this features about self.say().