Handling death using GAS

Hello, I’m wondering how I should handle death using gameplay ability system.

I have a health component that is using a set consisting of 2 fields - health and max health. I track whenever these two fields change, but I’m not sure what has to be responsible of triggering a death start state; I want to have two death related states – death start and death end: the former means that a character is playing its death animation, while the latter means that the animation has ended.

I thought about switching on death start state when new health value becomes non-positive, and will demand the client (the character that’s using the health component) keep track of the death animation, and tell the component whenever it terminates. However, this approach seems a little bit messed up since it requires different code to handle one thing.

Does anyone have any suggestion? Thanks for reading.

I would do like this :

  1. In your character that has ability system component bind on adding or removing the “State.Death.Start” and “State.Death.End” tags. The example : AbilitySystemComponent->RegisterGameplayTagEvent(FGameplayTag::RequestGameplayTag(FName(“State.Debuff.Stun”)), EGameplayTagEventType::NewOrRemoved).AddUObject(this, &AGDPlayerState::StunTagChanged);
  2. In health component if health <= 0 then send tag “State.Dead.Start” to the owner.
  3. In character function that handle the tag “State.Dead.Start” should play death montage.
  4. Death montage should has “notify” at the end of the montage and anim blueprint is applying tag “State.Death.End”.
  5. Character is has function that handling adding the “State.Death.End” tag. And in function destroy the actor.