Soarino
(Soarino)
March 22, 2018, 12:12pm
6
CoquiGames:
Looks like you are comparing the team ID with itself. You are pulling team ID and saying is this teamID DIFFERENT than this teamID. This will always be false (they are the same). You want to compare the teamID from the array element and the teamID of the local NPC.
I am doing NPC vs NPC in my current project and Im doing things a bit different:
Im using AI Perception component on each NPC to detect other pawns in sight. Then I filter all seen pawns by tag (teamID)
Then I compare the local tag with the sensed actor tag and if they are different I make that actor the enemy.
Another recommendation - try not to use Get All Actors with Tag at runtime (its very expensive). Use Perception AI or a smaller sphere trace to get nearby pawns and do your filtering with that list. It will make a big difference if you have a lot of NPCs running around.
This is a sample of what Im working on in case you are curious:
https://www.youtube.com/watch?v=qV1n6-WqhXY
Let me know if you have any other questions.
Hope this helps!
Thanks for the help! but im having trouble setting up a system in which you suggest.
The pawn sensing works great but its setting up the tag flitering im having issue with, could i see an example of how your AI filters the tags?
This was my attempt at it, i removed the team two filter in this screenshot.
Also i have a AI character and a AI controller