How To Create a Combat System in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to a new unreal engine 5 tutorial and today we're going to be making a combat system it's going to be a very easy and uh quick tutorial to follow so let's get started so the first thing with the window is of course get our animations um to be playing as we attack so i've let a really good free package in the description of the video if you want to check it out with a lot of bunch of animations which is going to be this one parrot contour punch etc so let's create an animation folder inside our content browser and just let's just drag it in so when we drag it we're gonna have a few options first of all the most important thing is the skeleton when you have the sk mannequin skeleton okay not the new one the old one okay i'm gonna explain why in a second and the rest you're gonna have it like i have it just by default import all and here we have it so if we open it up you have the animation playing uh perfectly great now we need to convert this into the new uh lyra skeleton for the new mannequin and region five very easy right click retarget duplicate and recharge it and select money to ue5 money here we go recharge it and here it is let's drag it into animations okay it's called the same so let's go ahead and just add a ue5 at the end and now we can drag it alright as you can see now it is with the skeleton of the new mannequin internal engine 5 so go ahead and save this save this and close it now let's right click in the new one and say create a name montage and just hit enter basically the nim montage is a type of animation that we can play from the blueprint instead of creation and whole animation blueprint very easy now let's go to content third person blueprints and find the third person character here it is so find an area and let's create a custom event let's call it basically attack and just gonna place it over here so now let's just drag this and say play a name and then montage so now we can go in here and we have our name montage because it is the same skeleton it will be perfectly working so if we just hit play now we attack sorry we have to do one more thing left mouse button we're gonna call the attack okay like that so we now press play we can see that our animation place of course the animation is also like uh so when we get punched so let's just go ahead and crop that part so in order to do that let's go animations so let's go into the original animation not the any montage of the new skeleton and we're gonna just pause this okay and we're gonna get the point where we want our animation to end so of course in here we punch really cool but then we get hit now let's go like around here now right click on top and say um remove from frame 27 to 71 and that's it animation is cropped so save this and now we need to go back in the animation montage and we have to go ahead and move this one and then put it back and then it will like reset the duration we closed it and we can test it out we punch that's it great of course we are playing the animation but i mean we are not doing anything if we uh created for example an enemy and we attacked it just we'll do animation all right now that we have our animation playing we're going to create the right cast so after the anime montage let's say line trace by channel and we're going to set a starting point we're gonna go to the viewport add an arrow and it's gonna be the start attack okay we're gonna place this arrow a bit up and in front of the player so in this point right here the line trace will start then let's duplicate and name it end attack and you can just place it a bit in front and basically here's gonna finish it's gonna be from a to b great let's go here and let's drag our start attack and get socket location you know plug that into the start and then gonna get the end attack i'm gonna get duplicate this place this in here and this plugged into the end the book type set fourth duration compile save and then we hit play you can see that there's a line trace appearing in front of us great that's pretty much the attack system done however let's make it a bit more fun let's go and create a folder named blueprints create a blueprint class with um pawn let's say bp dummy that's right let's create a dummy so basically in here let's add a skeletal mesh use many or skeleton from real compound and save then in the event graph of this dummy delete all the event any damage here we go so when we receive damage then we'll call it later from there um we are basically going to create a variable here called health and it's going to be type load drag it and then get now ask if branch and if health is greater than zero set health and to take away subtract from the damage that we got so this here and health here so we receive damage we ask if the health is greater than zero and if it is well we want to subtract the health from the damage that we received it's that basically we'll just uh destroy actor okay and when we receive health let's make a print when we say damage received okay now let's go back into our third person and after here i'm gonna drag the out hit and break hit result expand this and get the hit actor let's say apply damage and we are going to set a damage of around two one thing is go back to the dummy into the health and place this at 10 so compile compile and save compound save we go here put dummy around here let's rotate it so let's go back to dummy let's make this a character better there you go and let's just uh remove my capsule and let's get this guy around here block all maybe okay now let me receive damn received now we received and dead great basically just change the class settings to character and basically in the capsule component set the equation preset to block o so now we have a combat system punch it punch it punch it punch it punch it and then boom he's dead of course we can make an ai that will follow you and more interactive at sounds etc that's pretty much it now i think that you notice is that if i tack like multiple times it kind of like jiggers so we're going to make that so i'm going to create a variable uh can attack type boo and then here i'm gonna make a thing so i'm just gonna move this a bit here and make a branch saying that if i can attack all right if not not and on here let's set that i cannot attack and then in the play montage i'm gonna get the duration okay um yeah let's just go here delay and okay the return value here so i'm just getting the duration of the animation and i'm gonna set we can attacked true so now if i test it i can never attack great okay we need to at the start make it like an attack and there we go and you can see if i now spam it still respect this great so that guys was a tutorial i hope it was simple and easy to follow um check out my other unreal engine 5 tutorials i'm currently making more yesterday i make i made uh the how to add wind into quicksilver foliage so if you want to check it out you're welcome and that's it guys hope you enjoyed and bye bye [Music]
Info
Channel: Gorka Games
Views: 121,003
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5, combat, combat system, tutorial, quixel, megascans, unreal engine tutorial, melee, ue5 combat, ue5 combat system, unreal engine combat system, unreal engine 5 combat system, unreal engine 4 combat system, unreal engine 4, ue4, ue5 widgets, ue5 blueprints, ue5 melee combat
Id: eH2ONHElTGA
Channel Id: undefined
Length: 12min 9sec (729 seconds)
Published: Wed Jun 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.