Well, neutrals is a list, so neutrals.id does not exist. You have to use the first name from that list: use an index.
Further on, you have a hero.findEnemy() statement, which is again incorrect and incomplete. It should be an assignment, like neutrals = hero.findEnemies() (not findEnemy) if it’s needed at all.
Cheers
ps: oh yes, and next time format your code properly, between three backticks, as described in the FAQ
Ok, Think l get it, but l don’t what to write in hero.say(?).
I did it when it come to names, but not in order, one after another. So, peasants get angry.
Can you tell me what exactly can l do about that.
PS. English is not my native language, I probably made some mistakes. I hope you can understant me well.
I still don’t get why I’m not saying the neutrals name. here is my code.
// Call peasants one after another.
// Neutral units are detected as enemies.
var neutrals = hero.findEnemies();
while (true) {
if (neutrals.length) {
// Say the first unit in the neutrals array
hero.say("message");
} else {
hero.say(neutrals[0].id);
}
// Reassign the neutrals variable using findEnemies()
var enemies = hero.findEnemies();
}
I have tried hero.say() many different ways and i still never say anything other than "nobody to bump my gums at"
I try it befor and don’t do anything, just go on else statement.
Thanks anyway, l will try to go back and understend better, or rest some
time of coding.