Above is the translation of the document from Korean to English:


title: “Implementation of Unreal GAS Attack Judgment System” date: 2024-04-03T13:53:44+09:00 image: img/unreal.svg

tags: [“Unreal”, “언리얼”, “UE”, “GAS”, “Ability”] categories: [“Unreal”] series: [“Gameplay Ability System (GAS)”]

This content is summarized based on the lectures by Lee Deuk-woo and documents compiled by other developers.

For detailed and accurate information, please refer to the above links.

Series

GAS Fundamentals

GAS Character Creation Basics

Attributes and Gameplay Effects

  • Unreal GAS Character Attributes
  • Unreal GAS Gameplay Effects
  • Linking Unreal GAS Attributes with UI

Utilization of GAS

  • Implementing Unreal GAS Item Box
  • Implementing Wide-range Skills in Unreal GAS

This post explores sending attack judgment timing to GAS using Gameplay Event and TargetActor, implementing attack judgment within the GAS.

Gameplay Event

In GAS, there is a functionality called GameplayEvent that notifies GAS of a specific event by specifying a GameplayTag. The table below shows what can be done in GAS using GameplayEvent.

Method Description
UAbilitySystemBlueprintLibrary::SendGameplayEventToActor When a specific event occurs, it notifies the actor about it and can activate GameplayAbility using it.
UAbilityTask_WaitGameplayEvent::WaitGameplayEvent It waits for the task until a specific event occurs. Various information related to the event can be passed to the Ability waiting for it.

We will look into how to activate an ability for attack judgment using the SendGameplayEventToActor method. We will implement this in the following sequence:

Creating Event Tags

Create a Gameplay Tag for events as Character.Action.PunchKick.

Creating and Relaying Notifies

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class ARENABATTLEGAS_API UAnimNotify_OnPunchKick : public UAnimNotify
{
	GENERATED_BODY()
public:
	UAnimNotify_OnPunchKick();

protected:
	virtual FString GetNotifyName_Implementation() const override;
	virtual void Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, const FAnimNotifyEventReference& EventReference) override;

	UPROPERTY(EditAnywhere)
	FGameplayTag TriggerGameplayTag;
};

FString UAnimNotify_OnPunchKick::GetNotifyName_Implementation() const
{
	return TEXT("OnGASAttackHit");
}

void UAnimNotify_OnPunchKick::Notify(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation,
	const FAnimNotifyEventReference& EventReference)
{
	Super::Notify(MeshComp, Animation, EventReference);

	if(MeshComp)
	{
		AActor* Owner = MeshComp->GetOwner();
		if(Owner)
		{
			FGameplayEventData EmptyPayload;
			UAbilitySystemBlueprintLibrary::SendGameplayEventToActor(Owner, TriggerGameplayTag, EmptyPayload);
		}
	}
}

Use the SendGameplayEventToActor method to relay the event during the animation to the Actor.

Next steps involve the creation and utilization of TargetActor in GAS for attack judgment. This includes detecting possible target actors within a specified range in front of the player during an attack. By following the outlined steps and sequence, you can enhance attack judgment in your game with GAS.

Please let me know if you need any further information or clarifications!

Licensed under CC BY-NC-SA 4.0