WEBVTT

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

00:08.190 --> 00:15.240
Now that we've got things working pretty well and we have a test ability, it's time to start actually

00:15.240 --> 00:21.930
giving our abilities something to do as our test ability only prints debug messages to the screen.

00:21.960 --> 00:26.430
Now if I click just anywhere, I'm going to move to that location.

00:26.430 --> 00:32.100
But if I'm hovering over an enemy and I click, well, I activate my test ability.

00:32.460 --> 00:33.840
So that's great.

00:33.840 --> 00:39.900
We know that we can activate abilities and everything, but I'd like Aura to have some magical spells

00:39.900 --> 00:46.550
that she can cast, and that's going to require some real abilities that do real things.

00:46.560 --> 00:51.360
So the first spell that I'd like to make is a projectile spell.

00:51.720 --> 00:56.730
I'd like for Aura to cast a projectile like a fireball.

00:56.730 --> 01:06.060
And if we go to assets and characters or animations abilities, we have a cast firebolt function.

01:06.240 --> 01:07.630
It looks like this.

01:07.630 --> 01:10.240
So we have an animation that we can play.

01:10.240 --> 01:15.160
And if we're going to cast a firebolt, we need a firebolt effect.

01:15.160 --> 01:22.840
And if we go to assets, effects and projectiles, we have this firebolt and there are three versions.

01:22.840 --> 01:25.600
If we open them, I'm opening fire.

01:25.600 --> 01:28.450
Three you'll see that this is what they look like.

01:28.450 --> 01:29.890
They look like fireballs.

01:29.890 --> 01:31.210
Pretty exciting.

01:31.360 --> 01:37.720
So I'd like to launch one of these and that is going to be our first major ability.

01:37.720 --> 01:45.190
And this happens to be an ability that will require quite a few different aspects and mechanics to it.

01:45.490 --> 01:52.270
So this will be a great learning experience for how abilities work now, because we're going to want

01:52.270 --> 01:54.250
to spawn projectiles.

01:54.250 --> 02:01.810
We need a class for a projectile to spawn and we're going to create a projectile class in this video.

02:01.810 --> 02:04.000
So let's go ahead and do it.

02:04.030 --> 02:10.540
We're going to go into our C plus plus classes or a public actor folder.

02:10.540 --> 02:13.390
I think we can put this right here in the actor folder.

02:13.390 --> 02:14.860
It's going to be an actor.

02:14.980 --> 02:19.030
So let's make a new C plus plus class based on actor.

02:19.120 --> 02:25.270
Click next and we're going to call this aura projectile.

02:25.270 --> 02:27.550
Let's go ahead and create this class.

02:29.510 --> 02:31.000
And I'll close the editor.

02:31.010 --> 02:35.500
And in this aura projectile class, we're going to put some basic things that we need.

02:35.510 --> 02:42.620
So I'm going to go ahead and close all the tabs and open aura projectile dot h and we can start to sort

02:42.620 --> 02:45.500
of rearrange this basic actor.

02:45.500 --> 02:51.710
So first of all, I don't plan on using the tick function, so we're going to remove it altogether.

02:51.920 --> 02:58.910
I'm also going to remove these comments as I don't feel like we need them and I'm going to go into the

02:58.910 --> 03:07.430
CPP file and remove tick from here, remove the comments as well and set primary actor tick be ever

03:07.430 --> 03:11.660
tick equal to false in the constructor so we don't tick.

03:11.900 --> 03:17.420
And without those comments we're stripped out and it looks clean.

03:17.750 --> 03:21.260
So what do we want in Aura Projectile?

03:21.530 --> 03:24.980
Well, we want to be able to hit something.

03:24.980 --> 03:32.940
I'd like to use overlap events for this and what we saw with our Effect actor is we could add that overlap

03:32.940 --> 03:40.740
volume in blueprint and we wouldn't really need access to it in C plus plus as long as we created a

03:40.740 --> 03:46.920
blueprint callable function that we could call from the blueprint and pass in any important information

