Melee


Melee is simply doing damage to characters if they reside within a certain distance to the melee damage dealer.


Different Methods:

  • Weapon Collision with Components
  • Capsule Overlapping Actors

Capsule Overlapping Outline

in PlayerCharacter class

  • With in PlayerCharacter class making character class with a Capsule component that is wide enough to "overlap" potential melee recipients.
  • triggering the start of our damage method via an input
  • getting overlapped actors and applying damage


in the EnemyCharacter class

  • processing incoming damage, decrementing health, and checking for death


Make a Capsule in your PlayerCharacter Class

Melee Capsule.jpg



In the Player Character Graph, Damage Overlapping Characters

Melee OverlapDamage.jpg

Ignore the branch and its condition, setting IsAttacking will be used in the animblueprint, the delay i used so that damage was dealt mid way through my swinging animation.

Then using the MeleeCapsule shown before is used to get all overlapping actors, but i changed the purple pin to class filter so it would only hit "myEnemyChar" class.

Then simply pushing that thru a for loop, it will do damage to all Enemies. MeleeDamage is simply a float that i set elsewhere. (default is 45)




Finally Process the Damage inside the EnemyCharacters Class

Melee EnemyRecieveDamage.jpg

Here is just converting the float to an int for subtracting from current health, checking if health is too low and kill the actor.

Animation based melee system

Here's a bit of info about how fortnite uses montages and anim notifies to do a animation-based melee combo system: https://answers.unrealengine.com/questions/43365/fortnite-melee-combat-system.html