I wanted to implement simple AI controller. My Orc should walk around and attack the player character when it is in sight.That’s working fine but Orc is still attacking even when the health of his target is equal or below 0. After 3 seconds the actor is destroyed and Orc move on to the next task and that’s ok. How to update the ai perception so it doesn’t attack the target when it’s already “dead”? I suppose my BPs are in wrong place or I use For Each Loop with Break wrong.
Hey, your usage of ForEachLoopWithBreak seems correct. However, is “On Perception Updated” only firing when an actor enter/leave the orc perception range? Maybe that’s why your “clear value” is not fired.
I did a little research and you are right about Event “On Perception Updated”. So I changed a little my BPs and it works now That’s how I resolved my problem:
AI Controller:
I promoted currently perceived actor to the variable. After that I created new task for checking target’s health:
Thank you so much for posting this been stuck for a little while and this severely helped. Also if he drag off your is valid and set the blackboard object to nothing you can keep the dead enemy on the field indefinitely.