WEBVTT

00:06.860 --> 00:07.850
Welcome back.

00:08.270 --> 00:12.380
Now we're applying damage, but so far that's been pretty boring.

00:12.410 --> 00:19.490
Aside from showing how much health we have on our enemy with these health bars, which do look good,

00:19.520 --> 00:22.410
we would like our enemies to react in some way.

00:22.430 --> 00:27.410
So in this video, we're concerned with a hit react of some sort.

00:27.530 --> 00:30.110
So how are we going to accomplish this?

00:30.140 --> 00:33.840
Well, a gameplay ability is a good idea.

00:33.860 --> 00:40.280
We can activate an ability if we've damaged our enemy without killing them.

00:40.280 --> 00:42.080
But what can that ability do?

00:42.110 --> 00:45.250
Well, we need to be able to respond in some way.

00:45.260 --> 00:52.040
We'd like to play a hit React montage, for example, and that montage can be something that we have

00:52.040 --> 00:52.670
on the enemy.

00:52.670 --> 00:59.210
So it's specific to the enemy, but we'd also like to be able to prevent things from happening while

00:59.210 --> 01:00.950
the enemy is hit reacting.

01:00.980 --> 01:09.690
Let's take a look at the assets folder and go to enemies Goblin animations, Spear and it looks like

01:09.690 --> 01:11.480
we have hit React Spear.

01:11.490 --> 01:15.780
So here's a hit React animation for when the enemy is hit.

01:15.810 --> 01:21.660
While that's happening, I don't want the enemy to be able to move or attack or do anything.

01:21.660 --> 01:29.220
So I'd essentially like my enemy to be immobilized for a second while this animation is being played.

01:29.250 --> 01:38.220
Now, while that's happening, we can give this enemy a gameplay tag and we know that gameplay effects

01:38.220 --> 01:41.940
are a good way to apply gameplay tags to enemies.

01:41.940 --> 01:48.840
So I think it would be a good idea to make a gameplay effect that will give this enemy a tag.

01:48.840 --> 01:55.920
And if we decide that that effect would like to modify any attributes or do anything else really, we

01:55.920 --> 01:58.830
could add more functionality in the future.

01:58.830 --> 02:02.940
But I'd like a basic gameplay effect that will apply this tag.

02:02.940 --> 02:10.100
Now that means we need a tag to apply and we know that we can add native gameplay tags to our for a

02:10.110 --> 02:11.010
gameplay tag.

02:11.010 --> 02:11.910
Singleton.

02:11.910 --> 02:19.980
If we're going to want to use those tags in C plus plus now we are going to want to use this particular

02:19.980 --> 02:27.630
gameplay tag in C plus plus because I'd like to be able to respond with callbacks to delegates that

02:27.630 --> 02:35.010
the Ability system broadcasts whenever an ability system component is granted a tag, say by a gameplay

02:35.010 --> 02:35.640
effect.

02:35.640 --> 02:38.280
So we have a number of things we'd like to do here.

02:38.310 --> 02:45.060
We'd like to give this enemy a gameplay tag using a gameplay effect, which means we need that tag,

02:45.060 --> 02:45.540
right?

02:45.540 --> 02:48.060
So these will be our first steps.

02:48.780 --> 02:53.340
So you now have a quest for this hit React gameplay effect.

02:53.340 --> 02:55.440
We're going to need a couple of things.

02:55.590 --> 03:02.880
First, I'd like you to create the gameplay effect G hit, react and create a native gameplay tag called

03:02.880 --> 03:09.570
effect Hit React and you're going to grant effects dot hit react in this g hit react.

03:09.600 --> 03:15.780
Now this can be an infinite gameplay effect so that we can remove it at some later point in time.

03:15.870 --> 03:19.470
Go ahead and pause the video and conquer this quest now.

03:22.580 --> 03:25.300
Okay, so we need a gameplay effect.

03:25.310 --> 03:32.390
I'm going to go into content blueprints, ability system, gameplay effects, and we're going to have

03:32.390 --> 03:35.780
a gameplay effect here for Hit React.

03:36.050 --> 03:42.080
So let's go ahead and create a new blueprint class Search for gameplay effect.

03:42.790 --> 03:46.960
Choose that and this will be our g underscore.

03:47.320 --> 03:53.650
Hit react so we can open this up and this will be an infinite gameplay effect.

