Loosing Focus

Hey there git a little problem here,

every time i delete the code in the Tick of ShooterAIController:

APawn *PlayerPawn = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);

if(LineOfSightTo(PlayerPawn))

{

    GetBlackboardComponent()->SetValueAsVector(TEXT("PlayerLocation"), PlayerPawn->GetActorLocation());

    GetBlackboardComponent()->SetValueAsVector(TEXT("LastKnownPlayerLocation"), PlayerPawn->GetActorLocation());

}

else

{

    GetBlackboardComponent()->ClearValue("PlayerLocation");

}

→ and replace it with the Blackboard Add Service (Set to Player Location, Blackboard Key PlayerLocation) under the Selector, like suggested in the tutorial → my AI looses the skill to focus/aim. I replaced the “Set default focus” (under Can See Player?/ Chase)mutliple times and its linked to PlayerLocation as blackboard key. Doesnt work this way. Placing back the Tick in ShooterAIController and deleting the Updateplayerlocation gives the focus ability back. Some solutions in the internet suggested reparenting the controller and stuff, but doesnt help for me. Any ideas? Thanks in advance :wink:

Would you mind showing the code that’s not working?

As i understand, the Code isn’t replaced with code but with Blackboard changes instead. Here is the “Add Service” it is replaced with:


You appear to be using UpdatePlayerLocation for both the Selector and Chase instead of having UpdatePlayerIfSeen on the Selector.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms