Welcome back.
So we have a ghoul enemy and it's chasing us, but we still want to have this ghoul attack that's going
to look really cool.
So for our cool ghoul attack, let's make some attack montages.
I'm done with project settings.
I'm all done with Ghoul, I'm done with the blend space.
For now, I'm done with the Goblin spear.
I'm done with Hit react.
I'm going to keep my cool and I'm done with the app Google.
So let's go into blueprints.
Actually, let's go to content assets, Enemies.
Google animations.
And we'll make two attacks.
Attack L and attack R.
Let's start with the left.
So I'm going to create an A montage.
Call this a m, underscore google underscore attack.
Underscore l a lot of underscores.
I'm going to get this anim montage and we want motion warping and we want to send an event.
So two things to notify tracks.
The first will be called motion warping.
And we'll add another track and call this one.
Events and we'll do the motion warping first.
So I'm going to right click add, notify state motion warping.
I'm going to grab this right handle of it, hold shift and I'd like to move to the right rotation at
about here.
So from the beginning to about here, we'll be facing the correct direction at that point.
And we're going to take our root motion modifier change, warp target name to facing Target.
I believe that's what it's called.
We can always go back to BP enemy base.
Yes, it's facing target.
That's what it is.
Now I'm going to uncheck warp translation and set rotation type to facing.
And that's all we need to do now.
We need to go to the part where we want to cause damage right about at the swipe.
Now, here's the thing with a big, large swipe like this.
I've seen some games implemented with multiple traces, multiple sphere or box or whatever traces,
but I'd like to just have one big sphere overlap and use our same code that we've been using.
We're going to be facing the correct direction anyway, so I'm just going to go ahead and send one single
event right here.
I'm going to right click.
I'm going to add a notify, choose an Montage event, I'm going to select it and scroll up to change
its event tag to and it's going to be montage Attack.
And this is the right hand.
It is the right hand, isn't it?
This is ghoul attack L And in fact it looks like my animation is called Attack L But it's actually the
right hand, isn't it?
So that's funny.
So I think we're going to need to rename a couple things here, aren't we?
But because this is really literally the right hand we're going to use montage attack right hand and
let's go ahead and rename this now.
So the montage should be called attack are.
And in fact attack L and attack R have to have their names swapped.
So I'm going to take attack R and add an underscore at the end of its name.
That way I can take attack L and rename it to attack R.
I'm really sorry about you needing to do this and let's go to attack R and rename it to attack L.
That should be a quick and easy fix.
And now we have the correct name.
All right.
And we're sending the right hand montage tag.
Now let's make one for the other attack, which is actually going to be attack L Right.
So we're going to right click on Attack L Create and in Montage we're going to call this M ghoul attack
L.
We'll open it up and it looks definitely like the left hand.
We're going to have a notify state.
We're actually going to call this track motion warping.
And make a new track here called Events and the Motion Warping.
Track we're going to right click add, notify State choose motion warping.
We'll put it to about here and we're going to expand root motion modifier, change the warp target name
to facing target, uncheck warp translation set rotation type to facing.
And then we just need to send an event and we're going to send it about right here so we can right click
add, notify and montage event.
Select it, scroll up and choose Attack left hand this time.
So it's the left hand.
And I'm just going to go back to our and make sure it's right hand.
Yes.
Now everything is correct.
So now we have two attack montages for the ghoul.
I'm going to save all and go back to BP Ghoul and search for attack montages and add an array element.
This one is going to get my Am ghoul attack L and the montage tag montage attack left hand and then
we'll add one more.
This one gets ghoul attack R and the montage tag montage attack right hand.
And now we should get a tax.
Okay, so hopefully nothing was forgotten.
We can play test this and see if the ghoul attacks.
And it does now.
It looks like it's overshooting just a bit and it looks like our enemies are hurting each other at some
point, I think.
Yeah, the enemies are hurting each other, but I'm not getting any attacks from my ghoul.
That hurt me.
Let's see.
Okay.
So a couple of things are going on here that we need to fix.
For one, we're getting a random integer in range.
This is a blueprint, pure function, and it's going to be evaluated every single time that a value
is used from it.
In other words, if we get a random value and access this tagged montage here in play montage and wait
then later on when we're using the event tag in wait gameplay event, it's going to trigger this random
int in range to fire again.
So half the time we'll get the wrong montage and the wrong tag.
Now the way to fix this is pretty easy.
We just store this tagged montage in a variable, so we're going to promote that to a variable.
We're going to take the result of the get here and promote to a variable and we're going to call this
tagged montage.
And that way we only get it once and from then on out we use that instead of what we broke from the
get node.
So we're going to delete that break tagged montage.
We're going to get this one and break it and use the montage here and then drag out the montage tag
here like so.
Okay, so that should help with that.
Let's see if we get some attacks.
And we get an attack and it looks like the enemy stops.
So there's an issue here.
The gay melee attack stops the montage when the ability ends.
It looks like we're going to need to uncheck that.
All right, We'll try this again.
I'm going to move the enemy over and move my player start over so that I can just interact with this
enemy.
Okay.
So a couple things to tweak here.
I'm going to want my ghoul attack motion warping to be a shorter window for both of these.
I'd like to have it about like this for ghoul attack are for ghoul attack l I'm going to shorten it
up as well.
And just to double check, let's go to Google and search for name and sure enough, right hand socket
name is not set.
I'm going to set this to right hand socket.
That should work.
Let's see if we get an attack.
And I don't think motion warping is actually working.
Let's check out those animations and make sure root motion is working for them.
I'm going to go to attack and scroll down and enable root motion is not checked.
I'm going to check that I'm going to go to attack are same thing, enable root motion.
I'm going to save all and that should enable root motion.
And it looks like I'm actually getting some damage caused to me as well.
Yeah, that's looking better.
Okay, I'm going to hit the enemy.
See if the enemy attacks.
Okay, I'm going to hit the enemy while it's attacking.
So there.
And.
As I suspected, the enemy isn't attacking anymore.
Now, that's because our enemy's attack was interrupted.
Which means the enemy never got to end its ability.
So if this enemy's attack is interrupted, I'd like it to end the ability.
Now, that could be because of the montage.
So I'd like to end the ability when the montage is interrupted, cancelled or completed.
So end ability.
We'll go ahead and do that here.
Not blend out, though, because blend out happens a little before the montage finishes.
But another thing that I'd like to do is I'd like to cancel this ability as soon as this enemy starts
a hit, react.
So I'm going to go to my hit React ability.
Gar hit React and here in my tags I'm going to cancel abilities with tag and add the abilities attack
tag.
So if our ghoul hit reacts and it's got any abilities with the abilities attack tag, it's going to
cancel those abilities.
And that includes when I hit it with a hit react so like that let's see.
Yep.
And sure enough it attacks me.
Now things are looking pretty good.
Of course we want to avoid enemies hurting each other, unless you like that kind of thing.
But this is looking pretty good for now.
And I think I'm going to just do one last tweak on the ghoul, and that is to actually make its capsule
a little bit wider.
I'm going to make the capsule radius a bit like this so the enemy doesn't get too close.
And it looks like it missed me there.
It hit me there, though, so.
That's looking pretty good.
So aside from some tweaks, things are looking pretty nice.
I am getting damaged by the enemy.
So things are looking good.
I think it's damaging some of the other enemies as well.
So we are going to want to avoid friendly fire on the enemies so that they only attack and hurt the
player and not other enemies.
That's something we can take care of.
We'll take care of that in the videos to come.
But this is looking pretty good.
We now have two different types of melee attackers.
We have the spear attacker and we have our ghoul, and that's looking pretty great.
Now, our ranged attackers are just kind of hanging back and they're not really doing much right.
So we need them to start launching stuff at us.
But other than that, things are looking good.
We do want our ghoul to die, of course.
And we're also going to need to make our enemies a lot weaker by the way of health.
So that's another thing we're going to need to fix as well.
So that way we can test death along with everything else.
All right.
Excellent job.
And I'll see you in the next video.