03:53.650 --> 04:00.310
So we'll go ahead and change its duration policy to infinite and we need to add a tag to its granted

04:00.340 --> 04:01.210
tags.

04:01.240 --> 04:04.750
Now we're going to want to add that to our native tags.

04:04.750 --> 04:11.590
So I'm going to go ahead and close the editor and open up our gameplay tags and we'll add a hit react

04:11.620 --> 04:14.410
tag and this will go just under damage.

04:14.410 --> 04:22.840
So we're going to say F gameplay tag and we'll call this effects underscore, hit, react.

04:22.840 --> 04:26.830
And we need to add this in the CPP file as well.

04:26.830 --> 04:32.800
So we'll copy the very last tag that we made, which is damage and we're going to go ahead and make

04:32.800 --> 04:37.270
our new tag, which is effects underscore, hit, react.

04:37.300 --> 04:47.480
Now the tag itself will be effects dot hit react and for the comment we can say tag granted when hit

04:47.480 --> 04:48.410
reacting.

04:48.410 --> 04:54.200
So now that we have this tag, we should be able to add this to our gameplay effect.

04:54.350 --> 04:57.740
So we'll go ahead and compile and launch the editor now.

04:59.070 --> 05:00.510
And back in the editor.

05:00.510 --> 05:05.070
Let's open up our asset editors and here's G hit react.

05:05.220 --> 05:12.420
We need to go down to its granted tags and add to added our effects dot hit react.

05:12.540 --> 05:16.920
And now our gameplay effect will grant this tag.

05:16.980 --> 05:23.100
So now that we have an effect that when we grant it the ability system component we grant it to will

05:23.100 --> 05:27.990
have this tag, I'd like to be able to respond to getting this tag.

05:28.050 --> 05:29.100
And we can do that.

05:29.100 --> 05:31.160
We can respond in C plus plus.

05:31.170 --> 05:35.490
I'm going to close the editor and I'm done with our gameplay tags.

05:35.490 --> 05:36.870
I'm going to close that.

05:37.140 --> 05:40.770
I'm done with our gameplay ability or a projectile spell.

05:40.800 --> 05:46.230
I'm going to leave the attribute set open, but I'd like to go into my enemy class.

05:46.350 --> 05:53.880
So I'm going to go to my public folder into character and open Aura Enemy, and I'll go ahead and get

05:53.880 --> 05:57.300
the header and CPP files both open here.

05:58.630 --> 06:07.030
And what I'd like to do in Aura Enemy is listen for a gameplay tag change on the ability system component.

06:07.060 --> 06:08.080
We can do that.

06:08.080 --> 06:09.850
We can listen for a change.

06:09.850 --> 06:15.370
If a gameplay tag is added or removed, we can do something in response to that.

06:15.550 --> 06:18.970
That's what I'd like to do for the hit React tag.

06:19.360 --> 06:25.510
So I'm going to go into my begin play where we know that we're going to have access to our ability system

06:25.510 --> 06:33.010
component, and I'd like to bind a callback or a lambda to a delegate that's broadcast from the ability

06:33.010 --> 06:34.240
system component.

06:34.270 --> 06:36.670
Whenever a tag is added.

06:36.670 --> 06:37.840
We can do that.

06:37.930 --> 06:44.440
Now I've got some extra empty space that I'm going to clear up right here before scrolling down.

06:44.440 --> 06:50.740
And here we have our ability system component and we're binding to some delegates on it here.

06:51.070 --> 06:55.630
I'd like to bind to one right here since we have our ability system component.

06:55.630 --> 06:58.780
So I'm going to say ability system component.

06:58.780 --> 07:05.320
And the function I'm after is register gameplay tag event.

07:05.320 --> 07:12.850
So this says allow events to be registered for specific gameplay tags being added or removed so we can

07:12.850 --> 07:18.610
specify a gameplay tag and we can also specify what happens in response.

07:18.640 --> 07:21.250
In other words, we can have a callback for it.

07:21.490 --> 07:24.640
So I'd like to make a callback that can be bound to this.

07:24.640 --> 07:28.690
Now this function returns a delegate of type on gameplay effect.

07:28.720 --> 07:35.590
Tag count changed so we can see what the signature needs to be for a callback that can be bound to this.

07:35.830 --> 07:40.570
I'm going to go to declaration of this where I can see the type here.

07:40.690 --> 07:45.250
I can right click on that, go to its declaration and here it is.

