Getting Started with UE4/5 GAS Skill System 3 - GameplayEffect

Reading this article requires the basic knowledge of the previous AttributeSet:
https://blog.csdn.net/grayrail/article/details/132148492

This article is not a tutorial article, it mainly explains + learning records.
This article starts to talk about the use of GameplayEffect after the AttributeSet is configured.

1. Configure GE to Ability Cost

First, modify the previously created test skills and add the GA prefix to make the naming more standardized:
insert image description here
in the GAS system, Ability (single skill) allows configuration information of Cooldown (skill cooling) and Cost (skill consumption).
Let’s configure skill consumption first, create a GameplayEffect class named GE_HpCost, and configure it to deduct 5 points of health when executing:
insert image description here
Modifier in GameplayEffect indicates the modification operation when executing the GE.

Then bind the GE to the GA:
insert image description here

Under the test, the HP is reduced when the skill is triggered:
insert image description here
if the HP value is less than the skill consumption, for example, if the HP is 2 and the skill consumption is 5, the skill trigger will fail. Such a design conforms to conventional logic.

2. Configure Ability's Cooldown

Next, configure skill cooling, create a new GameplayEffect class named GE_Cooldown, set the parameter Duration Policy to Has Duration, indicating that this is a skill effect that lasts for a period of time, set Duration Magnitude to 3, indicating that the duration is 3 seconds: return to the skill class
insert image description here
GA_Ability1 , configure the Cooldown:
insert image description here
At this point, you will find that the skill can still be executed repeatedly, without being affected by the cooling time:
insert image description here
this is because the Tag has not been configured, and how to configure the Tag will be explained next

3. Configure the Tag of Cooldowns

Go back to Project Settings and add Tag —— AbilityCooldown:
insert image description here
Set Block Abilities with Tag in GA_Ability1, and set AbilityCooldown:
insert image description here
it means that when there is an AbilityCooldown Tag, this skill will be Blocked and the execution will fail.

Finally, at GE_Cooldown, add the Granted Tag mark, indicating that the Tag will be added when triggered:
insert image description here
after execution at this time, it will be found that the trigger will fail if the cooldown time is not reached.

3.1 Read the remaining value of Cooldown

Now that the cooling time is set, it is necessary to read the cooling time value and display it to the UI. We can get the current GE through Get Active Gameplay Effect for Query, and then read the specific parameters from the GE handle: return the correct cooling time after
insert image description here
execution information:
insert image description here

おすすめ

転載: blog.csdn.net/grayrail/article/details/132229263