Combat State

EquipmentComponent allows to track whether owner is in combat or not, and what combat type it is.

Why do we need it? As example let’s analyze player’s blueprint (BP_CombatCharacter).
We want it only to allow actions like attack / parry / backstab etc. when is in combat.

That's why in CanMeleeAttack function there is a check if character is in combat.

There are different combat types, current one depends on equipped weapon.
CombatType is being updated in function UpdateCombatType.

  • Unarmed - when owner is in combat but has no weapon
  • Range - when owner is in combat and has bow equipped
  • Melee - when owner is in combat and has melee weapon equipped
  • Magic - when owner is in combat and has spell equipped

Why do we need to know what CombatType owner is in?
Few Examples

  • Player can only perform melee attack if combat type is Unarmed or Melee.
  • Player can only attack with ranged weapons (bow) when combat type is Range.