WEBVTT

00:06.910 --> 00:08.050
Welcome back.

00:08.230 --> 00:15.220
So now that we've associated our montages with gameplay tags, we now want to get the correct socket

00:15.220 --> 00:20.200
location because some of our characters have weapons, others don't.

00:20.200 --> 00:25.900
And our goal, for example, is going to have two sockets, one on the left hand, one on the right,

00:25.900 --> 00:30.200
and each montage is associated with that given socket.

00:30.220 --> 00:38.220
So what we need is a way to use a tag identifying a socket and retrieving that tag.

00:38.230 --> 00:42.810
So get combat socket location needs to take a gameplay tag now.

00:42.820 --> 00:45.520
So we're going to do that in this video.

00:45.520 --> 00:52.030
So first we go to the combat interface to our get combat socket location and we change it.

00:52.030 --> 00:57.880
So it's going to now have a const gameplay tag and we'll pass that in by reference.

00:57.880 --> 01:01.210
We're going to call this montage tag.

01:02.140 --> 01:04.990
Now that means we need to change it everywhere.

01:04.990 --> 01:11.870
We're using it where implementing this in Aura character base, which means we have to find get combat

01:11.870 --> 01:17.120
socket location here and change that, make sure it takes that input parameter.

01:17.120 --> 01:20.180
And we also have to change the definition here.

01:20.270 --> 01:25.880
Now we're checking the weapon and we know that that's not going to fly for our ghoul, is it?

01:25.880 --> 01:29.090
Our ghoul doesn't have a weapon, so that check would fail.

01:29.090 --> 01:31.100
We're going to remove that right away.

01:31.160 --> 01:37.970
And here we need to actually return the socket based on this montage tag.

01:37.970 --> 01:39.940
So that's something we're going to have to do.

01:39.950 --> 01:47.630
Let's do a to do here that says return correct socket based on montage tag.

01:48.620 --> 01:54.560
Now we're also using get combat socket location in aura, a projectile spell.

01:54.560 --> 02:01.790
So we need to go into ability system abilities into aura projectile spell where we're calling get combat

02:01.790 --> 02:04.370
socket location the execute version.

02:04.370 --> 02:08.690
Now that this has a input parameter that's going to be the second input.

02:08.690 --> 02:12.860
So we need to pass one of those in and that needs to be a gameplay tag.

02:12.860 --> 02:16.910
So what we can do is use F or a gameplay tags get.

02:18.740 --> 02:22.760
Dot and we can get montage attack weapon.

02:22.790 --> 02:27.020
That's the gameplay tag that we'd like to associate with the weapon.

02:27.020 --> 02:33.880
But of course get combat socket location needs to do the right thing based on that tag, doesn't it?

02:33.890 --> 02:39.470
So we only have three options weapon left hand and right hand.

02:39.470 --> 02:42.740
So I think I can just check those three cases here.

02:42.770 --> 02:45.650
Now, you may not like that solution.

02:45.650 --> 02:49.430
You may wish for this to be something that doesn't have to change.

02:49.430 --> 02:57.500
If we expand the number of sockets possible for all of our enemies and so on in this project, I know

02:57.500 --> 03:03.950
that I only have enemies that either have weapons or a left and a right hand, so I'm okay with just

03:03.950 --> 03:09.590
checking these three, but if you really wanted, you could make this a little more data driven.

03:09.590 --> 03:17.510
You could make a team map mapping montage tags to names for the socket location and make this an algorithm

03:17.610 --> 03:20.610
that will look up that team map.

03:20.610 --> 03:23.430
So just so you know, you could do it that way.

03:23.430 --> 03:26.340
You could make this a little bit less hardcoded.

03:26.340 --> 03:30.060
But in this case, I'm okay with just having three cases.

03:30.060 --> 03:34.710
I don't foresee any additions to this for any different types of enemies.

03:34.710 --> 03:40.770
So what I'm going to do is literally check the montage tag and return the socket based on that.

03:40.770 --> 03:53.520
So I'm going to say if montage tag dot matches tag exact and f or a gameplay tags get dot montage attack

03:53.520 --> 03:54.210
weapon.

03:54.510 --> 03:59.340
Now I could just store a local F or a gameplay tags.

03:59.340 --> 04:09.450
We could make this a const reference called gameplay tags and use f or a gameplay tags get so we don't

04:09.450 --> 04:16.680
have to type so much each time, but if this is the case, then I'm going to return the socket on the

04:16.680 --> 04:17.250
weapon.

04:17.250 --> 04:22.170
So I'm going to cut that and paste it here and I'm also going to make sure the weapon is valid.

04:22.170 --> 04:27.840
So I'm going to have an and is valid and check the weapon.

04:28.860 --> 04:33.000
I can replace the call to get with gameplay tags here.

04:33.240 --> 04:39.480
Now I'm also going to check for the other two types of montage tags.

04:39.480 --> 04:41.310
So I'm going to paste this twice.

04:41.340 --> 04:49.140
The next one is going to be Montage attack left hand and I'm not going to check is valid for the weapon.

