Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion for section 4.11.2 (custom target actor confirmation type) #119

Open
jign opened this issue Sep 27, 2023 · 0 comments
Open

Suggestion for section 4.11.2 (custom target actor confirmation type) #119

jign opened this issue Sep 27, 2023 · 0 comments

Comments

@jign
Copy link

jign commented Sep 27, 2023

On confirming TargetActors using EGameplayTargetingConfirmation::Custom, the docs suggest using UGameplayAbility::ConfirmTaskByInstanceName

Currently it reads

The GameplayTargeting Ability is responsible for deciding when the targeting data is ready by calling UGameplayAbility::ConfirmTaskByInstanceName(). The TargetActor will also respond to UGameplayAbility::CancelTaskByInstanceName() to cancel targeting.

But sometimes you don't want the ability to tell the target actor that it's ready. For example, you may want to spawn a hitbox for a few seconds and return the first successful hit as target data. Then, the ability couldn't possibly know when to confirm the task, since the ability doesn't know about the internals of the target actor (and shouldn't).

But this function goes through an external confirm pipeline. So in this case where the target actor itself is in charge of filtering and selecting the target data, semantically it seems that using this method is a bit like telling somebody else to tell me to do something.

In my custom target actor, when I have what I want I just call the exec pin directly via the automatically bound TargetActor delegates.

const auto TargetDataHandle{MakeTargetData(Hit)};
TargetDataReadyDelegate.Broadcast(TargetDataHandle);

See AbilityTask_WaitTargetData line 145 to see where the task is binding these delegates

So my suggestion is just adding an extra line to the Custom and CustomMulti types, such as

The GameplayTargeting Ability is responsible for deciding when the targeting data is ready by calling UGameplayAbility::ConfirmTaskByInstanceName(). The TargetActor will also respond to UGameplayAbility::CancelTaskByInstanceName() to cancel targeting.
If the TargetActor is the one deciding when the data is ready, call the delegate directly via TargetDataReadyDelegate.Broadcast(Data) or alternatively CanceledDelegate.Broadcast

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant