How do I check if pawn is alive in blueprint

How do I, after I’ve spawn a wave of bots, check if they are dead or alive, or rather destroyed?


Below is how I’ve set up the spawning, I want to be able to check if the bots are dead as to create another wave of bots later on.

Take the return value on the spawn node and use it to set a variable. Add that variable to an array or whatever if you have many of them.

Then you can reference the actor whenever you want for whatever you need.

Okey, so I promote the return value of the SpawnAIFromClass to a variable and the reference the this variable to check if the AI is dead or alive. But what functions can I use to check this?

I tried to set an int varible=1 when the AI are destroyed in the blueprint for the AI and then check the Int value after the spawnAIFromClass in the level blueprint but I didn’t get that to work.

I’ve tried with a isValid function referencing the Spawn return value but that didn’t work.

Is that something that might work in another way?

Stuck on the same thing here. IsValid is not helpful in this case. Anybody?

i am wondering if you ever figured this out… i’ve been able to do this somehwat but using a get all actors of class, and then checking if they are dead, but this is only works for 1 of the items in the array, and i cant make it work for the entire length…

Sorry, I gave up on this a long time ago, never got it to work. Best of luck to you

I actually did get it working a few minutes ago, what I did is create an array in my game mode called total enemies, and then everytime I add an enemy to the level he casts to the game mode and gets added to that array… and then when the enemy is dead , he casts again to the game mode and removes himself from the array…

What was the Array type? Integer? Actor Object? Class Type? I’m trying to do something similar but for a pinball game. I’m trying to get multiple balls at once but can’t get it to check to see if there are 0 ball left on the table before spawning a new one.

Neil, the arrat type was of a class called basecharacter which i made and is the parent of all my enemies and players, in your case the array type should be of the ball pawn type… every time you spawn one add it to the array which you can hold in your game mode

let me know if you understood i can show you in bps as well

Plz post a pic of ur blueprints I’m stuck