Hi, i was trying to learn something about EQS based on Ali Elzoheiry youtube tutorials called “Smart Enemy AI Tutorial series”. I watched some of his videos and decided to finally try to do something by myself.
I wanted to create Enemy with behavior like: Begin the game in seeking state (that means, look for the closest actor other than player and move to it). When you’ll get closer or get damaged by that other actor or player, switch to CombatState during which, you’ll check if you can see the TargetToAttack and attack him while moving around. If you can’t see him, do something else (i’m not sure what to do here yet, but it’s not important rn). My current behavior tree looks like that:
Seeking state works fine and my Enemy is running towards given location. When he reaches it and see other actor, or when other actor enters his line of sight before he reaches the given location, he switches state to Attacking, but instead running around detected actor and attacking it, he’s standing in one place and behavior tree starts looping. In “Evade and Attack” sequence, everything works until “Run EQS Query” node, because at this point something doesn’t work and other 3 nodes are not even executed (the sequence starts again from the beginning “FocusAtTarget” node). It looks like this:
Overall, my EQS itself looks pretty much the same as in mentioned youtube tutorials, with only small details changed (like distance to querier minimum value etc.). Here’re some screenshots in case if somebody don’t know videos i’m talking about (EQS and my ContextAttackTarget):
I have no idea what might be causing the problem, so i decided to ask for help here. I already tried looking for the source of the problem by myself, but i really don’t know what that might be. When i try using the debugger with aposthrope button and enable EQS, i can’t see any points, as if they won’t exist. I also tried removing that EQS node from behavior tree and simply put there MoveTo with TargetToAttack as Blackboard key and when i did that, it worked. When i connected EQS node back, the only thing i noticed and that i find unnusual is that i can’t use print string in that ContextAttackTarget blueprint to print the TargetToAttack value. I can print everything else, but when i try to print TargetToAttack node, there’re no messages (as if such thing wouldn’t exist).
I’d be really greatfull for any ideas how to solve that problem or what might be cousing it.
Hi, in the behavior tree you use the output of the EQS query to set a variable of type Actor. But the EQS query outputs something of type Vector. That might be an issue. You could try to write the output of the EQS query to the PointOfInterest variable (which is of type Vector).
If that also does not work, try with a simpler EQS query (just a generator, to make sure that there are any points generated) and do some prints in the context to check that its valid
I tried doing as you said, but it didn’t work. You were probably right about changing TargetToAttack to PointOfIntrest in my EQS_FindIdealRangedLocation, but the behavior tree is still looping at this point. What’s more, even when i try to use that new EQS (that only generates points) the result is the same: behavior tree is looping and points are probably not generated at all, because in debugging i can’t see them.
I think there really is something wrong about my TargetToAttack variable, because i tried to make some print strings to check things out and again, i can print everything, but when i try to do it with TargetToAttack value, it’s not working, as if that variable will be empty.
I added print strings again in the Context and the result of that looks like that:
Instead of using the AI Controller, try using the controlled pawn (return the controlled pawn in ResultingActor). Cause the EQS query will use the position of the returned actor, which is likely meaningless in case of a Controller.
I once again did as you said, and it did work this time. The thing is, i wanted my EQS to be spawned around actor who was seen or who attacked the enemy and not the enemy itself.
However, thanks to you i was able to fix some smaller mistakes (like the one with using Actor variable as output of EQS instead vector one) and i figured out that the origin of my problem is located not in behavior tree or context for eqs, but in the AI Controller. All this time i was trying to set TargetToAttack variable in the wrong place, so it wasn’t working as it should. I moved that one thing somewhere else (to more suitable part of the function) and now it’s working as it should (both my previous EQS and the new, test one as well).
Thank you very much for your time and all divices. Without you, I probably still would be looking for problems in behavior tree