WEBVTT

00:06.810 --> 00:07.890
Welcome back.

00:07.890 --> 00:14.640
So we have a ghoul enemy and it's chasing us, but we still want to have this ghoul attack that's going

00:14.640 --> 00:15.810
to look really cool.

00:15.810 --> 00:21.090
So for our cool ghoul attack, let's make some attack montages.

00:21.090 --> 00:23.220
I'm done with project settings.

00:23.220 --> 00:28.830
I'm all done with Ghoul, I'm done with the blend space.

00:28.830 --> 00:31.770
For now, I'm done with the Goblin spear.

00:31.770 --> 00:33.450
I'm done with Hit react.

00:34.250 --> 00:38.740
I'm going to keep my cool and I'm done with the app Google.

00:38.870 --> 00:41.550
So let's go into blueprints.

00:41.570 --> 00:44.960
Actually, let's go to content assets, Enemies.

00:45.020 --> 00:47.480
Google animations.

00:47.480 --> 00:49.550
And we'll make two attacks.

00:49.580 --> 00:51.680
Attack L and attack R.

00:51.710 --> 00:53.030
Let's start with the left.

00:53.030 --> 00:55.700
So I'm going to create an A montage.

00:55.730 --> 01:00.560
Call this a m, underscore google underscore attack.

01:00.590 --> 01:03.740
Underscore l a lot of underscores.

01:03.950 --> 01:09.470
I'm going to get this anim montage and we want motion warping and we want to send an event.

01:09.470 --> 01:12.110
So two things to notify tracks.

01:12.110 --> 01:14.120
The first will be called motion warping.

01:15.510 --> 01:18.690
And we'll add another track and call this one.

01:19.380 --> 01:23.430
Events and we'll do the motion warping first.

01:23.610 --> 01:27.990
So I'm going to right click add, notify state motion warping.

01:27.990 --> 01:35.280
I'm going to grab this right handle of it, hold shift and I'd like to move to the right rotation at

01:35.280 --> 01:36.270
about here.

01:37.350 --> 01:42.810
So from the beginning to about here, we'll be facing the correct direction at that point.

01:42.810 --> 01:51.240
And we're going to take our root motion modifier change, warp target name to facing Target.

01:51.690 --> 01:53.390
I believe that's what it's called.

01:53.400 --> 01:57.770
We can always go back to BP enemy base.

01:57.780 --> 01:59.550
Yes, it's facing target.

01:59.550 --> 02:00.570
That's what it is.

02:00.720 --> 02:05.940
Now I'm going to uncheck warp translation and set rotation type to facing.

02:05.940 --> 02:08.280
And that's all we need to do now.

02:08.280 --> 02:13.110
We need to go to the part where we want to cause damage right about at the swipe.

02:13.110 --> 02:17.280
Now, here's the thing with a big, large swipe like this.

02:17.280 --> 02:24.780
I've seen some games implemented with multiple traces, multiple sphere or box or whatever traces,

02:24.780 --> 02:31.440
but I'd like to just have one big sphere overlap and use our same code that we've been using.

02:31.440 --> 02:39.790
We're going to be facing the correct direction anyway, so I'm just going to go ahead and send one single

02:39.790 --> 02:40.930
event right here.

02:40.930 --> 02:42.100
I'm going to right click.

02:42.100 --> 02:49.570
I'm going to add a notify, choose an Montage event, I'm going to select it and scroll up to change

02:49.570 --> 02:53.590
its event tag to and it's going to be montage Attack.

02:53.590 --> 02:55.080
And this is the right hand.

02:55.090 --> 02:56.920
It is the right hand, isn't it?

02:57.040 --> 03:04.960
This is ghoul attack L And in fact it looks like my animation is called Attack L But it's actually the

03:04.960 --> 03:06.550
right hand, isn't it?

03:06.670 --> 03:08.770
So that's funny.

03:09.010 --> 03:12.970
So I think we're going to need to rename a couple things here, aren't we?

03:12.970 --> 03:20.920
But because this is really literally the right hand we're going to use montage attack right hand and

03:20.920 --> 03:23.080
let's go ahead and rename this now.

03:23.260 --> 03:27.370
So the montage should be called attack are.

03:29.550 --> 03:35.370
And in fact attack L and attack R have to have their names swapped.

03:35.580 --> 03:39.780
So I'm going to take attack R and add an underscore at the end of its name.

03:39.900 --> 03:43.830
That way I can take attack L and rename it to attack R.

03:43.860 --> 03:50.580
I'm really sorry about you needing to do this and let's go to attack R and rename it to attack L.

03:50.850 --> 03:53.670
That should be a quick and easy fix.

03:53.760 --> 03:57.540
And now we have the correct name.

03:57.690 --> 03:58.520
All right.

03:58.530 --> 04:02.880
And we're sending the right hand montage tag.

04:03.180 --> 04:09.680
Now let's make one for the other attack, which is actually going to be attack L Right.

04:09.690 --> 04:20.340
So we're going to right click on Attack L Create and in Montage we're going to call this M ghoul attack

04:21.000 --> 04:21.510
L.

