Getting Winscreen even with enemies left

I’ve had 5 enemies within my level before creating the win screen and win condition of killing all of the enemies. When I got to testing it, I would win, even with 4 enemies left. I didn’t see any issues with my code, and messed around with the editor.

I duplicated an enemy near me, and had to kill both of them to win. But it still didn’t recognize the other enemies in my level. I know I can go through and just make more enemies, but I was just curious as to why it recognizes duplicated enemies after I implemented the code, but not the ones from before.

Did anyone else have this issue and was able to resolve it? I’m putting in ShooterCharacters and if I don’t destroy them in a particular sequence I’ll win regardless of how many are remaining.

Ensure that the EndGame(true) is outside the for loop.

for (AShooterAIController* ControllerAI : TActorRange(GetWorld()))
{
if(!ControllerAI->IsDead())
{
return;
}
}
EndGame(true);
}

1 Like

I had a problem with additional characters. The additional BP_Characters placed in the world would not react. I had to explicitly put in their Pawn details that it should be possed by the BP_ShooterAIController as it was picking up a default AI controller.

Privacy & Terms