I’m having an issue where in the build, but not the PIE, after multiple A.I. controlled characters are destroyed all the A.I. characters stop working.
Here’s the code for when a character is defeated
void ABasePlayableCharacter::Elim(bool bPlayerLeftGame)
{
DropOrDestroyWeapons();
SetCombatState(ECombatState::ECS_Dying);
IsDefeated = true;
MulticastElim(bPlayerLeftGame);
}
void ABasePlayableCharacter::MulticastElim_Implementation(bool bPlayerLeftGame)
{
bLeftGame = bPlayerLeftGame;
IsDefeated = true;
bElimmed = true;
bInvulnerable = true;
BrawlerMovementComponent->bWantsToStop = true;
bDisableGameplay = true;
SetCombatState(ECombatState::ECS_Dying);
if (CrownComponent)
{
CrownComponent->DestroyComponent();
}
GetWorldTimerManager().SetTimer(
ElimTimer,
this,
&ABasePlayableCharacter::ElimTimerFinished,
ElimDelay);
}
void ABasePlayableCharacter::ElimTimerFinished()
{
BrawlerGameMode = BrawlerGameMode == nullptr ? GetWorld()->GetAuthGameMode<ABrawlerGameMode>() : BrawlerGameMode;
if (bLeftGame && IsLocallyControlled())
{
OnLeftGame.Broadcast();
}
if (BrawlerPlayerController && !bLeftGame && !IsBotControlled())
{
BrawlerPlayerController->EnableSwap();
if (BrawlerPlayerController->bTeamInitialized)
BrawlerPlayerController->SwapOnDeath();
else
Destroy();
}
if (GetTeam() == ETeam::ET_NPCTeam || IsBotControlled())
{
Destroy();
}
}
The rest of the A.I is handled through Blueprints and blackboards