07:45.580 --> 07:52.750
We see that it's a multicast delegate to params that takes a const gameplay tag and an int 32.

07:52.780 --> 07:56.380
This is actually for the new tag count.

07:56.470 --> 08:01.970
Remember, we can have tag counts, we can have multiple tags of the same kind.

08:01.970 --> 08:05.900
So we need a callback with this particular signature.

08:05.900 --> 08:08.480
So let's make one here in enemy.

08:08.780 --> 08:15.800
I'm going to go ahead and close gameplay effect types and ability system component and make a callback.

08:15.890 --> 08:21.260
It's going to be a void function called hit react tag changed.

08:21.410 --> 08:27.140
So this will be the function we have called when our hit react tag is changed and I'm going to move

08:27.140 --> 08:30.710
this all the way up to the public section here.

08:33.120 --> 08:37.710
Now this needs a signature with a const F gameplay tag.

08:39.690 --> 08:46.920
We'll call this callback tag and an int 32 called New Count.

08:49.470 --> 08:54.790
And we'll receive the count whenever our tag count changes for this given tag.

08:54.810 --> 08:57.210
So we'll create a definition for this.

08:58.200 --> 09:04.100
And we can do in this function what we like, but we want to bind this right here and begin play.

09:04.110 --> 09:06.900
So we're going to register gameplay tag event.

09:07.080 --> 09:10.200
This function requires the tag to respond to.

09:10.230 --> 09:12.690
Now we need to get that native tag.

09:12.690 --> 09:19.170
So scrolling up to the top, I'm checking to see if we're including our gameplay tags and we're not.

09:19.170 --> 09:21.210
So I'm going to include.

09:23.890 --> 09:25.000
Or a gameplay tags.

09:25.210 --> 09:25.750
H.

09:25.780 --> 09:31.930
I know we added more to that path when we included this elsewhere, but we should just be able to include

09:31.930 --> 09:32.950
it this way.

09:32.950 --> 09:44.320
And what we can do here is use for gameplay tags, get dot effects, hit react and we can just pass

09:44.320 --> 09:45.400
that straight in.

09:47.300 --> 09:53.090
So there's the tag and the next input parameter is an enum called event type.

09:53.270 --> 09:55.940
So it's an E gameplay tag event type.

09:55.940 --> 09:59.570
Let's type that E gameplay tag event type.

10:01.150 --> 10:02.440
Double colon.

10:02.440 --> 10:04.150
And we have some options here.

10:04.390 --> 10:09.100
We can respond with this callback when the count changes at all.

10:09.220 --> 10:16.510
We can also respond to the callback only if a new tag is added or if the tag is completely removed.

10:16.510 --> 10:22.510
So rather than just removing a single count, we only get our callback called if the tag is removed

10:22.510 --> 10:23.380
completely.

10:23.380 --> 10:29.200
So we're going to use this new or removed and this function returns this delegate.

10:29.230 --> 10:36.730
So this whole expression here is going to return the delegate that we can bind our callback to with

10:36.760 --> 10:39.670
dot add new object.

10:40.720 --> 10:43.540
So I'm going to hit enter to go to the next line here.

10:43.720 --> 10:44.680
Hit enter twice.

10:44.680 --> 10:53.080
Actually, I'll put my semicolon there and for our input parameters we need to pass in the user object

10:53.080 --> 11:01.280
that's going to be this and our callback, which is going to be the address of a ora enemy hit react

11:01.280 --> 11:02.900
tag changed.

11:03.260 --> 11:09.530
So now whenever our enemy ability system component receives the hit react tag.

11:09.560 --> 11:15.230
Hit react tag changed will be called in response and we can do something here.

11:15.320 --> 11:21.350
I'm going to go ahead and move this callback function to beneath Beginplay just because I want to.

11:21.710 --> 11:24.440
So what are we going to do in this callback?

11:24.890 --> 11:26.900
Well, we can do anything we want.

11:26.930 --> 11:30.770
We can check to see if this tag has been added for the first time.

11:30.830 --> 11:35.300
Or we can check to see if it's count is now zero, etcetera.

11:35.480 --> 11:41.060
Now, if the count is greater than zero, we know that we should be hit reacting.

11:41.060 --> 11:47.690
If the count is zero, we're not hit reacting so we can say const bool, be hit.

11:47.690 --> 11:54.110
Reacting equals new count is greater than zero.

