How To Create Hand To Hand Combat In Unreal

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up guys in this video we are going to create simple punching or hand-to-hand combat system for your game in unreal I'm gonna be using a third person template but you can use first person or any other if you want to the process is going to be the same so first we are going to need an animation if you followed any of my other combats tutorials then you're gonna know that we need animation Montage so we are gonna right click our animation then we are gonna go into create and then create animation montage and you can name it whatever you want I'm just gonna leave it as default and open it once you have your animation open we can pause it and I'm gonna want to add a new notify track so we have two of them so we are gonna right click other notify new notify and I'm gonna call this punch begin and then I'm gonna right click and add another notify and I'm gonna call it punch end then we just want to line them up with the punching animation so about here I want the punch to begin and then I wanted to end right after so we don't have too much of a space between we can save this and we are gonna go into the content browser we are gonna right click and we are gonna create blueprint interface so Blueprints and blueprint interface and I'm gonna call this hand to hand and we can open this then once you have it open we want to create two functions the first one is gonna be punch start function and then we are going to click on the plus and add the second function which is going to be punch end function compile it and save and we are going to go into our character blueprint and I'm just gonna quickly go into class settings under interfaces I want to search for my hand to hand and we are going to add that interface we just created and we are going to go into our viewport and we need to add a collision to our punches so we are going to select the mesh and click on ADD and then search for sphere and we want the sphere Collision then we want to attach it to the socket so I'm just gonna search for hand I'm gonna just attach this to the right hand and then under sphere radius I'm gonna lower it to something like 16. so it just about fits our hand and I can just move it a little bit like this obviously you can just adjust it to whatever you want with that we can then go into the details and scroll all the way down then under collisions if we want to change it from overlap or dynamic into no Collision compile and save and then we can go into the event graph and we need an event for our attacks I'm just gonna go with left Mouse button then we want to drag from it and search for do once from completed drag and search for play any montage then we just want to drag out and search for delay and we want to plug the return value into the delay and then once completed we want to go and circulate back into the reset now we need to slot in our animation monitors I'm just gonna search for my animation okay so what this does is basically we are going to trigger an attack with our keybind you can have your own custom keybind or just hard coded like me and then we are going to play animation we are going to do once just so that we don't play animation multiple times and you glitch out and then the daylight settings here so we wait for the animation to be actually over and then we can attack again that's why we go into the reset so after this what we need to do is we are going to go into the interfaces under here and then we have these two functions so we are gonna right click and Implement both of them then we are gonna get the sphere and drag it in and then we are going to select the sphere again scroll all the way down and we want on component begin overlap then we are gonna drag from the sphere and we are gonna search for set Collision profile name and we can just duplicate it we want to plug it in both of these events and then make sure that the sphere is plugged into both of these as well so from the sponge start function we want to change the Collision profile name to overlap Pole and then in the punch and function we want to change it to low Collision then from this event right here we want to drag out and search for branch then from true we want to drag out and search for do once and then from completed we want to search for apply damage then from the set quotient profile name under here from the punch end function we want to drag out and plug it into the reset then from the other actor here we want to drag out and search for actor hashtag and plug it into the branch and here you can select whatever tag you want I'm just gonna use enemy tag but you can obviously have your own tag and then from the other actor we are going to drag out again and plug it into the damaged act so we can compile and save so what this does is basically these events trigger whenever we register put into the animation and we are gonna do that in a second and what it does is it activates and deactivates our Collision that way it's not permanently active and we can just do damage here randomly by walking over actors then the punch and function triggers at the end of it so we want to deactivate it and that also means the attack is over which means we can reset the function and we can do a damage again then on component begin overlap sphere this just allows us to do damage to whatever actor overlapped with our sphere during the attack so now we are gonna need to go into our animation blueprint so I'm gonna select my mesh and then I'm gonna under an m class in the animation blueprint I'm gonna just browse to asset and then open it in here what we want to do is we just need to get our animation notified so I'm gonna search for anim notify so I'm gonna search for punch begin and we are gonna search for punch and now what we want to do is we want to search for get player character then drag out from the return value and search for player character and casts to it so for me that's third person character we can plug it in like this then from our character we want to drag out and search for our punch start function we want to get the message so it has this blue envelope on top of this then we can get these two nodes and Ctrl D to duplicate and plug them into the punch end and we drag from the player again and search for punch and function and we want to get a message again so then we can just compile and save okay and then we are basically done so I'm just gonna go into my third person character and I'm just gonna in the apply damage I'm just going to change this to let's say 10 so we can see that we are actually doing damage I'm going to compile and save then when we are in the play mode as you can see when I left click we are punching and then if I go to this target actor that I have here we can punch it and as you can see it reacts and we print out the amount of damage that we do so we know it works just like we want this to so I hope you found this helpful if you did please like And subscribe it helps out a lot thanks for watching and see you in the next one bye
Info
Channel: That Skye
Views: 9,328
Rating: undefined out of 5
Keywords: Unreal engine, UE5, Tutorial, Learning, Indie game, How to, How to unreal engine, Widgets, Beginner, Beginner guide, Beginner Tutorial, Third Person, RPG, Level, Leveling, Simple, Easy tutorial, RPG game, Punching, Hand To Hand Combat, Hand To Hand, Combat, System, Combat System, Fighting Game
Id: GLWxFdV5XNM
Channel Id: undefined
Length: 6min 29sec (389 seconds)
Published: Wed Aug 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.