Get the original instigator after an effect creates an ability on a target

I have a bullet that hits a character, that bullet does damage over a period of time, when it ends it adds another temporary effect that adds an ability to the target that fires another bullet, that bullet will of course hit another character, etc. ie. Chain bullet.

How do I inform that second bullet that it belongs to the player who fired the first bullet?

Or put another way:

When an effect creates an ability on another actor, does the ability know who the source/instigator of the original effect was?

you could save a ref to the instigator on your effect, or dont destroy the bullet, just disable it and then enable it instead of spawning a new bullet

1 Like

Did a bit of digging through the code and it seems what I need just isn’t exposed to Blueprint. Here’s the code to put in your <overridden>GameplayAbility.h:

	UFUNCTION(BlueprintPure, Category=Ability, DisplayName="Get Current Ability Spec")
	FGameplayAbilitySpec BP_GetCurrentAbilitySpec() const
	{
		return *GetCurrentAbilitySpec();
	}
	
	UFUNCTION(BlueprintPure, Category=Ability)
	static int GetAbilityLevelFromSpec(const FGameplayAbilitySpec& Spec)
	{
		return Spec.Level;
	}

	UFUNCTION(BlueprintPure, Category=Ability)
	static UObject* GetSourceObjectFromSpec(const FGameplayAbilitySpec& Spec)
	{
		return Spec.SourceObject.Get();
	}
1 Like

Thanks for the reply, but I’m after a cleaner solution that works more in line with GAS. I dug through the code and found the information I want actually does get passed around, we just can’t access it through blueprint. If you’re curious I posted the code I used and marked it as the solution.

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