Unreal Engine 4 Tutorial - Attack Combo

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome to this voted for video by my patreon so first of all before we begin big shout out and thank you to all my patrons who voted for this video if you want to vote for future videos go to the patreon.com forward slash ryanairy and silver and up higher patreon tiers can vote on each month's new video but this video is all about creating their attack combinations so this attack combo system uh there are loads of ways of doing this this is just one way if you want to see other ways you can even look at uh epic's own paragon characters you see different versions that they've done there i'm just going to show you a way of doing it okay so here i've got a simple character i've got here i've got the knight character which i've got from the marketplace i think one month um and i've got an animation set here too and at the moment his animation just looks like this okay and if you by the way you want these project files these will be available to gold patrons over on patreon as well so we're going to add attack combination um and in the animation for this which i have here and you should have your own animations as well to accomplish this obviously and we should have an attack combo and we can either have it all broken down to three different combinations or you can have them all put together like this so what we're gonna do here is we're gonna make this a montage uh but before we do what we're going to do is enable root motion on it for animation like this it's quite good to have root motion enabled because there is some sort of drive in the movement of the character as they swing their sword so i'm going to go down here and make sure i've enabled root motion which i have already i'm gonna hit save there and close this then i'll right click on this asset and go create and in montage this will create a montage for me right next to it and indicated by the purple bar at the bottom and we're going to open this up so on the montage we need to indicate different notifications for when we want the attack combos to be joined up together so what i'm going to do is move my timer line along to about there and i'm going to right click and add a montage notifier to notify track and go along again to the next part of the animation which is about there we'll go back there and right click again add notify montage notify and drag that to the correct place there so these notifiers are going to fire off when we want the animation to sort of pause or like check to see if it should play the next part animation and that's what's going to happen there we save that and close that now let's go on to the characters blueprint and yep there they are and what we're going to do in here is right click and i'm going to do a left mouse button input obviously this should be set up a natural input in your input settings but i'm cutting some time out by just doing this and in here what we're gonna do is simply do a play montage however there are gonna be a few things we'll do either side of that but first of all let's just get the play montage working break out your mesh component and from there do play montage you want this play montage and you want to choose your montage from the list here so it can be attack this one and those notifiers are going to fire off on this notified begin so this is where some of our checking is going to be happening but before i do that though i want to check to see if an animation is already playing so i'm going to drag out the mesh again and get the enemy instance of this you want to get the enemy instance because that's how you determine what montage is playing and if it is still playing rotates return value here and you do montage is playing and you can choose the attack montage there and it's going to a branch but the thing is behind this is that when the player clicks the left mouse button we want it first of all to do the attack so there's no montage playing we won't just do the attack so we'll just drag that into false or play montage like that so it will play the whole thing by default however what we need to do is determine when the player has hit the attack button again whilst they are still swinging their sword about so what happens is is the first time it goes through it will go down to false play stop playing animation the next time the player hits it it's going to see it's still plain animation of the true and what we're going to do here is store the attack combo now you want a new variable i've got an integer here and you make a new integer and i've called mine attack combo we drag this out and choose set and all we have to do on this is just set it to one all you have to do set to one you have to increase it just change it to one then on the might play montage on the note5 begin what we're going to do is take one away from the attack combo go get attack combo and do minus minus to decrement the int that goes on notify begin as a reminder so let's say for example i push the button just once you play the montage hit this notifier and the top combination is now going to be equal to minus one because its default is zero we haven't increased it at all so it'll become -1 if it hits that point we only hit the button once therefore we want the animation to stop so what we're doing here is we're checking to see if this value here is below zero so do less than zero and put that into a branch so now we've got to check to see whether or not below zero and if we are below zero as i said we only need to only hit it once because if we hit it twice i'll come over equal one so that means we want to stop the animation so we're going to drag out our mesh get to montage stop oh sorry stop montage i say get any instance then from there montage and you can choose your attack massage anyone you can put a blend out time if you want i'm gonna put in 0.25 and that'll do there at the end of this we want to set combo back to zero so it's ready for the next time we attack and that is it so what will happen now if i hit the button twice let's say if it once it will go through play montage start it hit it again it will change to attack combo to one and now if i begin attack combo will be minus minus so one becomes equal to zero therefore this returns false allowing the animation to keep going however if i don't hit it again then it's gonna be still equal to zero not changing it back up to one so basically every time we hit that button we're just knocking it back up to one constantly so you can now spam the button you get an attack combo so let's demonstrate that there you go and no matter how fast i click my button it will still do this full attack combination as long as i hit a button within the range of it starting and stopping a segment of that you'll do the f4 attack really quick really simple way of doing attack combinations no fancy variables that's a tracker to keep track of how many combos boom there you have it an attack combo thanks very much for watching and big shout out and thank you to all my patrons for their support once again if you want to vote on next month's video head over to patreon.com forward slash wayley and become a silver tier member and gold tier members have the lucky reward of having access to all project files including this one today thanks again for watching and i'll see you all next time bye everyone [Music] so you
Info
Channel: Ryan Laley
Views: 36,889
Rating: undefined out of 5
Keywords:
Id: Lm_TBOeinSs
Channel Id: undefined
Length: 8min 56sec (536 seconds)
Published: Wed Aug 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.