04:49.140 --> 04:53.010
We're going to use the mesh on the character for this.

04:53.010 --> 04:59.910
So we're going to return instead of weapon, we're going to call, get mesh and get socket location

04:59.910 --> 05:04.080
and we actually need a socket name for the left and right hands.

05:04.080 --> 05:10.530
So we'll go ahead and add those to our character base along with weapon type socket name.

05:10.530 --> 05:14.340
We'll have two more that will set from the blueprint.

05:14.610 --> 05:21.950
So instead of weapon tip, this will say left hand and instead of weapon tip, this one will say right

05:21.950 --> 05:22.580
hand.

05:23.360 --> 05:27.950
And that's what we'll use here in this function.

05:27.950 --> 05:31.160
We're going to get mesh, get socket location.

05:31.160 --> 05:32.480
This is for the left hand.

05:32.480 --> 05:39.740
So we're going to say left hand socket name and the next one is checking against montage attack right

05:39.740 --> 05:40.490
hand.

05:40.520 --> 05:47.870
We're not going to check as valid weapon and we're going to use get mesh instead of the weapon, get

05:47.870 --> 05:52.640
socket location passing in right hand socket name.

05:52.850 --> 05:58.400
So now get combat socket location will return the correct thing.

05:58.430 --> 06:03.950
Now before we compile and launch, we just need to make sure all paths return a value, which means

06:03.950 --> 06:09.470
by the end of this function, if we haven't returned yet, we can return an empty f vector.

06:09.470 --> 06:17.510
So the last thing to do is compile and we can go back into the editor and fix up our blueprint where

06:17.510 --> 06:18.650
we're calling this.

06:19.900 --> 06:22.570
So opening our gameplay ability.

06:22.600 --> 06:23.880
Melee attack.

06:23.890 --> 06:31.040
Now we can pass in a montage tag into jet combat socket location.

06:31.060 --> 06:34.060
Now that's going to be the tag we're waiting for.

06:34.210 --> 06:38.440
So we're going to get it from this break tagged montage here.

06:38.470 --> 06:40.300
That's what we're passing in.

06:40.660 --> 06:43.930
So we'll go ahead and pass that in compile.

06:43.930 --> 06:45.520
And now this should work.

06:45.550 --> 06:52.750
As we're getting that tag from using our combat interface and our Goblin Spear.

06:52.780 --> 06:55.450
If we search for its attack montages.

06:56.590 --> 06:59.860
We see that it's using a montage attack weapon.

06:59.860 --> 07:08.290
So really we're never going to use the tag we were using before, which was event, montage, attack,

07:08.290 --> 07:08.740
melee.

07:09.040 --> 07:11.560
We can actually remove that melee tag.

07:11.560 --> 07:13.360
We're not going to use that anymore.

07:13.540 --> 07:17.800
We are still using event montage firebolt, So we'll leave that one.

07:18.310 --> 07:19.120
Okay.

07:19.810 --> 07:22.300
Let's save all and test.

07:23.340 --> 07:28.310
See if we still take damage, if we're still getting that montage being played.

07:28.320 --> 07:31.080
Everything still works perfect.

07:31.670 --> 07:39.290
Now, this is great because now our melee attack can be used on characters that use an attack montage

07:39.290 --> 07:46.410
and really any of the three sockets, whether it has a weapon or it's using sockets on its hands.

07:46.430 --> 07:53.330
So that means we're going to go to our ghoul static mesh and go to his hands and add sockets to it so

07:53.330 --> 07:54.740
that we can use those.

07:54.770 --> 08:00.530
Now the hand is kind of the forearm bone, so I'm going to get the wrist bone, which is a little farther.

08:00.530 --> 08:09.410
And this is wrist L I'm going to right click and add a socket and rename this socket to left hand socket

08:09.410 --> 08:19.700
and I'm going to go to wrist are add a socket and call this one right hand socket and just make sure

08:19.700 --> 08:22.400
that these are at a good location.

08:22.400 --> 08:24.890
I'll move them out on the hands just a bit.

08:25.910 --> 08:26.660
Like so.

08:26.660 --> 08:32.270
And when we make a Goole blueprint, we're going to make sure to set those socket names.

08:32.270 --> 08:40.040
And our goblin spear should have its weapon type socket name set to type socket.

08:40.040 --> 08:41.030
And it does.

08:42.000 --> 08:46.740
If I just search for combat, I see all three of them and I don't need to set left hand socket name

08:46.740 --> 08:49.830
or right hand because we're only using the weapon.

08:49.860 --> 08:50.790
All right.

08:50.820 --> 08:52.080
We're one step closer.

08:52.080 --> 08:59.610
We're almost ready to start making a ghoul blueprint, and the ghoul is going to get to use the melee

08:59.610 --> 09:07.410
attack and it's going to have its own attack montages using the left and the right hands.

09:07.620 --> 09:08.640
Excellent job.

09:08.640 --> 09:10.710
And I'll see you in the next video.