03:46.920 --> 03:49.800
such as the actor that was overlapped.

03:49.830 --> 03:58.800
We can take that approach here if we'd like and then leave it up to the blueprint side to add that projectiles

03:58.800 --> 04:00.480
overlap volume.

04:00.480 --> 04:06.240
If we want to do that, another option is to just add it here in C plus plus, if we know it's always

04:06.240 --> 04:13.050
going to be, say, a sphere, if we don't think we'll ever need a projectile that has a box or capsule

04:13.050 --> 04:19.350
collision volume, we could just add a sphere right here so we could do it that way.

04:19.470 --> 04:22.170
I'm going to do it that way for the projectile.

04:22.170 --> 04:27.120
I think all of our projectiles are going to want a sphere overlap volume.

04:27.240 --> 04:40.380
So I'm going to make a private section and I'm going to add a T object pointer to type U sphere component.

04:40.800 --> 04:50.340
I'm going to add a forward declaration for it and we'll call this sphere and it gets a U property.

04:53.690 --> 04:55.430
With visible anywhere.

04:56.610 --> 04:59.970
Now we'll create an en overlap function for it.

04:59.980 --> 05:10.260
So let's make a void function en sphere overlap which we'll need a u primitive component pointer called

05:10.260 --> 05:11.370
overlapped.

05:13.100 --> 05:14.060
Component.

05:15.690 --> 05:22.290
An actor called other actor a you primitive component pointer.

05:25.230 --> 05:39.390
Called other comp and in 32 other body index, a bull called B from sweep and a const F hit result.

05:40.970 --> 05:43.790
Reference called sweep result.

05:45.270 --> 05:47.970
And this must be a new function.

05:49.080 --> 05:57.150
So let's create that function definition and we're going to construct our sphere component and then

05:57.150 --> 06:00.000
bind our on sphere overlap to it.

06:00.000 --> 06:07.950
So first we'll construct it here in the constructor sphere equals create default Subobject use sphere

06:07.980 --> 06:09.090
component.

06:09.990 --> 06:11.910
We'll call this sphere.

06:13.070 --> 06:15.410
We'll let the root component be the sphere.

06:15.410 --> 06:19.760
So let's set root component to the sphere.

06:20.360 --> 06:28.130
And now that we have a sphere, we'll go into begin play and say sphere on component.

06:30.160 --> 06:31.360
Begin overlap.

06:31.660 --> 06:33.280
Add dynamic.

06:35.110 --> 06:40.630
With this and or a projectile on sphere overlap.

06:42.340 --> 06:43.150
Great.

06:43.420 --> 06:47.830
Now my sphere should be set to query only.

06:47.830 --> 06:58.270
So I'm going to say sphere set collision enabled to collision enabled query only.

06:59.910 --> 07:06.330
And I'm going to set it to ignore all channels except for the select few that I want it to overlap with.

07:06.360 --> 07:08.250
So we're going to say sphere.

07:10.150 --> 07:13.270
Set collision response to.

07:13.270 --> 07:21.670
And I want it to be to all channels and I'd like to use ECR, ignore collision, response, ignore.

07:22.000 --> 07:27.040
And then I'd like to set collision response to specific channels.

07:27.040 --> 07:30.480
So set collision response to channel.

07:30.490 --> 07:34.000
I'm going to choose EC World dynamic.

07:34.000 --> 07:36.040
We'll go ahead and overlap that.

07:36.040 --> 07:37.960
So ECR overlap.

07:39.240 --> 07:46.740
And I'm going to copy this line and paste it and change this to make world static.

07:46.830 --> 07:51.630
We'll overlap those and I'd like to overlap with the pawn type as well.

07:51.630 --> 07:55.380
So EQ pawn will overlap those as well.

07:56.280 --> 07:58.170
Okay, so now we have a sphere.

07:58.170 --> 08:03.510
It's got an overlap callback and this is a projectile, right?

08:03.510 --> 08:06.270
So it needs a way to fly through the air.