04:21.750 --> 04:25.980
We'll open it up and it looks definitely like the left hand.

04:26.010 --> 04:27.900
We're going to have a notify state.

04:27.900 --> 04:30.880
We're actually going to call this track motion warping.

04:32.370 --> 04:37.800
And make a new track here called Events and the Motion Warping.

04:37.830 --> 04:41.790
Track we're going to right click add, notify State choose motion warping.

04:41.790 --> 04:49.890
We'll put it to about here and we're going to expand root motion modifier, change the warp target name

04:49.890 --> 04:56.490
to facing target, uncheck warp translation set rotation type to facing.

04:56.490 --> 05:04.050
And then we just need to send an event and we're going to send it about right here so we can right click

05:04.080 --> 05:06.630
add, notify and montage event.

05:06.630 --> 05:11.190
Select it, scroll up and choose Attack left hand this time.

05:11.340 --> 05:13.380
So it's the left hand.

05:13.380 --> 05:16.920
And I'm just going to go back to our and make sure it's right hand.

05:16.920 --> 05:17.190
Yes.

05:17.190 --> 05:19.440
Now everything is correct.

05:19.440 --> 05:23.370
So now we have two attack montages for the ghoul.

05:23.370 --> 05:31.660
I'm going to save all and go back to BP Ghoul and search for attack montages and add an array element.

05:31.660 --> 05:40.600
This one is going to get my Am ghoul attack L and the montage tag montage attack left hand and then

05:40.600 --> 05:41.890
we'll add one more.

05:41.920 --> 05:48.940
This one gets ghoul attack R and the montage tag montage attack right hand.

05:48.940 --> 05:51.640
And now we should get a tax.

05:52.600 --> 05:55.360
Okay, so hopefully nothing was forgotten.

05:55.360 --> 05:59.290
We can play test this and see if the ghoul attacks.

06:01.310 --> 06:02.450
And it does now.

06:02.450 --> 06:09.680
It looks like it's overshooting just a bit and it looks like our enemies are hurting each other at some

06:09.680 --> 06:11.180
point, I think.

06:11.210 --> 06:16.010
Yeah, the enemies are hurting each other, but I'm not getting any attacks from my ghoul.

06:16.010 --> 06:16.970
That hurt me.

06:16.970 --> 06:17.870
Let's see.

06:19.220 --> 06:19.640
Okay.

06:19.640 --> 06:24.920
So a couple of things are going on here that we need to fix.

06:24.920 --> 06:28.100
For one, we're getting a random integer in range.

06:28.100 --> 06:35.990
This is a blueprint, pure function, and it's going to be evaluated every single time that a value

06:35.990 --> 06:37.040
is used from it.

06:37.040 --> 06:44.870
In other words, if we get a random value and access this tagged montage here in play montage and wait

06:44.900 --> 06:51.260
then later on when we're using the event tag in wait gameplay event, it's going to trigger this random

06:51.260 --> 06:54.440
int in range to fire again.

06:54.440 --> 06:58.900
So half the time we'll get the wrong montage and the wrong tag.

06:58.910 --> 07:01.280
Now the way to fix this is pretty easy.

07:01.280 --> 07:07.400
We just store this tagged montage in a variable, so we're going to promote that to a variable.

07:07.400 --> 07:13.610
We're going to take the result of the get here and promote to a variable and we're going to call this

07:13.610 --> 07:15.260
tagged montage.

07:15.260 --> 07:23.640
And that way we only get it once and from then on out we use that instead of what we broke from the

07:23.670 --> 07:24.450
get node.

07:24.480 --> 07:27.780
So we're going to delete that break tagged montage.

07:27.780 --> 07:35.730
We're going to get this one and break it and use the montage here and then drag out the montage tag

07:35.730 --> 07:38.100
here like so.

07:38.430 --> 07:41.790
Okay, so that should help with that.

07:41.790 --> 07:43.770
Let's see if we get some attacks.

07:44.990 --> 07:49.550
And we get an attack and it looks like the enemy stops.

07:52.210 --> 07:53.890
So there's an issue here.

07:53.920 --> 07:59.680
The gay melee attack stops the montage when the ability ends.

07:59.710 --> 08:02.860
It looks like we're going to need to uncheck that.

08:04.940 --> 08:06.440
All right, We'll try this again.

08:06.440 --> 08:13.400
I'm going to move the enemy over and move my player start over so that I can just interact with this

08:13.400 --> 08:14.090
enemy.

08:19.210 --> 08:19.810
Okay.

08:19.810 --> 08:22.140
So a couple things to tweak here.

08:22.150 --> 08:30.330
I'm going to want my ghoul attack motion warping to be a shorter window for both of these.

08:30.340 --> 08:37.660
I'd like to have it about like this for ghoul attack are for ghoul attack l I'm going to shorten it

08:37.660 --> 08:38.800
up as well.

08:38.890 --> 08:47.320
And just to double check, let's go to Google and search for name and sure enough, right hand socket

08:47.350 --> 08:48.880
name is not set.

08:48.880 --> 08:52.120
I'm going to set this to right hand socket.

