Hello everyone. I just finished studying the simple shooter chapter and I have a problem. The fact is that the AI does not react to me in any way, I did exactly like in the video tutorials.Pls help me
This screenshot shows Player is “None”, where do you set that?
Could you tell me where to install it? apparently I missed it
It should be in BTService_PlayerLocationIfSeen.cpp
It was done towards the end of the lecture “BTServices In C++”
Could you try adding logs to each branch to see what’s getting executed?
I can, but tell me how to do it because I’m already completely confused
I’m saying to add UE_LOG
statements at all points in that function.
void UBTService_PlayerLocationIfSeen::TickNode(UBehaviorTreeComponent &OwnerComp, uint8 *NodeMemory, float DeltaSeconds)
{
Super::TickNode(OwnerComp, NodeMemory, DeltaSeconds);
UE_LOG(LogTemp, Warning, TEXT("PlayerLocationIfSeen service is running"))
APawn *PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if (PlayerPawn == nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("Player == nullptr"))
return;
}
if (OwnerComp.GetAIOwner() == nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("OwnerComp.GetAIOwner() == nullptr"))
return;
}
if (OwnerComp.GetAIOwner()->LineOfSightTo(PlayerPawn))
{
UE_LOG(LogTemp, Warning, TEXT("See player"))
OwnerComp.GetBlackboardComponent()->SetValueAsObject(GetSelectedBlackboardKey(), PlayerPawn);
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Don't see player"))
OwnerComp.GetBlackboardComponent()->ClearValue(GetSelectedBlackboardKey());
}
}
I don’t know why but it helped
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.