08:06.390 --> 08:12.110
The perfect way to handle that, especially in multiplayer, is with the projectile movement component.

08:12.120 --> 08:14.010
So we're going to add one of those as well.

08:14.400 --> 08:16.650
I'm going to go ahead and forward declare that right away.

08:16.650 --> 08:25.560
And the type is you projectile movement component and I can foresee myself needing to access this from

08:25.560 --> 08:31.530
outside the class because in the future we're going to want to set parameters on it.

08:31.530 --> 08:40.450
Potentially, we may wish to make it a homing projectile and set its homing projectile target, things

08:40.450 --> 08:40.870
like that.

08:40.870 --> 08:43.280
So I'm going to make this a public component.

08:43.300 --> 08:51.640
It's going to be a T object pointer of type U projectile movement component called projectile movement,

08:52.030 --> 08:55.540
and it's going to get a U property with visible anywhere.

08:55.990 --> 08:59.850
And just like our sphere, we'll construct it right here.

08:59.860 --> 09:02.350
We'll say projectile movement.

09:04.390 --> 09:11.470
We'll use Createdefaultsubobject writer is quick to give me lots of autocomplete stuff, but I want

09:11.500 --> 09:14.350
create default subobject with you.

09:14.350 --> 09:15.580
Projectile.

09:16.820 --> 09:18.200
Movement component.

09:18.230 --> 09:21.320
I'm going to call this simply projectile movement.

09:22.100 --> 09:25.380
It tried to include navigation system types there.

09:25.400 --> 09:26.570
No, thanks.

09:26.570 --> 09:30.470
And we're going to set a initial speed.

09:30.470 --> 09:34.310
So projectile movement, initial speed.

09:34.340 --> 09:36.980
We'll go ahead and give that a default value.

09:37.010 --> 09:38.840
Let's give it 550.

09:40.040 --> 09:42.260
We'll take projectile movement.

09:43.990 --> 09:47.050
Max speed will set that to the same value.

09:47.230 --> 09:50.260
550 and gravity scale.

09:50.260 --> 09:56.790
I'd like this to have no gravity, so I'm going to say projectile movement, projectile gravity scale.

09:56.800 --> 09:59.950
I'm going to set that to zero so we have no gravity.

10:00.370 --> 10:01.120
Okay.

10:01.240 --> 10:11.130
So we have basically a skeleton for a projectile class and we have something that will happen on overlap,

10:11.140 --> 10:13.840
basically an empty function that does nothing.

10:13.840 --> 10:21.160
But we'll definitely be fleshing this out with things that should happen, but we can go ahead and create

10:21.160 --> 10:22.050
one of these.

10:22.060 --> 10:25.060
Let's go ahead and compile and launch.

10:27.010 --> 10:31.990
And now that we're in the editor, we can create an aura projectile.

10:32.470 --> 10:36.340
Now we have our aura projectile class.

10:36.340 --> 10:39.580
But I'm going to make a blueprint based on this that's specific.

10:39.580 --> 10:41.680
I'm going to make a fireball class.

10:42.070 --> 10:47.560
Now, I could put it here in my actor folder, but this is going to be related to one of my gameplay

10:47.560 --> 10:48.520
abilities.

10:48.610 --> 10:53.560
So what I'm going to do is go into gameplay abilities here in blueprints, ability system, gameplay

10:53.560 --> 10:54.500
abilities.

10:54.520 --> 11:01.660
I'm going to make a new folder and I'm going to call this fire and I'm going to have all my fire abilities

11:01.660 --> 11:02.800
in this folder.

11:02.800 --> 11:10.450
And here in Fire I'm going to make a folder called Firebolt and Firebolt is going to contain my Firebolt

11:10.450 --> 11:11.950
ability once I make it.

11:11.950 --> 11:17.950
And any associated classes such as the Firebolt class, that's an aura projectile.

11:17.980 --> 11:21.720
I'm going to make that blueprint for the aura projectile now.

