AI detect main character's death?

Hi guys, i am currently developing a University Project. And i got the task to developing the AI. So far, i followed 's tutorial and all works fine. But of course, i need to develop it and need some help from you, the community. I’m gonna write different threads for my question. If any of you is a AI enthusiast and willing to teach me here and there, i am really grateful if we can know each other and keep contact more often !

So now straight to my question :

How does AI recognize dead from the actor?

So far in my project, the main character can die from AI attack projectiles. After the main character died, the screen will turn grey (signaling that you are dead) but somehow the AI keep shooting after it dead, because it’s still near the character. (The AI has “Detect enemy Services”, when the main character got near, he will be shot).

My assume is that the AI still shoot the main character because they didn’t notice the main character’s death, instead they noticed it is still a mesh/actor that they still shoot.
Here is my “detect enemy” service from Behavior Tree :


(i used sphere trace channel to implement “search” mechanism if the main character is out of sphere range)

Anybody can help me? thanks a lot !

Hi d00ms,

When your player is “dead”, set their visibility channel to ignore. This should force the ai to ignore the “dead” pawn.

[= ;208076]
Hi d00ms,

When your player is “dead”, set their visibility channel to ignore. This should force the ai to ignore the “dead” pawn.
[/]

That’s a handy tip right there, I’ve been using a bool variable in my playercontroller for that ^^

Hi @,
thanks for replying! But where should i change that? making nodes in player blueprints / in botcharacter blueprints? or there’s some option in detail panels that i can tick/untick ? (I currently have an isAlive function in Player’s Character BP)

[=;208098]
That’s a handy tip right there, I’ve been using a bool variable in my playercontroller for that ^^
[/]

Hey nexy, do you know where should i change that? :smiley:

look at my basic ai project it may help you

Hi d00ms,

You would make the change in your player pawn. Have a custom event that changes visibility to ignore. Once your player reaches 0 health, run the custom event function. I’m assuming you are using Health as your death indicator, which typically means you have an “event Hit” node at some point. This would be a great place to run a branch checking if your player’s health <= 0.