Sure, here’s some stuff to get you started:
First, we relied heavily on the [AnimMontage] and [AnimNotify] systems. You’ll want to read those docs to get a feel for the terms involved.
Basically each melee weapon type has it’s own montage. So a sword attack may have a different montage than a hammer attack, etc. In the montage there are multiple sections, with one section for each attack, and sections for the transitions back to idle. Then, we made several custom blueprint-based AnimNotifies and AnimNotifyStates. The docs talk a bit about them, you can make a blueprint subclass of AnimNotify or AnimNotifyState and they will show up in the montage editor when you right click the event track.
So, we made a notify for starting a “decision window” and used a branch point to end the “decision window”. In the event for starting a window we define which section to jump to if the user clicks, fails to click, etc. Then at the decision window we run native code to jump to the appropriate section. Then, we also made a notify that means “do melee damage”, and when it hits that point it calls native code to actually apply damage. You could also do it in blueprint if you wanted to. Here’s a fairly complicated montage, that has all the setup for a full combo with a few different branches. TriggerDelayedSkill is what does the damage, and PlayMeleeSwingFX plays some effects.
Each of those StartDecisionWindow notifies were set up as blueprints that take parameters, so you can click on them from the montage view, and you get to specify parameters like so:
Lastly, here’s what that notify blueprint looks like. We set up a bunch of variables and then wire them up to call a native function defined on our player pawn:
When it goes to actually do the damage, the trace logic used by fortnite is actually really complicated and game specific, so not worth going into detail. Basically it does a bunch of capsule traces, figures out what it should hit, and then does damage to the targets. Anyway, that’s the basics of how you can use montages to make a melee system in UE4.