the .h file
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "BehaviorTree/BTService.h"
#include "BTService_CheckforPlayer.generated.h"
/**
*
*/
UCLASS()
class MEUPROJETO_API UBTService_CheckforPlayer : public UBTService
{
GENERATED_BODY()
public:
UBTService_CheckforPlayer();
virtual void TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds) override;
};
the .cpp file
// Fill out your copyright notice in the Description page of Project Settings.
#include "MeuProjeto.h"
#include "BTService_CheckforPlayer.h"
#include "MyAIController.h"
#include "BehaviorTree/BehaviorTree.h"
#include "BehaviorTree/BehaviorTreeComponent.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/Blackboard/BlackboardKeyAllTypes.h"
#include "Enemy.h"
UBTService_CheckforPlayer::UBTService_CheckforPlayer()
{
bCreateNodeInstance = true;
}
void UBTService_CheckforPlayer::TickNode(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory, float DeltaSeconds)
{
AMyAIController *me = Cast<AMyAIController>(OwnerComp.GetAIOwner());
if (me)
{
ACharacter *Player = Cast<ACharacter>(UGameplayStatics::GetPlayerCharacter(GetWorld(),0));
if (Player)
{
OwnerComp.GetBlackboardComponent()->SetValue<UBlackboardKeyType_Object>(me->PlayerId,Player);
//OwnerComp.GetBlackboardComponent()->SetValueAsObject("Target", Player);
}
}
}
and the errors:
CompilerResultsLog:Error: Error BTService_CheckforPlayer.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)
CompilerResultsLog:Error: Error MeuProjeto.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)
CompilerResultsLog:Error: Error BTService_CheckforPlayer.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl IGameplayTaskOwnerInterface::OnGameplayTaskDeactivated(class UGameplayTask &)” (?OnGameplayTaskDeactivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)
CompilerResultsLog:Error: Error MeuProjeto.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void __cdecl IGameplayTaskOwnerInterface::OnGameplayTaskDeactivated(class UGameplayTask &)” (?OnGameplayTaskDeactivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)
CompilerResultsLog:Error: Error C:\Users\marco\OneDrive\Documentos\Unreal Projects\MeuProjeto\Binaries\Win64\UE4Editor-MeuProjeto-4343.dll : fatal error LNK1120: 2 unresolved externals