Blueprint - EQS and Gameplay Tags - I need help!

Is that the only thing that’s missing do you think?

Yes that should be the only thing missing.

How do I implement that on a BP project?

You can’t. You need to implement it in C++. So what you could do, is:

(-) let your blueprint actors inherit from C++ classes (e. g. if your blueprint inherits from “Character”, then create a new C++ class that inherits from “Character”, lets name it “MyCharacterCPP”, then let your blueprint inherit from “MyCharacterCPP”).

(-) inside “MyCharacterCPP” you implement the “IGameplayTagAssetInterface”. So your “MyCharacterCPP.h” can look like this (minimalistic example):

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "GameplayTags.h"
#include "MyCharacterCPP.generated.h"

UCLASS()
class NEWGAMEPROJECT_API AMyCharacterCPP : public ACharacter, public IGameplayTagAssetInterface
{
	GENERATED_BODY()

	// autogenerated stuff -------------------------

public:
	// Sets default values for this character's properties
	AMyCharacterCPP();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

	// ---------------------------------------------


	// Need to store the GameplayTags somewhere. EditAnywhere and BlueprintReadWrite is so that you can add tags in BP.
	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	FGameplayTagContainer GameplayTagContainer;


	// Gameplay Tag Interface implementation

	virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const override { TagContainer = GameplayTagContainer; return; }

	virtual bool HasMatchingGameplayTag(FGameplayTag TagToCheck) const override { return GameplayTagContainer.HasTag(TagToCheck); }

	virtual bool HasAllMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const override { return GameplayTagContainer.HasAll(TagContainer); }

	virtual bool HasAnyMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const override { return GameplayTagContainer.HasAny(TagContainer); }


};

No need to change anything in the .cpp file.

And then you need to include the “GameplayTags” Module in your project. So inside the “InsertYourProjectNameHere.Build.cs” you add “GameplayTags” to your PublicDependencyModuleNames, so mine currently looks like:

PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "NavigationSystem", "AIModule", "OnlineSubsystem", "OnlineSubsystemNull", "OnlineSubsystemUtils", "GameplayTags", "PhysicsCore", "GameplayAbilities", "GameplayTasks"});

I don’t know anymore how much of it was there by default, but you only need to add “GameplayTags” to it =)

2 Likes