11:54.620 --> 11:57.140
We know we're hit reacting in that case.

11:57.380 --> 12:01.790
Now knowing if we're hit, reacting is actually kind of important.

12:01.790 --> 12:04.790
We may need to know about this in blueprint.

12:04.820 --> 12:09.320
Our enemies are eventually going to get their own behavior trees.

12:09.320 --> 12:15.270
And there may be circumstances in blueprint where we need to know if we're hit reacting or not.

12:15.290 --> 12:18.110
For instance, in our animation blueprint, etcetera.

12:18.650 --> 12:23.000
So I'd like to have a member variable called Be Hit Reacting.

12:23.210 --> 12:25.730
We're going to add that to the Ora enemy.

12:25.850 --> 12:33.500
So instead of creating a const local boolean here, I'm just going to have on Ora enemy, a public variable

12:33.500 --> 12:35.370
called Be hit reacting.

12:35.390 --> 12:40.880
Now it'll be false by default, but this can be exposed to blueprint, so we're going to give it a new

12:40.880 --> 12:41.690
property.

12:41.780 --> 12:46.580
We'll make it blueprint read only and category.

12:47.570 --> 12:48.560
Combat.

12:49.040 --> 12:55.640
That way we'll just have the variable and we'll know at any point in time whether we're hit, reacting

12:55.820 --> 12:57.050
and hit react.

12:57.080 --> 12:59.870
Tag change can really do anything it wants.

12:59.870 --> 13:02.210
We can stop any movement.

13:02.240 --> 13:06.800
Now, I know our characters aren't moving yet, but we can stop movement.

13:06.830 --> 13:09.710
We can set the character movement components.

13:09.710 --> 13:12.310
Max Walk speed to zero, for instance.

13:12.320 --> 13:14.480
So just to have something to do, let's do that.

13:14.480 --> 13:16.910
Let's say get character movement.

13:17.870 --> 13:22.940
Max Walk speed equals and we can check, be hit, reacting.

13:23.150 --> 13:25.700
If we are hit, reacting, it can be zero.

13:25.970 --> 13:29.630
If we're not hit reacting, it can be whatever it's supposed to be.

13:29.630 --> 13:34.340
Let's make a member variable for the base walk speed for an enemy.

13:34.340 --> 13:38.870
So this can be a float base walk speed.

13:39.860 --> 13:45.470
We'll make it, say 250 f nice and slow.

13:45.500 --> 13:54.020
We'll make it Blueprint read only and category combat is fine and we'll set our speed to base walk speed

13:54.020 --> 13:56.840
if we're not stunned anymore.

13:56.840 --> 13:59.540
So we've removed the gameplay tag in this case.

13:59.870 --> 14:05.120
And if this variable is now going to determine the walk speed, we should set the walk speed and begin

14:05.120 --> 14:07.370
play to this value as well.

14:07.370 --> 14:13.610
So let's go to begin play and the first thing we'll do is say get character movement.

14:13.610 --> 14:16.670
Max Walk speed equals base, walk speed.

14:16.730 --> 14:20.330
So now this variable determines our walk speed.

14:20.940 --> 14:28.770
So we have a callback that gets called in response to this gameplay tag being added, which we can add

14:28.770 --> 14:30.780
easily by applying a gameplay effect.

14:30.780 --> 14:32.330
So how are we going to do that?

14:32.340 --> 14:35.880
Well, let's go ahead and compile and go back into the editor.

14:37.260 --> 14:38.700
And back in the editor.

14:38.700 --> 14:41.740
Let's go ahead and open up our asset editors.

14:41.760 --> 14:43.970
I think I'm done with CT damage.

14:43.980 --> 14:46.650
I don't really need my hit React spear.

14:46.680 --> 14:48.050
I'll leave it open, though.

14:48.060 --> 14:49.980
I'm just going to keep it there for now.

14:50.010 --> 14:53.910
We have our G hit React and all it does is apply this tag.

14:53.910 --> 14:58.500
But we have a callback responding to when this tag is added, don't we?

14:58.650 --> 15:01.200
And we can easily apply this gameplay effect.

15:01.200 --> 15:02.340
We know how to do that.

15:02.370 --> 15:05.190
The question is when and where do we do that?

15:05.490 --> 15:08.370
Well, I'd like a gameplay ability to do that.

15:08.580 --> 15:14.490
I'd like to create a gameplay ability and in that ability apply the effect.

