WEBVTT

00:06.870 --> 00:07.980
Welcome back.

00:08.010 --> 00:11.460
Now we have a slingshot animation blueprint.

00:11.460 --> 00:15.090
And thanks to that, our goblin is holding the pouch.

00:15.090 --> 00:16.470
And that looks pretty great.

00:16.470 --> 00:18.990
But what about when firing the weapon?

00:19.110 --> 00:26.970
Well, when firing the weapon, we're going to want to play a fire montage for that weapon.

00:26.970 --> 00:30.530
And this is specific to the Goblin Slingshot enemy.

00:30.540 --> 00:37.650
So I think what we can do is we can have a Boolean on the Slingshot animation blueprint for whether

00:37.650 --> 00:44.580
or not we should actually be transform modifying the bone and while firing the weapon, we can set that

00:44.580 --> 00:48.590
to false and play that animation montage.

00:48.600 --> 00:52.550
So the way I'm going to handle this is my app.

00:52.560 --> 00:57.450
Slingshot is going to have a Boolean variable, so I'm going to add a variable here.

00:57.450 --> 01:00.870
I'm going to call this holding pouch.

01:01.850 --> 01:06.560
And holding pouch will be true by default.

01:06.560 --> 01:09.560
So I'm going to compile and set it to true.

01:09.680 --> 01:18.260
And in my animation blueprint here, I'm going to blend poses by bool so that if we're holding the pouch,

01:18.260 --> 01:22.250
we should not be using the transform modify bone pose.

01:22.250 --> 01:27.980
We should use just the default idle pose so I can take my slingshot idle.

01:29.300 --> 01:34.820
Animation, drag it out here and use a blend poses by bool.

01:36.410 --> 01:39.050
And simply check holding pouch.

01:39.050 --> 01:46.970
And if holding pouch is true, which it is by default, then we'll use this whole pose that we get from

01:46.970 --> 01:47.480
there.

01:47.510 --> 01:52.550
It doesn't matter if we use the slot or not, because while we're holding the pouch, we're not going

01:52.550 --> 01:55.160
to try playing any montages.

01:55.160 --> 02:00.110
So this will be for the true pose and the slingshot idol will be for the false pose.

02:00.110 --> 02:02.210
And we can go ahead and just hook that up.

02:03.600 --> 02:08.310
Now the question is, when do we change this holding pouch variable?

02:08.460 --> 02:13.650
Well, we can do so based on our Goblin's attack animation.

02:13.650 --> 02:21.720
So I'm going to go into my assets folder, into enemies goblin animations, slingshot, and check out

02:21.720 --> 02:25.080
my attack goblin slingshot montage.

02:25.110 --> 02:33.570
I can place a couple notifies here and in my Goblin Slingshot animation blueprint, I can access my

02:33.570 --> 02:37.920
weapons animation blueprint and set that holding pouch boolean.

02:37.920 --> 02:44.010
And if we really want to see what that slingshot looks like in that left hand, we can go to the weapon

02:44.010 --> 02:51.600
hand socket, we can add a preview asset and search for the slingshot and stick it on there so we can

02:51.600 --> 02:53.070
really kind of see what it looks like.

02:53.070 --> 02:56.490
We're not going to see that pouch on the hand, but that's okay.

02:56.880 --> 03:05.740
So what we want to do is as soon as we release that slingshot right about here, we are going to want

03:05.740 --> 03:07.870
to create an anim notify.

03:07.900 --> 03:10.060
So I'm going to add a new notify track.

03:10.090 --> 03:12.310
This will be for the Rock.

03:12.310 --> 03:13.740
I'm going to call it rock.

03:13.750 --> 03:18.850
I'm going to right click, add a notify, go to skeleton notifies.

03:18.850 --> 03:23.080
And in this asset pack, these two notifies already exist.

03:23.080 --> 03:27.940
Release rock and grab pouch and a new project.

03:27.940 --> 03:31.210
You would say new notify and call it what you want.

03:31.210 --> 03:36.670
But I'm going to use the two that exist here in this asset pack release rock.

03:36.670 --> 03:42.670
And then after releasing the Rock, we go back to about here where we can grab that pouch again.

03:42.670 --> 03:47.890
So right about here, I'm going to add another notify and choose that grab pouch.

03:47.890 --> 03:48.880
Notify.

03:48.910 --> 03:54.030
So these notify just exist already in this project, but you could just create new ones.

03:54.040 --> 03:55.300
It doesn't matter.

03:55.420 --> 04:03.370
Now what we need to do is respond to these in the Goblin Slingshot animation blueprint, and we can

04:03.370 --> 04:09.160
go to that animation blueprint with this icon up here hovering over it, we see a goblin slingshot.

04:09.190 --> 04:16.270
If we click on that now we're in the event graph for this particular Goblin Slingshot character.

04:16.570 --> 04:24.130
Now what I want to do is in the very beginning an event initialize animation, event, blueprint, initialize

04:24.130 --> 04:24.970
animation.

04:24.970 --> 04:32.740
I want to get the pawn owner and I want to access its weapon and from there get its weapons animation

04:32.740 --> 04:36.790
blueprint and then we'll have a reference to that slingshot and MVP.

