- Home /
How Can I make an instance select a random enemy and move toward?
Hello, guys.
I'm really having a bad time here. I wanna make a medieval strategy game, where you'll get several army battles, but I'm struck in a issue.
Imagine a battlefield with many soldiers, and you'll just watch the fight. All what I need is: How Can I make an instance select a random enemy and move toward? Got it? An ally soldier will pick an enemy soldier and vice versa, Can you guys help me? Thanks in advance.
Answer by TruffelsAndOranges · Nov 28, 2014 at 11:26 PM
Keep all references to all instances of the soldiers in a specific "team" in a list or array. Then just pick a random index from the array and fetch the reference to the soldier you picked. Then use Unitys navmesh to make every soldier attack/do whatever you want him to.
So far só good. Thank you, now I'll get some solution to avoid pick the dead soldiers
Your answer
Follow this Question
Related Questions
Enemy Damage 2 Answers
ENEMY HEALTH BAR 1 Answer
How can I more optimize My AI Script 0 Answers
problem with LookRotation on simple AI 0 Answers
Tennis game like Grand slam tennis 1 Answer