08:52.270 --> 08:53.560
That should work.

08:54.390 --> 08:56.250
Let's see if we get an attack.

08:57.460 --> 09:01.480
And I don't think motion warping is actually working.

09:01.480 --> 09:06.190
Let's check out those animations and make sure root motion is working for them.

09:06.190 --> 09:11.110
I'm going to go to attack and scroll down and enable root motion is not checked.

09:11.110 --> 09:16.330
I'm going to check that I'm going to go to attack are same thing, enable root motion.

09:16.450 --> 09:21.310
I'm going to save all and that should enable root motion.

09:21.990 --> 09:26.400
And it looks like I'm actually getting some damage caused to me as well.

09:26.430 --> 09:28.050
Yeah, that's looking better.

09:28.730 --> 09:31.820
Okay, I'm going to hit the enemy.

09:32.650 --> 09:34.330
See if the enemy attacks.

09:34.330 --> 09:37.240
Okay, I'm going to hit the enemy while it's attacking.

09:37.850 --> 09:40.040
So there.

09:41.070 --> 09:42.330
And.

09:43.730 --> 09:46.680
As I suspected, the enemy isn't attacking anymore.

09:46.700 --> 09:50.960
Now, that's because our enemy's attack was interrupted.

09:51.080 --> 09:54.500
Which means the enemy never got to end its ability.

09:54.530 --> 09:59.240
So if this enemy's attack is interrupted, I'd like it to end the ability.

09:59.270 --> 10:01.930
Now, that could be because of the montage.

10:01.940 --> 10:08.430
So I'd like to end the ability when the montage is interrupted, cancelled or completed.

10:08.450 --> 10:10.430
So end ability.

10:12.520 --> 10:14.640
We'll go ahead and do that here.

10:14.650 --> 10:20.740
Not blend out, though, because blend out happens a little before the montage finishes.

10:20.740 --> 10:27.700
But another thing that I'd like to do is I'd like to cancel this ability as soon as this enemy starts

10:27.730 --> 10:28.990
a hit, react.

10:29.170 --> 10:32.000
So I'm going to go to my hit React ability.

10:32.140 --> 10:42.070
Gar hit React and here in my tags I'm going to cancel abilities with tag and add the abilities attack

10:42.100 --> 10:42.820
tag.

10:42.820 --> 10:49.990
So if our ghoul hit reacts and it's got any abilities with the abilities attack tag, it's going to

10:50.020 --> 10:51.220
cancel those abilities.

10:51.220 --> 10:57.640
And that includes when I hit it with a hit react so like that let's see.

10:57.640 --> 10:58.060
Yep.

10:58.060 --> 10:59.800
And sure enough it attacks me.

11:00.340 --> 11:02.740
Now things are looking pretty good.

11:02.770 --> 11:08.110
Of course we want to avoid enemies hurting each other, unless you like that kind of thing.

11:08.110 --> 11:11.350
But this is looking pretty good for now.

11:11.350 --> 11:18.590
And I think I'm going to just do one last tweak on the ghoul, and that is to actually make its capsule

11:18.620 --> 11:20.120
a little bit wider.

11:20.240 --> 11:26.960
I'm going to make the capsule radius a bit like this so the enemy doesn't get too close.

11:27.970 --> 11:30.790
And it looks like it missed me there.

11:31.650 --> 11:33.630
It hit me there, though, so.

11:35.480 --> 11:36.980
That's looking pretty good.

11:36.980 --> 11:40.960
So aside from some tweaks, things are looking pretty nice.

11:40.970 --> 11:43.580
I am getting damaged by the enemy.

11:44.680 --> 11:46.270
So things are looking good.

11:46.270 --> 11:50.410
I think it's damaging some of the other enemies as well.

11:50.440 --> 11:58.450
So we are going to want to avoid friendly fire on the enemies so that they only attack and hurt the

11:58.450 --> 12:00.670
player and not other enemies.

12:00.670 --> 12:02.620
That's something we can take care of.

12:02.620 --> 12:04.570
We'll take care of that in the videos to come.

12:04.570 --> 12:06.420
But this is looking pretty good.

12:06.430 --> 12:09.700
We now have two different types of melee attackers.

12:09.700 --> 12:15.460
We have the spear attacker and we have our ghoul, and that's looking pretty great.

12:15.490 --> 12:20.860
Now, our ranged attackers are just kind of hanging back and they're not really doing much right.

12:20.860 --> 12:24.010
So we need them to start launching stuff at us.

12:24.010 --> 12:27.400
But other than that, things are looking good.

12:28.750 --> 12:32.230
We do want our ghoul to die, of course.

12:32.230 --> 12:37.630
And we're also going to need to make our enemies a lot weaker by the way of health.

12:37.630 --> 12:41.080
So that's another thing we're going to need to fix as well.

12:41.080 --> 12:45.040
So that way we can test death along with everything else.

12:45.250 --> 12:46.360
All right.

12:46.360 --> 12:47.410
Excellent job.

12:47.410 --> 12:49.780
And I'll see you in the next video.
