Hey I have BlackBoard in my c++ code what is trying to get float woda from kwiatek but it doesn’t get it. I think it is because I create blueprint from this class in c++ code and blackboard in ai controller is created first but not sure and I don’t know how to repair it.
// Fill out your copyright notice in the Description page of Project Settings.
include “GardenerAIController.h”
include “Kismet/GamePlayStatics.h”
include “kwiatek.h”
include “Gardener.h”
include “BehaviorTree/BlackboardComponent.h”
void AGardenerAIController::BeginPlay()
{
Super::BeginPlay();
if (AIBehavior != nullptr)
{
RunBehaviorTree(AIBehavior);
FVector FirstKwiatekLocation(200.0f, 0.0f, 0.0f);
GetBlackboardComponent()->SetValueAsVector(TEXT("kwiatekLocation"), FirstKwiatekLocation);
FVector FirstKwiatekLocation2(1100.0f, 0.0f, 0.0f);
GetBlackboardComponent()->SetValueAsVector(TEXT("kwiatekLocation2"), FirstKwiatekLocation2);
}
}
void AGardenerAIController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if(AkwiatekInstance)
{
UE_LOG(LogTemp, Warning, TEXT("dziala"));
float WaterLevel1 = AkwiatekInstance->woda;
float WaterLevel2 = AkwiatekInstance2->woda;
GetBlackboardComponent()->SetValueAsFloat(TEXT("WaterLevel1"), WaterLevel1);
GetBlackboardComponent()->SetValueAsFloat(TEXT("WaterLevel2"), WaterLevel2);
}
}