15:14.490 --> 15:20.880
And that way if we ever activate the ability on the enemy, it will apply the effect to itself.

15:20.880 --> 15:24.090
And then we can also do something like play a montage.

15:24.120 --> 15:30.510
We know how to play a montage in wait, and if we play a montage and wait for that montage to finish,

15:30.510 --> 15:37.870
well, we could remove that infinite gameplay effect once the montage is complete and that will be your

15:37.870 --> 15:39.940
second quest for this video.

15:39.970 --> 15:44.620
You're going to create a gameplay ability, so create a new gameplay ability.

15:44.650 --> 15:49.780
You can call this GA hit React and this will be a pretty simple gameplay ability.

15:49.780 --> 15:52.780
I want you to apply the hit React effect.

15:52.780 --> 15:59.830
That's the first thing you should do and then play a hit React montage and remove the effect when that

15:59.860 --> 16:02.230
hit React montage is complete.

16:02.260 --> 16:03.940
You know how to do this?

16:03.940 --> 16:11.230
You know how to play a montage and you know how to respond to different things happening with that montage,

16:11.230 --> 16:15.700
such as the montage, completing or being interrupted and so on.

16:15.700 --> 16:22.030
So you have all the building blocks that you need to implement this gameplay ability and make sure to

16:22.030 --> 16:25.150
end the ability when you feel like it should be ended.

16:25.150 --> 16:29.590
And then we'll go ahead and activate this ability together.

16:29.590 --> 16:33.340
So pause the video and make the gameplay ability now.

16:36.440 --> 16:39.090
Okay, so we need a game play ability.

16:39.110 --> 16:45.710
I'm going to go into blueprints, ability system, gameplay abilities and we'll have a gameplay ability

16:45.710 --> 16:46.800
right here.

16:46.820 --> 16:51.020
Let's create a new blueprint class based on gameplay ability.

16:53.240 --> 16:54.260
There we go.

16:54.260 --> 16:59.360
And we'll call this G a underscore hit react.

16:59.540 --> 17:01.940
So let's take a look at G hit, react.

17:02.090 --> 17:04.760
Now, this is going to be pretty simple.

17:04.880 --> 17:08.420
First, we want to apply a gameplay effect.

17:08.690 --> 17:15.740
Now, I didn't tell you exactly how to do this, but I think you're capable of figuring that part out

17:15.740 --> 17:16.610
by now.

17:16.610 --> 17:20.150
And you've probably found that there are multiple ways to do it.

17:20.330 --> 17:26.870
You might have created a C plus plus class for this and added a gameplay effect to apply.

17:26.900 --> 17:32.600
Maybe you added a gameplay effect class to the base or a gameplay ability class.

17:32.630 --> 17:34.460
All of those things are valid.

17:34.490 --> 17:40.520
You can also simply right click and type apply gameplay effect to owner.

17:40.550 --> 17:43.040
You don't have to go through a gameplay effect spec.

17:43.070 --> 17:48.220
You can apply a gameplay effect directly and specify that gameplay effect here.

17:48.230 --> 17:55.320
So we can choose g hit react here and that is really all we need to do.

17:55.620 --> 18:02.790
Now we want to apply this effect, but we would like to remove it as soon as we're done and in order

18:02.790 --> 18:05.830
to remove an effect later, we need a reference to it.

18:05.850 --> 18:10.860
We need a handle to that gameplay effect and that's what this node returns.

18:10.860 --> 18:13.140
A gameplay effect handle structure.

18:13.140 --> 18:21.090
We can promote this to a variable and we can call this active G hit React.

18:21.330 --> 18:24.270
So now that we have a handle, we can remove it later.

18:24.570 --> 18:29.340
Now, as soon as we've done that, we want to play a montage.

18:29.370 --> 18:35.160
Now we can use the ability task, play montage and wait.

18:35.550 --> 18:40.200
Now this requires a montage to play, and for this I don't want to hard code it.

18:40.230 --> 18:46.230
It's okay if we hard code the hit react because that applies to basically anything we can apply this

18:46.230 --> 18:46.400
to.

18:46.410 --> 18:50.130
We can apply this g hit react to anything we want.

18:50.160 --> 18:52.320
It doesn't depend on the scenario.

18:52.320 --> 18:54.180
It's just something we can hard code.

