Yeah, the code compiled successfully. It doesn’t effect the functionality at all, so I moved on to future videos. Here is what my CPP file looks like currently.
#include "Kismet/GameplayStatics.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "ShooterAIController.h"
void AShooterAIController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
if (LineOfSightTo(PlayerPawn))
{
GetBlackboardComponent()->SetValueAsVector(TEXT("PlayerLocation"), PlayerPawn->GetActorLocation());
GetBlackboardComponent()->SetValueAsVector(TEXT("LastKnownPlayerLocation"), PlayerPawn->GetActorLocation());
}
else
{
GetBlackboardComponent()->ClearValue(TEXT("PlayerLocation"));
}
}
void AShooterAIController::BeginPlay()
{
Super::BeginPlay();
if (AIBehavior != nullptr)
{
RunBehaviorTree(AIBehavior);
UE_LOG(LogTemp, Warning, TEXT("Running Behavior Tree"));
APawn* PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
GetBlackboardComponent()->SetValueAsVector(TEXT("StartLocation"), GetPawn()->GetActorLocation());
}
}
And I did check, it runs that log line, but I wasn’t sure what to put in it.