diff --git a/Unreal/PS_AI_Agent/Plugins/PS_AI_Behavior/Source/PS_AI_Behavior/Private/PS_AI_Behavior_AIController.cpp b/Unreal/PS_AI_Agent/Plugins/PS_AI_Behavior/Source/PS_AI_Behavior/Private/PS_AI_Behavior_AIController.cpp index 68a2f27..c6bf8eb 100644 --- a/Unreal/PS_AI_Agent/Plugins/PS_AI_Behavior/Source/PS_AI_Behavior/Private/PS_AI_Behavior_AIController.cpp +++ b/Unreal/PS_AI_Agent/Plugins/PS_AI_Behavior/Source/PS_AI_Behavior/Private/PS_AI_Behavior_AIController.cpp @@ -368,14 +368,22 @@ ETeamAttitude::Type APS_AI_Behavior_AIController::GetTeamAttitudeTowards(const A } } - // 3) Fallback: check if Pawn implements IPS_AI_Behavior_Interface → derive TeamId from NPCType + // 3) Fallback: check if Pawn implements IPS_AI_Behavior_Interface → derive TeamId from NPCType + Faction if (OtherTeam == FGenericTeamId::NoTeam && OtherPawn->Implements()) { const EPS_AI_Behavior_NPCType OtherNPCType = IPS_AI_Behavior_Interface::Execute_GetBehaviorNPCType(const_cast(OtherPawn)); if (OtherNPCType != EPS_AI_Behavior_NPCType::Any) { - OtherTeam = PS_AI_Behavior_Team::MakeTeamId(OtherNPCType); + uint8 OtherFaction = 0; + if (const auto* OtherPersonality = OtherPawn->FindComponentByClass()) + { + if (OtherPersonality->Profile) + { + OtherFaction = OtherPersonality->Profile->Faction; + } + } + OtherTeam = PS_AI_Behavior_Team::MakeTeamId(OtherNPCType, OtherFaction); } } }