Witcher Combat part 2 - Attacks & Combos - UE4 Advanced Blueprints Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome to the next episode of advanced blueprint tutorials in this episode we'll be setting up reactive melee combat with hit reaction in two types working on multiplayer so just to showcase what i've already done let's launch in single player one view i am running this guy in debug mode so he can look around turn in place he has a sword and he has a locomotion and he's moving in constant speed and there's nothing special about he can jump yeah that's it so how this guy is being set up is that uh here i have a new reactive combat game mode you can find it it will be part of the hdr examples gameplay reactive combat and it has just this pawn and this pound if we go into it you can see that it's just a standard town with an additional spring arm camera nothing fancy about it a long sword that is attached to virtual bone weapon mount just moved a little bit inputs are just copied from a third person perspective template but we'll modify it just a bit to showcase what you need to do to do reactive combat and as for event graph we have this init animation where we just set up aim offset setup turn rotation type and we set up a base pose to be cobalt longsword so in our car blueprint i made this kubot longsword one and it's a very simplified way of uh it's similar a bit to the one we have for pistol so let's go into anime graph this is just a jump plant and a grounded [Music] locomotion state state machine and you just got idle moving single stop animation oh and by the way this is not looping and and i turn in place animations and that's it nothing else it's the same setup something we already done in previous tutorials so i didn't want to record it and put it here because that would be just a waste of time so we got this it's being plugged in here no new variables nothing groundbreaking here honestly and in the character we just set up base animations and for combat i've just placed all the setup here and i have just made this register collision mesh by the name of sort so this guy for now he can't attack he can't do anything so let's make him attack right so let's go into our content and let's set it let's set a color and this will have no color for now because we'll be using this a lot and yeah this is just has the long sword and we want animations root motion and attack uh so let's start with attack down oh you know what let's open all of them and let's see which ones of those animations are actually good save everything and now let's think like um okay that doesn't really matter that much because what we can do and just then move them however we want so let's do it attack a attack e attack underscore c attack underscore d okay save all of them and let's say that we'll start with a so we go into our character and we go into our combat master and our first value for combat attack x will be this one so okay and we're not having more colliders than only this long sword so i don't think we have to bother with okay let's do it the proper way so we should actually activate the weapon in the animation so let's do that so we just need to remember this name of the collider sword so let's go into it okay we need to do some notifications so first of all we go doing hdr combat activate weapon so activate weapon means we are activating sword and we are deactivating any other weapon just in case we were using different attacks okay another thing is that we need to specify what is the next combo so the next combo attack for our combat attack uh x i think it was x and let's see yeah combat attack x inline will be attack b for example so now you save it and here we start the attack so we need to add a notification state saying trace hit and boom this is where we stop tracing or even further why not and here we'll do an instant buffer input which means that here we will allow you to go into the next attack but if you don't do anything up to here then here we're doing a notification reset combo and here we're doing notification ignore root motion and our blend in will be smaller like point 15 blend out will be 0.25 so that's fine point 25 it's like from here so from here when we are blending out we are disabling with motion so this is everything let's try it let's run and now ah okay now we in the project we set it up uh yeah it will be here why not we set up left and right trigger as an action input so left trigger is just left mouse button right trigger is right mouse button so we want to use mouse for this for for being just faster and what we want to do is take our master component and say try buffer input okay and buffer input is the one that we specified here so the buffer input is just a key and this key can be literally anything it doesn't matter for in my case i am using the ones they already created for the purpose of previous tutorials so it will be combat attack x so like the input or b or y or a b or those are for you know different combinations of inputs so i'm just using this so when i'm trying to buffer this i will look at my attack table and i will try to find this attack and i will try to trigger it so let's try it and i am triggering my attack and am i trying to trace i am trying to to trace but i haven't specified trace sockets on the sword so let's go into the sword let's find the sword and it's a static mesh but inside the static mesh we can also create a socket and we can name this socket start and this has to be the tip not the base it's all better this way okay so this is the tip create socket stop and move it to the base a bit higher actually even okay like here play and now i am doing those traces and if i go slow mo point two you can see those traces like they're not very visible when it comes down to color oh and i can ignore root motion and blend out of this animation so i can't move while root motion in the animation i want it's almost ended i can start moving okay so that works fine okay so this is working so let's see if my combo works so now i want to do one and two and it works okay so i have to go into my hr examples blueprints and maybe attacks and go into attack b and do the exact same uh setup i say as i did before so i will need two tracks on one i am doing notification activate weapon the weapon is sort yet again at the end of it i am doing a notification reset combo and around here i'm also adding ignore root motion at the end and i'm blending in at 0.25 that's actually fine because point 25 like here and the actual attack starts [Music] at yeah 0.25 basically so that's fine so here and here i will start using the swing so it will be trace hit and bomb stop tracing hit and here you can do instant buffer input and just go here from here and did i forget about something oh yes of course i did i need to also do set next combo and set next combo is attack c but not the countess one it's my attack c and it's also on attack x so i am just you know moving attack x to another animation so this this this and this and this should already work so let's try it one attack second attack third attack okay that's cool so i got this and now i have to do this setup here as well it's quite fast let's just do it so activate weapon activate weapon is sword of course yes and by the way i also need to disable other colliders yes and can you please stop closing my windows thank you [Music] now set next combo is the last one so it will be combo attack x it will be attack d which is just there's no there was no attack for the countess and now let's pause it and here you start to swing so you do notification state trace hit bomb okay you're done and this is this is not the last one so here you can start doing input add notification state and you want to do instant input buffer because like no from here you want to do instant input buffer that will allow you to attack up to let's say here he will do rested combo and he will also do disable root motion and now while we set this without any buffer we will actually add a notification state and do buffer input that is not instant okay go like here uh so this means that if animation plays to this point whenever you press a button anywhere on this timeline it will start the next attack however this buffer input that is not instant buffer imper input whenever you play your x button it will still buffer the input but it will wait until this moment and then activate the next attack so we don't want to blend into next attack when you are with your back to the forward because the blend of those animations would be just dramatically bad that's why you need to wait and do the attack d once you finish your spin so this is how you use all of those notifications from agr pack and that's it you don't need anything else here and then you go into attack d and by the way ignore those because those are just from notifications on the preview so this one will be a bit smaller honestly because this one will just have activate weapon and it will be sword and this one will also set next combo but it will set next combo on attack x to be attack a again so we might just do reset combo or set this because rested combo would also reset the combo to the first one but we want to just loop the entire attack to this one and then here do trace hit up to here and now here you have buffer input and up to here you have buffer input and from here you have buffer instant input so you do this and then you go bam up to somewhere around here and you don't really need a rested combo but we'll adding it just to remember that we always do that and then we add this ignore disable root motion here so 1.8 this is two seventy-five so from here plus one or minus okay so this is the attack d so now we should be able to do those four attacks in a row one two three four and then one two three four and this is a very nice combo okay but this guy doesn't rotate while attacking and we want to change that so let's go here and go into character movement and root allow physics rotation during any uh root motion so physics rotation is the standard rotation that character movement component is doing so now when we attack we can actually change our direction and he will fluently try to rotate towards where we are looking at as fast as he can okay so let's go back into this guy let's go into viewport let's make this camera boom something more ridiculous like 600 let's move it a bit up like 60 and let's take a look okay so now we have a bit different viewport so we'll actually move the camera down that up and we'll make this z offset zero no this would be up after all yeah like 90 even let's see now oh and we don't need y offset to be anything as well so let's just do it like this okay okay a bit more witchery so that's great uh let's add some flavor to it let's add maybe some traces to the sword or some sounds but i can do it off screen later on so yeah you know what let's let's add sound and and traces tax and now if you go into combat master we can add begin hit trace and and hit race which is more important because those are the moments that we start doing those line traces for the attacks so the ones that we can see here in debug like once we doing those actual attacks we can do stuff so what we want to do we want to coming to our content trail pack and particles and let's say sword trail dark okay just add component this particle dark and what we want to do is uh ends trails start trail begin trails okay so in first socket start stop from center with one this this i don't know if it requires some parameters we're gonna see in a second if it works even yeah it works okay that's actually not bad and we have from these trails is there ah there's no example map um strong so trade trails sparks what's uh trail sparks let's try this one pump expose parameters there are no parameters okay okay it's like this p strong why not be strong okay we can use this for now this is fine okay so we got this guy he's doing combos he's doing attacks and one last thing we need to do is to register his kids so we're go into combat we go handle register hit obviously so it's just start stop actual attack and here we need to register say the variable hit actors and hit actors will be an actor array so object array and we'll see if if this heat break now let's take this somewhere here so if this hit actor is already registered don't do anything we already covered that in many tutorials but if it's not registered then register it and if you register it then deal damage right so apply damage the image will be one and it will be the just damage type damage actor will be this actor you know what um apply point damage and hit info is this heat info even the instigator is um wait instigated it has to be a control right so get controller for the spawn this is the instigator damage causer is self because it's just this actor as a whole we don't have a separate actor for uh anything else hit from direction uh so that's basically the location and base damage will be one and the image actor is this actor and that's it because he's actually taking the hit component and bold name and everything from from this hit event directly so the rest is unrelevant so you just push this and draw the back sphere or maybe you know what draw the back box and just make it center of the impact point and make it like five by five by five line color will be white and rotation is unrelevant and duration is just one second and thickness is just one i'll save and just hit anything anything that can be applied damage will get hit so yeah we did hit that oh i forgot about one important thing like our sword no no and doesn't block anything and it's just no collision thank you and custom no collision means no collision at all no collision thank you and it can actually even yeah just just this so no collision it will no longer push boxes we will as a character but that's it and registers hits okay towards this box now let's make this box a bit bigger let's say not five five five but fifteen fifteen fifteen three times the size will be more noticeable or maybe not white and this i don't need this and i don't need this anymore maybe not white let's make it red so we don't miss it and now okay yeah okay but we can't hit the same actor multiple times because we just added it to this list of ignores so what we need to do is just take this ignore list and when we start trace or end trace actually on end trace i think would be better we clear this and you know what we can clear out the start and at the end of the attack so we just clear the list clear hit list okay so now we can hit pair attack once but we can hit the same actor with multiple attacks in a row so let's do one two three four and we can see that there are multiple hits because i think we are registering from the server as well yeah because right now we're hitting on client and on the server so we can also do go into combat and say trace only on server okay now now we still register hits but those are hits only from the server okay okay this is awesome so you can hit multiple actors at the same time in different locations it's fine you
Info
Channel: AngeIV
Views: 5,067
Rating: undefined out of 5
Keywords: unreal engine 4, ue4, devlog, animation, animation blueprint, blueprints, gamedev, free, tutorial, sound system, sound, footsteps, weapon, aim, ik animation, multiplayer, replication, gamejam, resident evil, lets make, recreate, game mechanics, ue4 ai, damage, hit reaction, aim offset, procedural animations, root motion, unreal engine 4 tutorial, agr, ue4 devlog, unreal engine 4 devlog, game, ue4 game, game devlog, witcher, witcher 3, combat, melee, sword, reaction, combo, attack, how to
Id: 9-GBOOgLk64
Channel Id: undefined
Length: 26min 55sec (1615 seconds)
Published: Tue Feb 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.