UE4 - Air Combo System Tutorial - Devil May Cry Style - Part 1

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Laughter] [Music] foreign [Music] [Laughter] [Music] hello youtube i'm gonna do a tutorial on the air combo um it's gonna be a bit similar to game like devil may cry and i'm going to use the project file of devlog number one so if you want to see a bit of the end result you can go check that out and before we start you need to make sure that you have your animation choose carefully for me i'm going to use [Music] frank slash pack and i'm going to show you the animation that i'm going to use but make sure you choose them and you've already imported them in your project and you set up everything in place before we start so for the animation i'm going to use [Music] i can show you over here i've prepared and named them already we'll need at least like seven of them uh so over here in the player file i have the ground combo so for every each of them basically any animation what you're going to do is enable motion over here and select every one of these and create a montage once you've done that you can go in the ending montage and change the slot from default slot to upper body and you can do this for your air combo also and you're gonna need the launch attack that looks a bit like this and also a takedown attack that can bring the enemy down and yeah what i've did is i've already put my effects and those so you can do the same to prepare make it a bit faster and for the enemy i'm gonna have the animation that plays once you've launched him in the air and basically this [Music] this in place animation that he takes damage and for the stunt [Music] for the real damage uh when you're on the ground and when you're in the air uh i'm going to play this uh again it's the same animation but not in place and i have enable root motion and have create montage and make sure you also select for the enemy at the upper body slot and for this uh take down knockdown montage i'm going to show you later i have created this but it's basically just a compilation of a couple of different animation so what you will uh want to have is uh i've created this uh third person character template as the first thing i did i choose this template and what i did is i've come over here and in the animation blueprint i've decided to change the locomotion so the blend space because it's only a 1d blend space so again i've used the frank slash pack that comes with look ground locomotion animation so i've changed the run forward run left run right and i also have run back so what you're going to do is at the top you want you will have forward left right and at each corner of this blend space you will have back back back back and for the bottom this will be the same as the top forward left right so we're gonna see we'll have the same animation over here over here over here and at each corner and you can go ahead and label the y-axis as a speed uh over here from 0 to 300 and also the x-axis is going to be the direction from -180 to 180 so the only purpose of doing this is uh once we choose a target we want to uh want to lock on and bring in the air it's going to be way much smoother if we have this two-dimensional with four four direction blend space so what i did is i've come to the animation blueprint and from the player you can change to a cast or you can use the third person template it's going to be fine just get the actor rotation and you've already calculate speed but bring in calculate direction from the get velocity and plug it into a float that you're going to name directions so you have both both of these and from the your ground locomotion you will take a idle position and if your speed is greater than 0.1 you're going to plug in your blend space over here and for the x-axis again direction and then the speed for the y and if the speed is less or equal than 0.1 you're going back to your idle so it's basically the only thing i've did to play the blend space and make sure you also have over here a default slot which is upper body to play the anime montage of the combo and once you've done this for the main player character you gotta create a blueprint for your enemy which is gonna be for now dummy to test our combo so what i've did is i've chosen this guy the ue mannequin and i've changed the material to other color so i can differentiate between both of those player both of those pawn um and what i've did to his animation blueprint you're just going to go in the is ground locomotion and a state machine and what i've did is i've disconnected everything and i've just plugged idle pause so we can test on him and also don't forget between this state machine you will want to have this default slot set to upper body again so we can play the damage and montage so once you've done this the last thing we're going to need is to go to epic marketplace and what i'm going to do is use this target system component it's going to go way faster than building it from scratch and we might rebuild it we'll rebuild it in the other tutorial but for now just use this install it once you've done this you got to go in the edit plugin uh at least look for the target target system enable it it's going to ask you to restart the engine so just do this and restart the project file and now we can go in the third person blueprint and start doing the code for the system so this is just the basic input with our movement i didn't change this i've just removed the useless stuff like vr stuff and touch we're not going to use this and i've created this box over here for the target system so what i'm going to do is i'm going to go to class setting and i'm gonna add an interface so just look for the target system targetable i've already had this and over here add component you can take the target system over here and you will have the option so the only thing i would change uh maybe is the pitch distance offset over here i'm gonna put 40 so it's gonna lock a bit smoother to the enemy and [Music] you're going to choose an input so let's say key is going to be e for now because we i didn't do any binding or anything just to keep it simple so from there you can drag target actor very easy and then you come over here at the bottom and you're going to see on target lock on target lock off and on target lock on so just create both of these and from that target actor you're gonna bring over here and promote to variable and this is gonna be the target that we're locked on and it's also gonna be uh represent the target that we're gonna bring in the air so this is gonna be a reference to his blueprint and what you can do is create a variable is locked on and once we've locked on we're gonna set it to true and if we're locked off we're setting it to false so we're going to go and just test if this plug-in works as intended so as you can see i'm going over here and i'm locked on this target and i'm going over here and i'm lock on this target also and it's gonna go smoothly because i'm playing my 2d blend space all right so the next thing we're going to do over here i've prepared all those bugs that we're going to need to fill in and we're going to start with the melee attack so with the ground combo for this input i'm gonna use the mouse left and what i'm gonna do is right after and i'm gonna bring a branch and from there you can promote to variable the boolean and it's going to be ken mili so you're going to take this right after and if it's true you're going to set it to false so can melee would always just hit compile can melee will always be true and you're also going to create for this system we're going to use a variable weapon weapon index and this is not gonna be uh which weapon we're using uh just for lack of better name i've choose this uh this name it's gonna be like the state index of what attack we're doing uh so over here zero is gonna be by default it's gonna be no attack so i'm gonna come over here and when we're melee attack i'm gonna set this to one and make sure this is an integer so after we've done this what you could do is bring a branch over here and check if the character is falling so that means the character is in air so the character will be doing probably air combo what i've did is i've took all of those nods i have right click collapse to macro and that gave me over here a small macro and that i've plugged the true and the false and the output and i can come here and use this every time i need to check this because we're gonna use this a lot is so after we've done this i'm gonna leave this over here and i'm gonna go over here in our combo montage that we want to play and i'm gonna create two custom events so the first one is going to be the ground combo montage and you can copy paste the next one is going to be as you would have guessed the air combo montage so after this you're gonna bring a play and a montage from that and for this it's gonna be yourself and from there what you can do is promote to variable this is going to give us an ending montage and we can change it to an array so j just change the variable type and what i'm i'm going to do is i'm going to call this ground combo array you're going to get a copy plug it in over here and this you can promote to variable and it's gonna be an integer and you can call it at account so from there you're gonna take a branch and you're gonna grab the array and we're going to check if the length of the array so just bring the length and you're going to minus -1 the length and you're going to bring the attack count and you're going to check if it's greater or equal than this you can plug it and the branch and from the true pin over here you're gonna bring the attack count and set it back to zero and from the false over here you're going to get the attack count and increment it so once you've done this what you can do is take this logic and copy paste it to the air combo and the only thing we're gonna change is the area over here so just again promote to variable compile i'm gonna plug the array over here also and this is gonna be our air combo hurry and if you hit compile again uh we can come to both of this area and we can plus so for the ground combo i had three anime montage that i've liked to play over here and for the air combo i have two of those so i'm gonna plus two time and since i've already select those i'm gonna copy paste from there the name and i'm just gonna add them to the array all right so once you've done this we're going to go back to our input over here and we're going to finish this so we're going to create two more custom event this is going to be save melee this is going to be reset melee for this you can copy paste your can melee and both of these are going to reset back to true and for the reset melee you're going to take the attack count and set it back to zero and over here when we check if the player is in air or he's not uh if the player is not in the air basically we're just gonna play the ground combo montage but if the player is in air what we're going to do to keep the player in there is we're going to do a line trace for object and we're basically gonna line trace to the ground so what you can do is get the actor location and from there you're going to break the vector and you can make make vector also right after and this is going to be the end point and the start point so you can plug both of these in there and for the z-axis what we can do is a minus so it's gonna line trace beneath the character so for now what we're going to do is uh 1200 so this is gonna be fine and for the object type i'm gonna make the array and i'm gonna choose both world static and world dynamic we're going to trace this line so just make sure i'm going to keep it persistent from there you can all be bring out a branch if we're eating something so we're gonna bring a launch character you can override both of these and from the z you can give him a velocity of about 300 unit and if this is false we're going to play the air combo and over here right after we've launched a character you can play the air combo and this is gonna make sure that the characters stay in air so once we finish this blueprint uh we basically finished the ground combo part but we still need to go into the enemy montage and place our anim notify to actually make the combo works so what i've did is i've come over here in the new notify and i've created a save melee reset melee and a do damage notify so once you've done this just select the notify and let's say from this part of the combo over here we're gonna do or do damage uh maybe right at the right spot and right after we're gonna give a window to the player uh to chain the combo and to go to the next part so you're gonna put your save and your reset and you're going to do this for every combo part that you want to use [Music] [Music] so for the launch attack the only thing i'm gonna add over here is the nutty fire do damage and for the takedown what i've done is also add the do damage uh but we're gonna do another notify it's gonna be a reset takedown so just put it at the end over here once you've done this uh you will need to go to the animation uh the animation blueprint and right after your update animation you can go down and choose your anime notify so for now we're just going to set up the save let's say reset melee and save melee and from there what you can do is bring this cast copy paste for both of these and from there you're going to call reset melee and from there you can call save melee and just place them over here hit compile and now we can go ahead and test this out so right now we're just gonna have our ground combo playing and we can lock on to the enemy but we're not gonna have any interaction for now so we're gonna go and continue this we're going to start with the do damage event over here so we can actually damage the enemy and start to test the combo part so for this you're going to do another custom event that you're going to call do damage and from there you can bring the sphere actor overlap and what we're going to do for this we're going to do two view part and we're going to make an arrow and we can call this collision arrow this arrow we can put it at about 120 let's say 120 130 and a bit higher you're gonna bring that collision arrow and you're going to get this world location plug it into sphere pause over here we're going to choose a radius of 70 for the base attack the melee attack but what i'm actually going to do is i'm going to promote the variable and set this to damage radius and what i can do from there is i can draw a debug draw the box fare and for the object type is going to be only the pawn and also the actor to ignore we're going to make array and we can choose self so we're going to ignore ourself and after right after this we're going to do a branch and we're going to do for each loop for each of those enemy and you're going to check the actor as tag of basically enemy and make sure you put in the exact same thing that you're going to put in the enemy blueprint after this we can branch again and we're going to apply apply the damage and the damage actor is going to be the enemy we're looping the base damage i can promote to variable and call this attack damage and for now i'm just going to put 0.01 and the event instigator is going to be get the controller and the damage causer you can put self and for the debug sphere over here i'm going to choose another color so we can actually see it and with duration of maybe three seconds and thickness i'm gonna put 10 and the radius i'm gonna plug this over here and once you finish this custom event uh just make sure you go to your enemy blueprint and from the over here the self you want to look for tag and you want to make sure you do plus and over here you can actually add the tag enemy and this is what you're using right there just make sure you have the same i think we're gonna start in the enemy blueprint to do the event so we can get damage so i'm gonna go to event begin so i'm gonna call eventb i'm going to cast to the third person character and you can get player and from there you can promote the variable and this is going to be the player reference so the next thing we're going to do is we're going to bring any damage and from there we can create a variable help we're gonna hit compile and set it to one make sure it's to set it to one you're gonna get this variable and what we're going to do is minus the damage and right after you can set it so plug that in and the only thing i'm going to do now is i'm going to print the alt of the enemy and right after i'm going to introduce it counter and this one can be integer so you're going to bring this hit counter you're going to get and we can increment and right after just set it so once we've did this we actually gonna need to return to the third person animation blueprint and over here we can choose the anim notify for do damage and basically copy paste again this cast and just call in the do damage and what i'm going to show you over here is i'm gonna i'm gonna set the thickness to one and i'm going to plug this in and show you the debug sphere that the enemy gets um to get the damage so there you can see the enemy is perfectly in the sphere so he's getting the damage um so i'm gonna unplug this and hit compile and now we can actually go and start to do our launch attack so for this attack i'm gonna choose the input right mouse and right after i'm gonna bring a branch and you can promote to variable this boolean and basically it's gonna be can launch so it compiled can launch is always going to be true and right after we're going to set it to false and we're also going to create another variable and we can call it um air combat and this one is going to be set to true and i'm going gonna bring the damage radius over here and i'm gonna set it to [Music] uh 175 and also i'm gonna bring the weapon index so for the launch attack here we're gonna be at index number two and after this we can play the ending montage so i'm going to go and select my montage for my launch attack just click on it and i'm going to click this arrow it's going to bring this montage in and what you want to do is launch the character for now we're going to override both of these and we're going to give about 1 200 unit and yeah so right after what you can do is go and cast to the enemy to the enemy blueprint and the object over here is going to get our luck target and from there the enemy is also going to be launched in the air um just a bit higher than the actual player so let's say 1300 unit and from there what you're going to do is play and in montage also so i'm just gonna put a reroute node right there and right there and for this i'm going to choose my launch attack anim for the enemy and i'm going to plug it in over here after this i'm just going to make sure that the player character can actually attack again in the air so i'm going to set can milly to true and i'm going to bring this collision arrow relative location and i'm actually going to bring this at 300 the last thing we need to do is from that target lock on we're going to get the capsule component at the end over here and you're going to set relative location and this is going to override the location of the player character to make sure is align with the launch attack so what i'm actually going to do for the location is i'm going to go to viewport i'm going to create a scene component and this i can call it scene air attack and i'm just going to put it in front of the player about 120 unit in the x direction and i'm going to go back to my even graph and i'm going to get this scenario attack and get a word location and it's going to place the enemy right in front of us so now what i'm gonna do is i'm going to reset this attack so we can perform this once the character is going back to the ground again so right here i have my jump that i've already set up but the only thing that is really important is the node over here which is event unlanded so you can see over here i've just said the i've just called this box on landed i'm gonna reset some some basic stuff so what i'm gonna do is i'm gonna drag this pin and i'm gonna call ken mili and i'm gonna set this one back to true i'm gonna take ken launch set this one back to true and the air combat over here is going to be set back to false and just for me what i've done is i've took this pin and i've plugged it into my reset but what you can do if you don't have your jump set up already and you're just going to use the event on london so now i'm going to do a quick test so over here i already have my ground attack but if i do my launch attack i get launch in the air and i can do again my melee and it's going to do the line tracing for us and you can see hopefully we get uh we get a couple of these line trace at the same eight so our character can be in the air and perform this combo and if i go and lock in to this guy i can go here and bring him to the air but you're gonna see uh it's gonna be buggy for now because we're gonna we need to go back in the uh and the blueprint of the enemy and fix a couple of things before this this is gonna work properly so you can go back to the enemy blueprint and you can make a custom event for a basic damage that the enemy is gonna receive and from there what i usually do is i'm playing a camera check and what you need to do is get the play reference get the actor location it's gonna be the epicenter and the inner radius can be a thousand and for the shake you will need to create a camera check but you can look for other tutorial online it's very simple just create a camera shake and select it over here and right after i'm going to bring my is and air macro if you didn't create it you can create it the same way as the third person character as and from there we're gonna play anime montage you can copy paste this one three time and what i'm gonna do after this is i'm gonna call a branch and i'm gonna get the hit counter over here and i'm gonna say if it's greater recall than a certain integer we're gonna play a knock down animation so over here i'm just going to promote this to variable and i'm going to call this it limit so let's say the hit limit is five for now so set it to five the head counter is set to zero and for each of these damage i'm gonna go to the stunt level over here and what i've done is i've took this animation which is the basic damage animation and i'm gonna plug it in there if it's less and the false so i'm gonna get this animation and what i've done is i've created this uh compilation of a couple of animation uh which is gonna look like this the characters gonna be knocked down for a certain time and then it's going to get up again so what i've done is i've took this animation and right at the end over here i've removed frame 0 to 51 and this is going to create for us another animation that every name loop and it's going to look like this so i've enabled root motion for both of these the knockdown and what you can do is come here create an ending montage and you're going to get the loop and drag and drop as many as you want and the uh character is going to stay longer on the ground and i've also get this get up animation and for this i didn't enable root motion because uh he's gonna get up at the same place that he's been knocked down so you can take this one and also drag and drop right at the end just make sure that you have upper body selected for this montage and we're going to go back to the enemy blueprint and this is the montage we're going to play over here so select it for if the enemy is in air or select it if the counter is bigger and the enemy is on the ground so if the enemy is on the ground and you've reached the hit limit what you can do is just delay for the duration of the animation and right after we're gonna take the hit counter and set it back to zero so now we can actually come back to our any damage and plug in our basic damage to do this what i'm gonna do is i'm gonna get the player reference and the weapon index depending how we're attacking the enemy i'm gonna get this and i'm gonna switch over here switch on integer and since since we've had the uh for now we've add the tree integer i'm gonna add 3 pin to this i'm going to bring this back a little bit and i'm just going to add the comment uh to make clear what each of these integers represent so for the number one over here we add our melee and for the two over here we add our launch attack so for the number one over here you can bring is an air node and if the enemy is not in the air we're just going to play our basic damage and if the enemy is actually in air we're going to play our basic damage we're going to get again reference to the player i'm going to get the scene here scene air and the world location and i'm just gonna override the position of the enemy again to make him sure he's in front of us so i'm gonna set relative and set relative location of the capsule component over here plug this in the new location and for the launch attack and now we're just gonna play uh basic damage but the problem now is this is not gonna keep the enemy in the air uh we'll need to do the same line tracing that we did for the player so i'm gonna go here and do a custom event and this is going to be a like a air buffer that's going to keep the enemy in there all right so from there you're going to do the same thing we did for the for the third person character which is the line tracing for object and if we hit something what we're going to do is we're going to launch the character again so we can get the launch character over here and for this one we're just gonna split structure pin i'm gonna override both of these velocity i can promote two variable and i'm gonna call this one the airbuff and gonna set this one to 300 and for the line trace what we're going to do is we're going to make the array you can plus it's going to be well static and world dynamic just like this the actor to ignore we can also make array and ignore herself and over here you can get the actor location and we're going to break a vector we'll just make vector you can plug the y it's going to be directly plugged in and where we're going to minus 1200 unit just plug that in bring it to the end and the start is going to be over here the actor location all right so we're going to hit compile we're going to go back at our launch attack over here if he's getting damaged from the launch attack we're going to do basic damage and after this we're going to call the air buffer again and right now right before what i'm going to do is set the air buff to a float that is a bit bigger so for this i'm going to put 400 and i'm going to copy paste at the end and add the delay for about 0.2 seconds and the air buffer can go back to this original value of 300 and the same thing for the melee attack over here between this and the basic damage we can bring in the air buffer so that's gonna keep the enemy in air for us and after we've done this we can actually do a quick test so i'm gonna go to the enemy i'm gonna lock on him i'm gonna bring it in the air and if i'm doing my melee attack you will see the enemy will stay in there i'm going to go to this one now all right so just remember that if you want to get the combo uh the height of the combo a bit higher you can change those value over here for right now we just put [Music] about a thousand unit but this is uh this is just for testing uh but you can play with this and change the height of the combo if you want to do this in your game all right so the last bit of mechanic that we're gonna do is uh the takedown attack so i'm gonna take your key let's say q perfect and i'm gonna go with a branch and promote to variable and this is going to be can take down i'm going to hit compile takedown is always true but if we click on it we're going to set it to false and right after this i'm gonna do a custom event and this one is gonna be a reset takedown so we're gonna take this boolean and we can set it back to true what i'm going to do after is i'm going to increase the damage radius i'm going to increase it up to 300. and i'm gonna take my weapon index and i'm gonna set this one to tree after this i can bring my macro of is in there and what i'm going to do over here is i'm going to launch character about 300 unit and i'm gonna override both of these so right after i'm gonna play in any montage and for the sending montage i'm gonna go and get the takedown montage over here i've already put my do damage and my reset takedown so i'm gonna get this montage and with the arrow i'm gonna put the reference over here so after this what i'm going to do is i'm going to hold d for and i'm going to put a delay and let's say 0.5 and again i'm going to launch the character but this time i'm gonna put the velocity uh downward so i'm gonna put minus ten thousand and from there um i can take the can take down and set it back to true and the last thing we need to do is we need to go back to our animation blueprint and actually give a reference to the anim notify so i'm going to copy this cast reset take down and over here again reset take down and after this i can go to the enemy blueprint and over here i'm going to add a pin and if we already have one and two but now we can have three which will be the takedown and from this pin what i'm going to do is a basic damage and then i'm going to wait about 0.2 seconds and i'm gonna do a launch character and for about the same velocity of minus ten thousand and i'm gonna override and now i can do a quick test so right now i won't be able to do the takedown attack but if i actually uh let's say i'm start attacking a pound and i get to a point that i jump in there and then i can do take down attack again and the same thing will happen if i launch the player i'm starting to do my melee attack and then i'm taking down the player again so i can go to this guy and we will have the same behavior i can launch the character and i'm taking it down so of course you can play with those animation you would want to make them look better because right now i've really took like the simplest animation i could find that demonstrate the concept but it's still [Music] still very fun to play and you can there's a lot of thing you can play around and custom and customize [Music] [Laughter] [Music] [Laughter] [Music] [Music] you
Info
Channel: Nitrous
Views: 6,089
Rating: undefined out of 5
Keywords: unreal, devil may cry, tutorial, combo, combat, system, dark soul, cyberpunk, engine, unity
Id: _TZ37WpOWgY
Channel Id: undefined
Length: 50min 34sec (3034 seconds)
Published: Mon Aug 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.