#Access target in AbilityTask

2 messages · Page 1 of 1 (latest)

winter wigeon
#

Hello everyone, i have a question about the course. Im at the video number 115. And for targeting system, instead on doing hit on cursor trace every tick im saving the target on a click event. The problem is that when i want to send the target location in AbilityTask it fail on the client side because on the client the IEnemyInterface ThisActor is null.

Do you have any idea on how i could achieve this and send the target saved in ThisActor property to client and server ability task so that i can place a sphere on my target in client and server ?

Here is the code for the activate method in the task :

void UTargetDataFromPlayer::Activate()
{
    ARPGCharacterPlayerController* RPGPlayerController = Cast<ARPGCharacterPlayerController>(Ability->GetCurrentActorInfo()->PlayerController.Get());
    AActor* Target = Cast<AActor>(RPGPlayerController->ThisActor);
    FVector TargetLocation = Target->GetActorLocation();
    ValidData.Broadcast(TargetLocation);
}

If you have any questions do not hesitate 🙂

thanks !!

winter wigeon
#

Still searching for help