This is a little weird to explain, so I’ll try my best. Basically I’m using an EQS to make my character auto-aim. The system is always searching for a class, and every “target” object is a child of that same blueprint. However, I want to assign different weighs to the child objects. Let’s say that I have object A (enemy) and object B (computer). I want my character to shoot at the enemy (A) first, even if the computer (B) is closer. But when (A) is dead, the system should then target the computer (B).
So basically, I want it to give priority to all objects that are (A) and if there is no (A), then look for (B).
This is also entirely made using Blueprints.
Ideas anyone? I tried using Gameplay Tags, but I can’t edit those for some reason.
I think you should make a function that will return the biggest and closet priority target. The basic design is that first you make an array list of all the class you want to target, ordered by its priority. Then from the top of that list (the class of targets with biggest priority), search for all object of that calss. If there is none or they are too far away, then you continue to work with another class down the list. Else, you return the closet object to your character.
I tried making something like that, but it wasn’t working correctly. I don’t know why, but the function was ignoring the closest enemy when other enemies entered the search radius. Basically it was detecting one enemy at a time, and ignoring the others. Using EQS it works correctly, but I can’t seem to find a way to weigh the targets so it gives priority to the most important ones. Do you know if there’s an example showing how to do that function properly?
Thanks!
Sorry mate, don’t know any example that suit your need. But i think you can improve the solution by not only consider the priority weight, but also the distance. For example, at the start of the function, you may create a temporal variable and assign your first highest priority enemy found into that variable. Then with that temporal variable, consider the current temporal enemy distance and the other enemy distance. Then return the enemy that suit your requirement the most.