I am switching my project to multiplayer and I am facing some issues with my AI.
It runs on Behavior tree, and the problem goes as follows: The AI uses sight sense, but when I try it with 2 players it is only able to chase/attack the first Client, and always ignores the 2nd one. Any tips?
Sight Function: Screenshot by Lightshot
You are using get player character 0 that is only 1 of the player characters you now have 2. It would be better to test against if it’s a player class than player character, then you wouldn’t care which one it is.
Thank you for the answer. So the problem is the Get Player Character with index 0 right? How can I change it to a whole class? (which nodes should I use?)
remove the comparison of actor == get player character 0
in it’s place compare
actor.getClass == your player actor class
I tried using Get All Actors of Class “Character”, but then I can only use a “For Each Loop” to get an Object Reference, and plug it in the == node (see screenshot), but it doesn’t work.
In the second screenshot I gave a tag “Player” to my character, and tried something that also didn’t work.
No you need to get the actors class (the purple variable). Literally type in get class once you pull out from the actor pin
Sorry but some of these things are really new to me
If I did this right, it’s still not working. Screenshot by Lightshot
(still attacks only 1 of the players, while with my previous changes it wouldn’t attack anyone)
Finally! Thanks for the help and patience man. Have a good one
No problem. Happy coding.