How can I track AI's death?

How can I make it so when my 3 AI’s die (Health integer gets to 0) the level simply restarts or loading another level.

Create a public integer variable to allocate the amount of AI deaths. For each dead AI, increment this variable by 1 in its own blueprint. In the third person map blueprint, make an event tick with a branch that checks if the variable is equal to 3. If it is, restart the level or load another one.

Try something similar to what’s in the picture provided.
For this example I declared the function within the Player Character’s Blueprint, which is named FirstPersonCharacter.

To give this functionality for your needs, you’ll need to call this function before the AI is dead from the AI’s blueprint using a cast to the player character’s blueprint. The cast can be done by “Getting” the Player Character node and then dragging out the actor output and releasing in the graph and then searching for your Player Character’s blueprint, for my example I would need a “Cast To FirstPersonCharacter” node and then from the Cast, drag out a node to the graph, release and type “Call Add Enemy Count” and your newly created function should pop up.

Keep in mind if you named your function something else, you’ll need to “Call” whatever name you used for your function

I’ve already tried it, the problem is that I want when AI’s health gets to 0 to destroy actor, and what that does it resets the integer back to 0.

THANK YOU SO MUCH!!! Didn’t know functions can be so useful haha I need to use them more now. Btw I think you made a tiny mistake in your screenshot, 2 of your equations are wrong the less then 2 and less or equal to 3 it should be the opposite :stuck_out_tongue: Anyways thank you!

Somebody just helped me with my problem but in a different way. I still want to try yours, I think I did something similar but a bit different. Like where do I create the Public integer variable and what do you mean increment it in its own blueprint? Shouldn’t I do it in AI’s blueprint?

Ahh yes haha sorry about that! But I’m glad this worked for ya!!

The public variable is created on the level blueprint (in the top bar, go to Blueprints → Open Level Blueprint), and yes, you increment the variable on the AI blueprint.