11:21.730 --> 11:24.220
So I'm going to base this on Aura Projectile.

11:25.500 --> 11:28.980
And call this BP underscore firebolt.

11:29.640 --> 11:33.230
I'm going to open it up and here's my firebolt.

11:33.240 --> 11:37.370
And the first thing we're going to add is a Niagara system.

11:37.380 --> 11:44.430
So I'm going to click on my sphere, click Add, Type Niagara and get a Niagara particle system component.

11:44.430 --> 11:49.320
Call this fire effect and set its Niagara system asset.

11:49.320 --> 11:54.900
I'm going to search for fire and choose Fire three.

11:54.900 --> 11:57.780
And there's my beautiful fireball.

11:57.990 --> 12:00.840
We're going to call this a firebolt, actually.

12:00.960 --> 12:02.490
And this looks great.

12:02.520 --> 12:04.320
Let's see what it looks like here in the world.

12:04.320 --> 12:07.800
I'm going to just drag one in, raise it up a bit.

12:07.800 --> 12:09.900
So here's what it looks like in the world.

12:09.900 --> 12:15.480
But of course, it has a velocity, so it's going to fly away, right?

12:15.510 --> 12:18.450
Let's put it right in front of our character.

12:19.800 --> 12:20.640
Oh, there it went.

12:20.640 --> 12:21.480
I don't know if you saw it.

12:21.480 --> 12:22.710
It was a bit quick.

12:22.830 --> 12:24.630
I'll put it over here to the left a bit.

12:24.630 --> 12:26.190
Let's put it behind the character.

12:26.670 --> 12:29.130
And there it goes.

12:29.130 --> 12:30.840
There goes that fireball.

12:30.870 --> 12:31.710
Beautiful.

12:31.830 --> 12:38.850
All right, so we have a projectile, and whatever direction it's facing is going to determine where

12:38.850 --> 12:39.420
it flies.

12:39.420 --> 12:45.300
If I move it that way a little bit and press play, it's going to fly off that way if I turn it this

12:45.300 --> 12:45.930
way.

12:47.160 --> 12:48.480
It's going to fly that way.

12:48.480 --> 12:49.410
You get the point.

12:49.950 --> 12:52.170
So we have something that can fly.

12:52.200 --> 12:53.610
Beautiful.

12:54.500 --> 13:01.880
So now that we have a projectile, we can create an ability that spawns these projectiles, a kind of

13:01.880 --> 13:07.850
fireball ability, a nice, offensive, magical attack that aura can use.

13:08.270 --> 13:15.260
So I'd like to do that in the videos to come and figure out how we can spawn projectiles when we activate

13:15.260 --> 13:16.310
this ability.

13:16.550 --> 13:19.730
So we'll do that in the videos to come.

13:19.730 --> 13:25.790
And before I wrap up just because I can, I'm getting a little tired of my checkered floor, so I'm

13:25.790 --> 13:34.820
just going to go ahead and go into my assets dungeon folder and find a couple of tiles and I'm going

13:34.820 --> 13:39.830
to get some tile one by one A and some tile one by one.

13:39.860 --> 13:44.300
B Let's see if there's a two by two and three by three.

13:44.300 --> 13:45.680
I think I have three by three.

13:45.710 --> 13:47.180
A That's a bigger one.

13:47.420 --> 13:49.220
Three by three B.

13:52.930 --> 13:54.820
And I think I'd like to just.

13:55.950 --> 13:58.030
Kind of cover this floor.

13:58.050 --> 14:03.120
In fact, I'd like to kind of get rid of this floor here and use these.

14:05.710 --> 14:10.240
If I open and show simple collision, I see that they have collision volumes.

14:11.690 --> 14:16.370
So I'm going to take some time to put some of these floor tiles out.

14:17.680 --> 14:22.360
And when we start the next video, you'll see that I have a much nicer floor.

14:22.690 --> 14:23.480
Excellent.

14:23.500 --> 14:25.120
I'll see you in the next video.
