Why wont my ai go after more then one player?!

after months of trying to find out how to make a ai be able to go after or even shoot at more then one player I still have not found out how? can anyone help!? can someone at least explain how to do this? I have it doing the things I want it to do to one player I just cant make it do it to more then one player how so do I do this?!(if you need a photo I can do that and a video), its just so weird and so annoying my brain is going to expload, thanks in advanced of the future

It would help if you would show how you select the player the AI should go after and explain what exactly should happen. Should the AI attack player 1 first and then player 2 or should it attack both at the same time?

ok sure but the ai is not done completely but I cant continue tell it can do the same thing to more then one

ok so here are the photos and I explained there ![Google Drive: Sign-in

Well, in your blueprint it is only set up to get the character at index 0, so Player1. It’s hard to help what you should do since we don’t know what your AI should do.

I’m guessing it should go to the closest player, so start by getting all the characters and their locations and distance check with the AI to see which one is closer. Then use this character’s position to do your AI stuff.

ok so how would I do that? would I make it do what you said and what it sees it goes after for example: the player or a different ai?

ok I think I got a idea! so on the look for player I will add a branch and if it doesn’t find the first it looks for the second doing the same thing and it goes on and on, it didn’t work! =(

I tried a idea I got it didn’t work, and also packing doesn’t work you can find what it said at https://docs.google.com/document/d/1LN-haFE8XcVPysdWxMYeWFx2AxYsDrZpGJWujOjFC5s/edit?usp=sharing

What you should do is stop using Player as target. Basically don’t use Get Player Pawn / Player Controller in AI as you are getting only first player. AI should be working with both players and other AIs - thinking this way helps to develop better AI.

Try to use perception system to get targets and then cast to player class or check if it’s locally controlled. Here you can check how to start with perception: Quick AI Perception Jumpstart - Blueprint Visual Scripting - Unreal Engine Forums here is an vid: Unreal Engine Training Livestream - AI Perception & EQS - YouTube

If you checking in game for many instances, like a more than one player or anything else, you have to check all instances and select this you need - for example closest one, with line of sight or any other rule.

Without this checking, your AI will always get last player (or other instance) spawned in world. This is important, because you will face this problem anytime when you will work with many instances - no matter players, AI, items etc.

This should looks something like this:

http://i.imgur.com/wGox9GW.png

This is not final solution, but some start. In this sample, success will be with any actors with distance <=500 and you need of course more data, but always some start.

thanks I will check it out

thanks you hope this works

How would I make thus work for normal sight? Like make it work in the way humans look in one direction? If you know what I mean

hey it works somewhat so how whould I make it go after the player it saw and not try going after both? because when it sees one it trys going to all players on the map