GASify
  • Introduction
  • Overview
  • Installation
  • Basic Usage
  • Ability System Component (ASC)
    • Attributes
    • Attribute Processors
    • Targetting System
  • Gameplay Ability (GA)
    • Gameplay Ability Implementations
    • Creating New Abilities
  • Gameplay Effect (GE)
    • Modifier
    • Calculation (GEC)
    • Behaviour (GEB)
  • Gameplay Tag
  • Gameplay Cue
  • Data Groups
  • Cookbook 🥣
  • Multiplayer / Networking
  • Contact & Note
Powered by GitBook
On this page
  1. Gameplay Effect (GE)

Behaviour (GEB)

Any mechanic/behaviour not covered by manipulating attributes, tags, or GECs, can still be implemented with a GameplayEffectBehaviour (GEB). (e.g. A mind control ability: We want to swap the controller input for the ASC. We do it by putting the code that swaps controllers in a GEB) A GEB has several hooks so you can add any code behavior you want at certain parts of the ability processing:

OnInstant(GameplayEffect ge) // OnInstant is only triggered from Instant/Periodic GEs. Meanwhile, the other methods are only triggered from Duration/Infinite GEs.
OnAddThis(GameplayEffect ge) // When the effect with this GEB applies on the ASC. e.g. Mind control, switch the movement controller here.
OnRemoveThis(GameplayEffect ge) // When the effect with this GEB is removed on the ASC. e.g. Mind control, return the original movement controller here.

OnAnyGameplayEffectApplied(GameplayEffect ge) // When any GE is added.
OnAnyGameplayEffectRemoved(GameplayEffect ge) // When any GE is removed.
OnAnyGameplayEffectsChanged(List<GameplayEffect> ges) // When any GE is applied or removed. e.g. Ability Cooldown Modifying GEB, recalculate the ability cooldown duration here.

OnAttributeChanged(AttributeName attributeName, float oldValue, float newValue, GameplayEffect ge)  

SerializeAdditionalData() //Multiplayer serialization
DeserializeAdditionalData() //Multiplayer serialization

Example of an GEB that applies another GE, when the current GE is removed:

public class ApplyEffectOnRemoval : GameplayEffectBehaviour {
	[ReadOnly] public AbilitySystemComponent targetASC;

	public GameplayEffectSO geSO;

	public string geSO_Name;
	public override void SerializeAdditionalData() {
		geSO_Name = geSO.name;
	}
	public override void DeserializeAdditionalData() {
		geSO = GameplayEffectSOLibrary.Instance.GetByName(geSO_Name);
	}

	public override void OnAddThis(GameplayEffect ge) {
		targetASC = ge.target;
	}

	public override void OnRemoveThis(GameplayEffect ge) {
		targetASC.ApplyGameplayEffect(targetASC, targetASC, geSO.ge.Instantiate(), ge.applyGUID);
	}
}
PreviousCalculation (GEC)NextGameplay Tag

Last updated 1 year ago