04:37.150 --> 04:41.050
So we'll do a couple of casts, but this will only happen once here.

04:41.050 --> 04:50.200
What we'll do is we'll take the pawn owner we're going to cast to specifically Goblin Slingshot.

04:50.290 --> 04:55.690
And this is okay, because this animation blueprint is unique to the Slingshot Goblin.

04:55.690 --> 04:59.800
And as the Slingshot goblin, we're going to get its weapon.

04:59.800 --> 05:05.440
So we're going to search for weapon and we need that weapon to be exposed to the event graph.

05:05.440 --> 05:07.900
That means we're going to have to close down.

05:07.900 --> 05:13.360
We'll save all and go into our base character and expose that variable.

05:13.360 --> 05:20.500
So we'll go into character actually in our public folder character or a character base and find the

05:20.500 --> 05:21.100
weapon.

05:21.100 --> 05:23.530
It's in the protected section, it's edit anywhere.

05:23.530 --> 05:27.190
We also need this to be blueprint read only at least.

05:28.880 --> 05:32.420
So making that change, we can compile and launch again.

05:34.180 --> 05:39.970
And back in the editor, we can go back into the animation blueprint for the Goblin Slingshot.

05:39.970 --> 05:43.510
And now that we've exposed the weapon, we can get it.

05:43.840 --> 05:45.370
So get weapon.

05:45.370 --> 05:51.160
And from the weapon we want its animation blueprint to get that we call get anim instance.

05:51.190 --> 05:59.050
Now this returns the anim instance, but we have to cast that in turn to the Slingshot animation blueprint.

05:59.050 --> 06:02.200
So we're going to cast to a slingshot.

06:02.380 --> 06:04.910
That's the weapon animation blueprint.

06:04.930 --> 06:12.820
Once we have that, we can go ahead and promote this to a variable and call it a slingshot.

06:13.960 --> 06:22.570
Now that we have a slingshot, we're in business because now we can respond to those notifies release

06:22.570 --> 06:25.720
rock and grab pouch and set that boolean.

06:25.930 --> 06:29.770
So let's right click and type release rock.

06:30.970 --> 06:34.450
And we're going to get our app Slingshot.

06:34.480 --> 06:38.350
We can make this a validated get by right clicking and converting it.

06:38.350 --> 06:45.340
And from our app Slingshot, we can set that blueprint called, what was it called?

06:45.340 --> 06:46.630
Grabbing Pouch.

06:46.870 --> 06:47.830
Let's see.

06:47.830 --> 06:49.990
We'll go back to App Slingshot.

06:50.020 --> 06:51.820
It's called Holding Pouch.

06:55.030 --> 06:57.850
So we can get the setter for holding pouch.

06:57.850 --> 07:01.410
And if we're releasing the rock, we want to set this to false.

07:01.420 --> 07:03.010
So that's what we're going to do.

07:03.040 --> 07:05.050
We're going to release that pouch.

07:05.570 --> 07:14.420
Now, in the case that this up here failed for whatever reason, if it was called too early before the

07:14.420 --> 07:23.390
Slingshot animation blueprint was valid or whatever reason we could take the is not valid and go through

07:23.390 --> 07:32.300
this whole process again, as in try get pawn owner cast to Goblin Slingshot get its weapon.

07:32.330 --> 07:38.000
This whole thing we could just duplicate down here and hook it up to is not valid.

07:38.150 --> 07:42.110
In that case, that would take care of the not valid case.

07:42.230 --> 07:45.680
But as soon as it's valid, it'll never be not valid again.

07:45.680 --> 07:48.590
So we don't have to worry too much about that.

07:49.170 --> 07:56.820
Now, as soon as we release the pouch, we could play that montage, that animation for our slingshot,

07:56.850 --> 07:58.920
that slingshot attack animation.

07:58.920 --> 08:00.360
We can find that.

08:00.360 --> 08:02.410
It's called Slingshot Attack.

08:02.430 --> 08:06.640
We can browse to it and we can make an animation montage for it.

08:06.660 --> 08:15.180
We can right click create, create an a montage, call it a m, underscore slingshot, underscore attack.

08:15.600 --> 08:18.420
So we have this slingshot attack montage.

08:18.420 --> 08:19.860
We could play that.

08:19.890 --> 08:23.610
We can do that right after setting holding pouch to false.

08:23.610 --> 08:31.740
So what we could do is take the A slingshot that animation blueprint and call montage play.

08:35.700 --> 08:39.240
And we can play that montage.

08:39.240 --> 08:41.910
We can just select it from the dropdown.

08:43.010 --> 08:44.270
Searching for Slingshot.

08:44.300 --> 08:47.480
We have slingshot attack and we can play it there.

08:48.530 --> 08:49.160
Okay.

08:49.160 --> 08:52.100
So that takes care of releasing the rock.

08:52.100 --> 08:55.340
But then when we grab the pouch, we need to handle that case.

08:55.340 --> 09:03.200
So we're going to right click and use our grab pouch and notify and we're going to copy these nodes

09:03.200 --> 09:07.640
and paste them so that we can set holding pouch to true.

