I am trying to make an AI that follows the player around the map using C++ and now im running into this error C2664
here is all my code and the output box
--------------------------------------------------------.cpp file----------------------------------------------------------------------------------------------------
// Fill out your copyright notice in the Description page of Project Settings.
#include “Orcon_Trail_V04.h”
#include “Controller_Bot.h”
#include “BehaviorTree/BehaviorTree.h”
AController_Bot::AController_Bot()
{
BlackboardComp = CreateDefaultSubobject(TEXT(“BlackBoardComp”));
BehaviorComp = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("BehaviorComp"));
}
void AController_Bot::Possess(class APawn InPawn)
{
Super::Possess(InPawn);
ABot Bot = Cast(InPawn);
if (Bot && Bot->BotBehavior)
{
UBehaviorTree* Behavior = Bot->BotBehavior;
BlackboardComp->InitializeBlackboard(Behavior->BlackboardAsset);
EnemyKeyID = BlackboardComp->GetKeyID("Enemy");
EnemyLocationID = BlackboardComp->GetKeyID("Destination");
BehaviorComp->StartTree(Behavior);
}
}
void AController_Bot::SearchForEnemy()
{
APawn* MyBot = GetPawn();
if (MyBot == NULL)
{
return;
}
const FVector MyLoc = MyBot->GetActorLocation();
float BestDistSq = MAX_FLT;
ABot* BestPawn = NULL;
for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It)
{
ABot* TestPawn = Cast<ABot>(*It);
if (TestPawn)
{
const float DistSq = FVector::Dist(TestPawn->GetActorLocation(), MyLoc);
if (DistSq < BestDistSq)
{
BestDistSq = DistSq;
BestPawn = TestPawn;
}
}
}
if (BestPawn)
{
SetEnemy(BestPawn);
}
}
void AController_Bot::SetEnemy(class APawn *InPawn)
{
BlackboardComp->SetValueAsObject(EnemyKeyID, InPawn);
BlackboardComp->SetValueAsVector(EnemyLocationID, InPawn->GetActorLocation());
}
--------------------------------------------------------------------------.h------------------------------------------------------------------------------------------
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include “AIController.h”
#include “BehaviorTree/BehaviorTreeComponent.h”
#include “BehaviorTree/BlackboardComponent.h”
#include “Bot.h”
#include “Controller_Bot.generated.h”
/**
*
*/
UCLASS()
class ORCON_TRAIL_V04_API AController_Bot : public AAIController
{
GENERATED_BODY()
AController_Bot();
UPROPERTY(transient)
class UBlackboardComponent* BlackboardComp;
UPROPERTY(transient)
class UBehaviorTreeComponent* BehaviorComp;
virtual void Possess(class APawn *InPawn);
void SetEnemy(class APawn *InPawn);
UFUNCTION(BlueprintCallable, Category = Behavior)
void SearchForEnemy();
protected:
uint8 EnemyKeyID;
uint8 EnemyLocationID;
};
-----------------------------------------------------------------------output box:---------------------------------------------------------------------------------
1>------ Build started: Project: Orcon_Trail_V04, Configuration: Development_Editor x64 ------
1> Performing 2 actions (4 in parallel)
1> Controller_Bot.cpp
1>C:\Users\VGDAdmin\Desktop\Orcon_Trail_V04\Source\Orcon_Trail_V04\Controller_Bot.cpp(24): error C2664: ‘bool UBlackboardComponent::InitializeBlackboard(UBlackboardData &)’ : cannot convert argument 1 from ‘UBlackboardData *’ to ‘UBlackboardData &’
1>C:\Users\VGDAdmin\Desktop\Orcon_Trail_V04\Source\Orcon_Trail_V04\Controller_Bot.cpp(29): error C2664: ‘void UBehaviorTreeComponent::StartTree(UBehaviorTree &,EBTExecutionMode::Type)’ : cannot convert argument 1 from ‘UBehaviorTree *’ to ‘UBehaviorTree &’
1> -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\VGDAdmin\Desktop\Orcon_Trail_V04\Binaries\Win64\UE4Editor-Orcon_Trail_V04.pdb
if anyone has any ideas or suggestions please help