HowTo Implement GamePlayCue in C++

Hi

Looking for help on implementing c++ gameplay Cue.
Here is what i have so far, but it never gets called. Only th ctor gets called

UCLASS()
class AC_JumpGameplayCue : public AGameplayCueNotify_Actor
{
	GENERATED_BODY()
	
	AC_JumpGameplayCue();
	
	virtual void HandleGameplayCue
	(
		AActor* in_pMyTarget,
		EGameplayCueEvent::Type in_eventType,
		const FGameplayCueParameters& in_rParameters
	) override;
};



AC_JumpGameplayCue::AC_JumpGameplayCue()
{
	GameplayCueTag = FGameplayTag::RequestGameplayTag(FName("Ability.Cue.Jump"));
}

void AC_JumpGameplayCue::HandleGameplayCue(AActor* in_pMyTarget, EGameplayCueEvent::Type in_eventType, const FGameplayCueParameters& in_rParameters)
{
	Super::HandleGameplayCue(in_pMyTarget, in_eventType, in_rParameters);
	GLog->Logf(	TEXT("Jump Handler Called event id = %d"), in_eventType);
}


I try to get the cue to run by calling execute on it inside ability

pGasComp->ExecuteGameplayCue(mvo_jumpAbilityCueTag);

Any tips much welcome cheers

Bump

TagName should be started with “GameplayCue”
ex. GameplayCue.Jump

Thanks i already changed the tag name as suggested , but it does not resolve the question of what is the epic official solution to c++ gameplaycue. An implementation example.

My c++ gameplaycue never ever gets called, even with the correct tag, but my bp gameplaycue works, you just create a bp cue give it tag name and you can refer to it anywhere, but same does not work for c++ cue.

cheers

This is issue is still unresolved

The Cue works if its in blueprint.

But if its c++ Cue it does not work, meaning HandleGameplayCue never gets called , when other code calls Add,Execute, Remove etc on the cue.

Any tips as to how to implement gameplaycue in c++ much welcome

cheers

Hi @anonymous_user_669611a5,
I’m curious if you ever figured this one out. I’m running into the same issue where my C++ GameplayCue is never called, but making an equivalent Blueprint GameplayCue works just fine.

The only other thing I added in addition to what you had was an override for UGameplayCueNotify_Static::HandlesEvent, but that’s not called either :confused:

Thanks in advance for any help or ideas!

Hi Everyone,

After reviewing the code for the GameplayCueManager, I think I have found the problem.

There is a helper struct named FGameplayCueObjectLibrary that handles loading GameplayCues. It has two attributes for loading the assets into memory: ActorObjectLibrary and StaticObjectLibrary, both of which are of class UObjectLibrary.

In GameplayCueManager.cpp:787, they are initialized with LoadBlueprintAssetDataFromPaths(), which only loads assets from Blueprints.

There is another function called LoadAssetDataFromPaths that may help, but I wasn’t able to override the function InitObjectLibrary in a subclass (I could redefine it for my Subclass, but it wasn’t called due to it not being virtual in UGameplayCueManager).

I’m not even sure if the function LoadAssetDataFromPaths would work here.

Perhaps someone else has an idea to work this out.

My alternative was declaring the GameplayCues in C++ and inheriting from them with a BlueprintClass. This way, I was at least able to write the Cues in C++ (because of my aversion to Blueprints).

1 Like

Out of all the dumbass â– â– â– â–  this engine does on the regular, this has to be up there, no? Why does this CueManager thing even need to exist?

Having to create these Blueprint Cue “Handlers” is a joke :rofl:, also, hilariously, those BPs cannot be renamed. They have to be GC_[YourGameplayTag]. If you do rename it, the next time you open the editor, it will have unlinked itself from the GameplayCue Editor, and you’ll have to redo it all over.

So the steps to make it work with C++ are:

  1. Go to Tools → GameplayCue Editor
  2. Handlers → Add New (This will create a BP called GC_[YourGameplayTag] inside a hardcoded, random af GameplayCueNotifies folder. DO NOT RENAME THE BLUEPRINT!)
  3. Move the BP to a proper folder that you need it to be in.
  4. Open it and do Class Settings → Parent Class, and re-parent it to YOUR custom C++ GameplayCue.
  5. Pray to god, that for some BS reason something doesn’t break again.
  6. Vomit all over yourself because there’s no way to make it work with C++ only.

Don’t forget that your cue tags MUST all start with GameplayCue.[YourGameplayTag] cause it’s hardcoded somewhere probably.

WHAT kind of wacky tobacky where they smoking, when they came up with this â– â– â– â– ?