09:07.640 --> 09:13.820
Again, I'm not concerned with the not valid case because by this time we know that we've released the

09:13.820 --> 09:14.720
Rock first.

09:14.720 --> 09:20.240
So by the time we hit Grab Pouch, it's definitely valid, that animation blueprint variable.

09:20.450 --> 09:27.470
So now if our goblins attack happens, we know that it's going to get that animation blueprint for the

09:27.470 --> 09:28.250
slingshot.

09:28.250 --> 09:33.890
It's going to set that holding pouch boolean and it's going to play the montage for it.

09:33.890 --> 09:40.820
So we should be able to see all that when our goblin attacks when it shoots at us.

09:43.220 --> 09:46.190
And it's a little hard to see, but I can definitely see it.

09:46.220 --> 09:49.400
We can, of course, zoom in a bit.

09:49.430 --> 09:56.480
We can even go to another map so that we only have just a goblin slingshot here.

09:56.630 --> 09:59.330
And that will allow us to see a little better.

09:59.330 --> 10:05.200
And why don't we just really quick go to our blueprints character.

10:05.620 --> 10:08.150
Ora ora character.

10:08.150 --> 10:10.790
We can bring in that spring arm a bit.

10:10.790 --> 10:12.050
It's at 800.

10:12.080 --> 10:14.210
We're going to bring it in to about four.

10:14.940 --> 10:16.200
360 or so.

10:16.200 --> 10:17.280
And.

10:18.140 --> 10:20.090
Let's see if we can get a better look.

10:21.000 --> 10:24.270
And there's that slingshot attacking.

10:24.270 --> 10:25.770
Look at that stretch.

10:25.770 --> 10:27.060
That looks great.

10:27.090 --> 10:27.990
I know.

10:27.990 --> 10:30.600
It just killed Aura and it's still firing.

10:30.600 --> 10:32.070
That's something we have to deal with.

10:32.070 --> 10:33.420
But look at that.

10:33.420 --> 10:34.860
That is looking nice.

10:34.860 --> 10:40.830
We can even eject and kind of zoom in and just admire how this looks.

10:40.830 --> 10:42.750
This is really pretty cool.

10:42.750 --> 10:51.030
And this concept can be used for bow and arrow characters for crossbows, really anything that requires

10:51.030 --> 10:53.490
movement on that weapon.

10:53.610 --> 10:56.190
So that is super cool.

10:56.280 --> 11:02.190
Now, back here in the other level, let's just make sure things are looking good over here, make sure

11:02.190 --> 11:04.200
there isn't anything too crazy.

11:04.230 --> 11:10.380
One thing I'm noticing and I don't know if I can repro it here, is that the rocks are blocking the

11:10.380 --> 11:11.550
camera channel.

11:11.550 --> 11:15.270
In fact, I don't think the rocks should block anything.

11:15.270 --> 11:18.750
We have our overlap events for things like that.

11:18.750 --> 11:22.600
So I'm just going to go to the Slingshot rock.

11:23.230 --> 11:30.460
And I might have to go into blueprints, ability system, enemy abilities and slingshot rock.

11:30.550 --> 11:34.630
And I'm going to take the rock mesh and disable collision on it.

11:34.630 --> 11:36.940
I don't want it interacting with anything.

11:38.300 --> 11:40.220
So I'm going to set it to no collision.

11:40.220 --> 11:47.630
And the sphere itself should already be ignoring camera and visibility and the sphere could be a little

11:47.630 --> 11:49.040
bit smaller, I think.

11:49.040 --> 11:53.450
But again, we don't want too much precision in a top down.

11:53.450 --> 11:59.960
We can have a little bit of leeway when it comes to these collision volumes as everything will be zoomed

11:59.960 --> 12:00.440
out.

12:00.440 --> 12:00.950
Right.

12:00.950 --> 12:08.330
Aura is not always going to be with the spring arm length of 360, it's more likely going to be 800.

12:08.330 --> 12:12.950
Unless, of course, we make that something you could change in game, but this is more likely.

12:12.950 --> 12:20.960
And so for that reason we don't really want a really small sphere for those projectiles.

12:21.140 --> 12:21.710
All right.

12:21.710 --> 12:27.680
And one last thing that I'm noticing is my slingshot goblins are actually sliding now.

12:27.710 --> 12:33.290
I don't see them running and that means I broke something.

12:33.290 --> 12:40.710
So let's go into the animation blueprint and notice that we're depending on some things happening in

12:40.710 --> 12:42.480
the Parent Blueprint event.

12:42.480 --> 12:48.450
Update Animation is calling the parent version, but now we're using initialize animation that's not

12:48.450 --> 12:49.800
calling the parent version.

12:49.800 --> 12:55.560
So we're going to have to right click and add a call to the parent function and let's make sure that

12:55.560 --> 13:00.960
we're calling that so that everything is initialized on the parent as well.

13:00.960 --> 13:07.260
So now if we press play, now they're running with their tiny little cute legs and everything's looking

13:07.260 --> 13:07.890
great.

13:08.040 --> 13:08.940
Excellent.

13:09.390 --> 13:10.800
See you in the next video.
