Would it make sense to create a Sword blueprint and make it damage on collision? Or how do people create things like this?
Recently I made a Sword blueprint and created a box component to check overlaps and if it overlaps with a Pawn then apply damage to that character. Problem was its not too great especially if it moves too fast or frame rate is low.
Generally speaking. Adding collision to the sword would fine. However most people would say to add a collision sphere to the Character where you want his “attack range” to be. Then you can do something like event begin overlap, cast to (thing you wanna hit), as (thing you wanna hit) promote to variable “MeleeTarget”.
Then on a separate event. Custom event “Swing sword” get MeleeTarget> is valid Bool+Branch= true apply damage.
Hope this helps.
Sorry for the late response, but I noticed that no answer was checked when I came by this question. This is how mine is set up.
In the BP, I just put on Begin Overlap (that way it only does it on the first overlap and doesn’t just sit there hurting the person just touching it, otherwise you can do a Gate Setup that loops itself until OnStopOverlap. Connect the first node of Sequence to the Open node of the Gate, the connect the second node of Sequence to the Enter node of the Gate. Then connect a second Sequence to the exit of the gate. For the first pin, connect it to your damage script, then the second pin of the Sequence to a delay node (so you don’t freeze the game applying too much damage, also this is where you can decide your delay between attacks if you want). Connect this delay exit pin to the Enter of the Gate. Then, just connect the OnStopOverlap to Exit on the Gate.
Blueprint for Attack Once
Blueprint for Attack Continuous
This is all so helpful!
What about swords colliding with other swords and creating a bit of a "bounce effect’ ?