18:54.180 --> 19:01.440
But for this we don't want to hard code the montage because we have a hit React spear for the spear

19:01.470 --> 19:01.920
goblin.

19:01.920 --> 19:05.310
But what about for the slingshot goblin?

19:05.490 --> 19:07.980
We have a hit React slingshot here.

19:08.570 --> 19:11.150
This is a completely different hit, react.

19:11.150 --> 19:14.330
And then we have other enemies that have their own hit react.

19:14.330 --> 19:18.830
So we really don't want to hardcode the hit React montage.

19:18.980 --> 19:24.860
This should be something that we can get easily from the thing that we're hitting.

19:25.130 --> 19:33.560
Now, the actor, the Avatar actor specifically, we can get and cast to the combat interface if we

19:33.560 --> 19:34.190
like.

19:34.280 --> 19:35.990
So we can use.

19:36.650 --> 19:39.970
Get Avatar actor from actor info.

19:39.980 --> 19:47.000
And just like we've done previously, we can cast this to a combat interface cast to combat interface

19:47.630 --> 19:49.690
and from combat interface.

19:49.700 --> 19:57.650
Well, we could retrieve a hit React montage if we like, and then our gameplay ability doesn't depend

19:57.650 --> 20:03.220
on a specific enemy or character at all for that matter, but rather the interface.

20:03.230 --> 20:09.920
So I'd like a function to return a hit React montage and that way we can call that and pass that in.

20:09.920 --> 20:12.820
So let's go ahead and add that to our combat interface.

20:12.830 --> 20:21.620
I'm going to save all and we'll go into public interaction combat interface, and we'll make a function

20:21.620 --> 20:30.230
here and it should return a U anim montage pointer and we'll call this get Hit React montage.

20:30.890 --> 20:37.170
Now, I'm going to go ahead and forward declare you and a montage here just outside the class so we

20:37.170 --> 20:38.670
don't have to include that.

20:38.670 --> 20:46.170
And we'd like to call this from Blueprint now making this function virtual and overriding it in C plus

20:46.170 --> 20:55.230
plus is relatively straightforward for raw functions, but you have to understand the limitations of

20:55.230 --> 20:57.210
U functions exposed to blueprint.

20:57.240 --> 21:02.940
We've seen that we can make a blueprint implementable event and implement that in blueprint, no problem.

21:03.090 --> 21:09.030
But if we're going to make this a blueprint callable function, then we're not going to be able to override

21:09.030 --> 21:10.860
it and C plus plus.

21:11.160 --> 21:16.770
So to get the best of both worlds, make something blueprint callable, but also have a C plus plus

21:16.770 --> 21:22.530
implementation, we're going to use a U function with Blueprint Native event.

21:23.070 --> 21:29.670
Now, Blueprint Native event means that we don't have to mark this as virtual blueprint.

21:29.700 --> 21:36.630
Native event is going to automatically generate a virtual native version that exists in C plus plus

21:36.630 --> 21:39.690
that we can override here in C plus plus.

21:39.690 --> 21:44.010
And that's the version that has underscore implementation at the end of it.

21:44.530 --> 21:48.700
So we're going to override this and I'd like to do it in a character base.

21:48.730 --> 21:52.360
We're going to override the implementation version of it.

21:52.360 --> 21:54.040
So we're going to say virtual.

21:54.040 --> 21:57.430
And this returns a U anim montage pointer.

21:57.580 --> 21:59.920
And this is get hit, React montage.

21:59.920 --> 22:02.310
But look at what we get for autocomplete.

22:02.320 --> 22:04.870
It's the implementation version.

22:04.900 --> 22:06.850
That's what we'd like to override.

22:06.850 --> 22:14.020
And I'd also like to forward declare the UN and montage type here so we don't have to include that type.

22:14.020 --> 22:20.890
And this is going to return an anim montage, which means that we should have a montage variable for

22:20.890 --> 22:23.290
hit react that we'd like to return.

22:23.440 --> 22:29.110
So here on our character base, I'm just going to put it down here in the private section, a U and

22:29.110 --> 22:32.680
a montage, and this can be a T object pointer.

22:35.810 --> 22:38.630
And we can call this hit React montage.

22:39.320 --> 22:41.030
This can be added anywhere.

22:41.030 --> 22:43.520
So I'm going to copy the property from above.

22:43.520 --> 22:46.340
And this can be in the category combat.

