Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

How do I make findnearestenemy the soldiers enemy? [Solved]

I dont know the syntax, could somone help?

You use:
soldierEnemy = soldier.findNearestEnemy()
It doesn’t have to be soldier, you just have to use the variable which you’ve defined the your singular friend as.
So in:

for friend in friends:

The line would be friendEnemy = friend.findNearestEnemy()
It’s that simple :grin:!
P.S. make sure you don’t just use enemy = friend.findNearestEnemy(), because that might get confused with the variable enemy that you’ve already defined (if you have, that is).

Thanks a bunch! I now have a lot more firepower for summits gate, hooray!

1 Like

My pleasure. If you have any more questions about tactics and stuff like that, feel free to ask.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.