C. Using Agate GAS Component
Setup Your Game Mode
- Open Your Game Mode Blueprint (for example, I will use the default ThirdPerson GameMode).
- Change Player State Class to be AGASPlayerState.
Setup Character that Using GAS
- And then open your Character Blueprint (I will also used the default from ThirdPerson Template).
- Select Class Settings at the top menu, and change the parent class to be AGASCharacter.
- Still on the Character, move to Class Defaults, search AgateGAS. You will find some config like:
- Default Attribute: Must be set, will be used to define which attributes the character should have, and also used to define their initial values.
- Initial Abilities: Used to define the initial abilities of the character, you can define this later after you create the active/passive ability.
- Initial Effects: Same as initial abilities, but used for the attributes, for example, the character want to have some buff or debuff when they are spawned.
- Input Mapping: This just a helper for you initializing the new enhanced input system with your Input Mapping, so you just need to create the Input Mapping and assign it here, no need to do in Blueprint again
- So, let's back to Content Browser and create an attribute set for your Character. You can create the directory as you want to organize it, but for me, I create an Attribute folder.
- Right click there and create a Blueprint Class with GameplayEffect as parent, name it let's say GE_CharacterAttribute.
(You can see more naming rules in GAS here). If you still take the AgateGASExample directory, you can also find some attribute example there. - Open it and make some modifier, for example, we would created like Level, Health, and Mana. For any attribute that has Max Attribute, you should only define the max attribute (for this case, they are Health and Mana which have MaxHealth and MaxMana).
From above image, we define the Level as 1, MaxHealth as 100, and MaxMana as 50 (you can see the value at Scalable Float Magnitude). - Back to Your Character Blueprint, and assign the default attribute with attribute set that you've just created.
- When you click Play, you should see the attribute changed at Output Log which means what you've just set is already worked.
No Comments