22:46.340 --> 22:53.540
And as long as we set this on the character that hit reacts, then we'll be able to return this from

22:53.570 --> 22:54.710
that interface function.

22:54.710 --> 23:03.890
So let's go ahead and implement the implementation version which can return simply hit react montage.

23:04.250 --> 23:07.700
So that goes for any character based on or a character base.

23:07.700 --> 23:13.430
As long as hit React montage is set, then this interface function will return a valid pointer.

23:13.970 --> 23:17.270
So this is what we can call in our gameplay ability.

23:17.510 --> 23:24.020
Now we do want to call this from Blueprint in our game hit React ability, right?

23:24.020 --> 23:30.020
So just because it's partially implementable in Blueprint doesn't mean it's callable.

23:30.110 --> 23:32.990
We want that function blueprint callable as well.

23:33.110 --> 23:38.580
So not only should this be blueprint native event, it should also be blueprint callable.

23:38.580 --> 23:45.750
So we'll give it that specifier and now we can go ahead and compile and launch this and we can set that

23:45.780 --> 23:51.930
hit react montage on our enemies and access it from within the hit React gameplay ability.

23:53.800 --> 23:57.130
Okay, so let's get that game ability back open here.

23:57.520 --> 24:07.360
We'll go to a hit React and after casting to the combat interface, we can call, get hit, React montage

24:07.480 --> 24:14.350
and this will return a montage that we can pass in for our montage to play for play montage and wait.

24:14.770 --> 24:21.310
So as it stands, the only thing we're doing here is applying a gameplay effect, storing its handle

24:21.310 --> 24:28.510
and then taking our Avatar actor, casting it to a combat interface and calling this get hit React montage.

24:28.540 --> 24:34.690
Now, if this is a valid hit React montage, then we should see that montage played and that'll only

24:34.690 --> 24:37.450
be valid if we set that montage variable.

24:37.660 --> 24:46.900
So why don't we go ahead and go into Blueprints Character and Goblin Spear open that blueprint and search

24:46.900 --> 24:50.350
for Hit React montage and we'll set that.

24:50.350 --> 24:52.090
Of course, we need a montage, don't we?

24:52.090 --> 25:00.440
So we can go into our hit React spear montage, we can browse to the asset and just simply make a hit

25:00.440 --> 25:02.270
react montage out of this.

25:02.270 --> 25:14.300
So create and we'll use create and montage and we'll call this aim hit, react, underscore Goblin.

25:15.410 --> 25:16.370
Spear.

25:18.060 --> 25:21.330
And this is a very simple montage.

25:21.360 --> 25:25.320
It just has one montage section playing the hit React.

25:25.350 --> 25:27.690
I'd like to make one for the Goblin Slingshot.

25:27.690 --> 25:31.860
So I'm going to go to hit React Slingshot and do the same thing here.

25:31.860 --> 25:39.000
I'm going to right click go to create, create and a montage and call this a m hit React underscore

25:39.000 --> 25:42.330
Goblin Slingshot.

25:43.410 --> 25:45.900
So we have montages for both of those.

25:46.910 --> 25:56.180
And we can go into Goblin Spear and set this to a m hit React Goblin Spear, and we can go into the

25:56.210 --> 26:04.310
Goblin Slingshot blueprint, search for hit, React and set this to hit React Goblin Slingshot.

26:04.310 --> 26:08.360
So now these enemies have a hit React montage.

26:08.570 --> 26:09.530
Excellent.

26:09.530 --> 26:11.960
So now we have this guy hit React.

26:11.960 --> 26:12.560
Right?

26:12.560 --> 26:16.880
And we're never actually activating this ability.

26:16.880 --> 26:19.610
That's one of the last things that we need to do.

26:19.610 --> 26:26.960
And of course we also need to remove that gameplay effect so that any C plus plus callbacks can respond

26:26.960 --> 26:28.340
to that as well.

26:28.340 --> 26:30.890
So we have a couple things left to do.

26:30.920 --> 26:35.240
The video is getting a bit long, so I think this is a good stopping point.

26:35.240 --> 26:40.700
And in the next video we'll take care of what happens when the montage is finished playing.

26:40.700 --> 26:46.890
We'll remove that gameplay effect and we'll also handle activating this ability in the first place.

26:46.890 --> 26:50.940
So a couple things left to do and we'll handle that next.

26:51.300 --> 26:52.290
I'll see you soon.
