WEBVTT

00:00.270 --> 00:02.880
Welcome back to your next quest.

00:03.060 --> 00:06.300
You're going to spawn the rock projectile.

00:06.420 --> 00:10.290
Now, from the ranged attack, go ahead and spawn the projectile.

00:10.290 --> 00:16.920
And as a bonus, add a little bit of a spin to the rock as just a flying rock.

00:16.920 --> 00:20.190
That doesn't spin, doesn't seem very convincing.

00:20.190 --> 00:27.510
So add a random spin to the rock any way that you know how, and then see if you can launch some of

00:27.510 --> 00:28.200
these rocks.

00:28.200 --> 00:31.590
So pause the video and conquer this quest now.

00:34.590 --> 00:39.100
Okay, so instead of drawing a debug sphere, I'd like to spawn a projectile.

00:39.120 --> 00:46.170
Now, because my projectile spell has this blueprint callable function spawn projectile, I can just

00:46.170 --> 00:47.130
call that.

00:47.160 --> 00:55.290
Now it needs a target location and luckily we have a combat target and we can access that with get combat

00:55.290 --> 00:56.160
target here.

00:56.160 --> 01:02.850
So I'm going to take these two nodes and just control D over here with those selected to get that combat

01:02.850 --> 01:03.510
target.

01:03.510 --> 01:05.310
And we're going to spawn the projectile.

01:05.310 --> 01:12.000
Now, actually, we didn't need our combat socket location as spawn projectile gets that for us, but

01:12.000 --> 01:18.090
we do need to know which direction to shoot that projectile, which is why we need that combat target

01:18.090 --> 01:24.150
and we're going to get its actor location and pass that in to spawn projectile.

01:24.450 --> 01:30.530
Now let's see if our enemies are launching rocks and it looks like they are.

01:30.540 --> 01:33.750
It's a little bit hard to see those rocks.

01:35.410 --> 01:38.610
Looks like they're actually hurting each other as well.

01:38.620 --> 01:41.880
So that's something that we want to take care of, don't we?

01:41.890 --> 01:46.240
But we're launching something it's a bit harder to see.

01:46.240 --> 01:54.070
So I'm going to go into my X testing map, which has a lot less stuff in here, and I'm going to set

01:54.070 --> 01:57.610
my game mode override to BP or a game mode.

01:57.640 --> 02:02.860
I'm going to remove the Aura character and drag in a player start.

02:02.860 --> 02:07.570
So going to all classes, scrolling down to player start.

02:08.860 --> 02:10.390
Dragging that in.

02:13.170 --> 02:19.470
And I'll go ahead and drag in a goblin slingshot just to see if it's going to shoot at me.

02:19.710 --> 02:24.990
So we'll go to character Goblin, Slingshot and drag one of those in like so.

02:26.180 --> 02:27.860
So saving all.

02:27.860 --> 02:29.150
I'm going to press play.

02:30.810 --> 02:33.240
And let's see if that goblin slingshot.

02:36.150 --> 02:44.520
Looks like it's coming straight at me, so I'm going to check its character class and it's set to Warrior,

02:44.520 --> 02:46.200
so we should set it to Ranger.

02:46.230 --> 02:48.320
That way it knows it's a ranged attacker.

02:48.330 --> 02:49.920
Then it's going to work.

02:50.310 --> 02:56.430
Okay, so it's launching something I seem to only see really its shadow though.

02:58.910 --> 03:03.140
But let me pause the video and zoom in to make sure.

03:03.170 --> 03:05.960
No, it is indeed a rock.

03:05.990 --> 03:09.470
It's just a little small and kind of hard to see.

03:09.560 --> 03:12.620
So there are things we can do to fix that.

03:12.620 --> 03:17.810
Of course, we can make the rock bigger if we wanted to do that.

03:17.810 --> 03:20.180
That's one thing I think I'll definitely do.

03:20.180 --> 03:24.380
So I'll take my rock mesh and I'll set its scale to.

03:24.380 --> 03:26.300
Let's try to.

03:27.710 --> 03:30.590
And we'll try a rock that's twice as big.

03:33.310 --> 03:37.360
Now that looks comically big, so we'll zero in on a good size.

03:37.360 --> 03:41.350
Let's do 1.25.

03:43.570 --> 03:46.000
That might work a little bit better.

03:47.120 --> 03:50.090
I think that's a pretty good size for a Slingshot rock.

03:50.210 --> 03:56.280
Now, in addition to that, we could just make it easier to see by going into that rocks material.

03:56.300 --> 03:58.130
So why don't we do that?

03:58.130 --> 04:04.580
I'm going to browse to Slingshot Rock, open that material, and we could give this a little bit of

04:04.580 --> 04:08.240
some emissive ness and emissive color of sorts.

04:08.240 --> 04:11.660
We could even make it emissive closer to the edges.

04:12.050 --> 04:19.790
I'm going to go ahead and find my slingshot rock static mesh, select it, and then choose to use that

04:19.790 --> 04:21.770
as my preview mesh here.

04:22.010 --> 04:25.150
And I'm going to right click and type for now.

04:25.550 --> 04:25.720
E.

04:25.730 --> 04:27.410
S n l.

04:27.650 --> 04:32.810
This is a nice effect that gives us some kind of glowing edges a bit.

04:32.810 --> 04:38.690
And if I drag that into a miss of color, then now our rock has some glowing edges.

04:38.690 --> 04:44.480
Kind of a nice, easy little trick you can do to make things a little bit easier to see.

04:45.570 --> 04:50.480
Of course, you have to be careful because if it's a white background, it makes it even harder to see.

04:50.490 --> 04:54.300
So it's really up to you, but we can try that also.

04:54.300 --> 04:56.760
I don't think I even applied that material.

04:56.760 --> 04:58.650
Let's try after applying it.

04:59.100 --> 05:04.950
So yeah, it's a little bit probably even harder to see, but we can take that for now and multiply

05:04.950 --> 05:06.180
by a color.

05:06.180 --> 05:14.100
So using a multiply node, I can press three and hook that up and that's a three dimensional color.

05:14.100 --> 05:18.630
We could give it a little bit of a more yellowish or gold color if we like.

05:20.970 --> 05:23.160
And hook that up to the emissive color.

05:23.190 --> 05:25.140
Make it a little bit golden.

05:25.140 --> 05:25.830
Sort of.

05:27.430 --> 05:29.430
And see how that looks.

05:29.440 --> 05:33.940
It's a little bit a little bit easier to see a little bit.

05:34.060 --> 05:41.380
Now, we can also overdrive the color if we wanted to do that by multiplying it by a scalar.

05:41.380 --> 05:47.260
So say 2000 would be a very extreme example of this, right?

05:47.260 --> 05:52.210
So that's going to definitely make it easier to see if we apply and try this out.

05:52.300 --> 05:56.860
But we don't really necessarily want a red hot rock, do we?

05:56.860 --> 06:00.400
But, you know, you could find some kind of balance, right?

06:00.400 --> 06:05.380
You can set this to 500, for example, maybe even 100.

06:05.530 --> 06:07.120
That might even be too much.

06:07.120 --> 06:12.580
You could try 50, maybe 20, maybe even just five.

06:14.430 --> 06:15.240
It's up to you.

06:15.240 --> 06:17.610
But these are just some little tricks you can use.

06:17.640 --> 06:20.610
Five makes it not quite enough, I think.

06:21.060 --> 06:22.750
So find that balance.

06:22.770 --> 06:24.420
Find the color you want as well.

06:24.420 --> 06:27.450
So this can be a sort of brownish color if you want.

06:30.570 --> 06:32.220
So something like that.

06:33.920 --> 06:40.580
And of course, as we get our level in place, then it's going to look even better if we're in a darker

06:40.580 --> 06:41.270
environment.

06:41.270 --> 06:45.560
So if I come over here into the shade, see if I can even.

06:46.350 --> 06:47.730
Get shot at here.

06:47.970 --> 06:48.480
Yep.

06:48.480 --> 06:49.260
There it was.

06:49.260 --> 06:52.290
You could see it a little bit better in the shade, so.

06:53.960 --> 06:55.460
Little tricks you can do.

06:55.610 --> 06:58.040
I'm going to change the exponent a bit.

07:12.370 --> 07:18.850
We'll go up to about 20 and 0.01 for that base reflect fraction.

07:18.850 --> 07:25.690
So that way we'll get more on the edges, less on the inside like so and I'll just go ahead and just

07:25.960 --> 07:33.580
play with that color a little bit, maybe make it a little red ish until I get something that looks

07:33.580 --> 07:38.050
a little easier to see, but I don't want it to be too crazy.

07:43.070 --> 07:44.420
Think I'm okay with that.

07:44.900 --> 07:45.890
Okay, cool.

07:46.250 --> 07:48.490
Now for the random spin.

07:48.500 --> 07:50.780
We could do this in a number of ways.

07:50.870 --> 07:58.870
I'm simply going to create a yaw pitch and roll and get a random float and set those and begin play.

07:58.880 --> 08:03.590
So what I'd like to do is use random float in range.

08:04.880 --> 08:13.280
And we'll go from -360 to positive 360 and promote this to a variable.

08:13.280 --> 08:17.500
And I'll call this your rotation rate.

08:17.510 --> 08:22.580
In fact, if this is a rotation rate, we don't have to stick to 360.

08:22.670 --> 08:29.480
I'm going to go from -500 to positive 500 and I'm going to promote this to another variable and call

08:29.480 --> 08:38.780
this pitch rotation rate and promote this to another variable and call it roll rotation rate.

08:40.300 --> 08:44.890
So we'll go ahead and set these all three and begin play.

08:46.940 --> 08:51.410
And I'm just going to add a local rotation to the rock here in Tick.

08:51.410 --> 08:55.670
So add local rotation, we'll use the rock mesh.

08:58.540 --> 09:06.850
And for delta rotation, we'll just multiply delta seconds by each of our rotation rates.

09:06.850 --> 09:11.770
So I'll just go ahead and get them all out here and multiply each of them.

09:11.770 --> 09:13.420
So multiply.

09:16.000 --> 09:20.680
We'll multiply the first rotation rate by that.

09:20.680 --> 09:27.870
And for Delta rotation, it's a rotator, but I'm going to split the struct pin and use this first one

09:27.880 --> 09:31.750
your that's going to go into delta rotation.

09:31.750 --> 09:37.720
Your it doesn't really matter which one is which here, but I'm going to do the same for the other two.

09:37.720 --> 09:46.480
Pitch rotation rate will be multiplied by delta seconds that will go into the pitch and roll rotation

09:46.480 --> 09:49.330
rate also multiplied by delta seconds.

09:49.360 --> 09:53.230
That will go into Delta rotation roll.

09:53.380 --> 10:01.030
And if we like, we can order these so we don't have too much crisscrossing going on.

10:01.950 --> 10:06.930
We're going to have some, but I can eliminate the criss crossing here.

10:07.520 --> 10:08.900
Like so.

10:09.880 --> 10:15.040
And with that, we have a rock that will rotate randomly.

10:15.160 --> 10:19.090
And of course, it's so small that you probably won't notice it.

10:19.090 --> 10:20.320
So it may be worth it.

10:20.320 --> 10:21.670
Just not taking it all.

10:21.670 --> 10:22.990
But there we go.

10:23.020 --> 10:25.600
We have a random rotation to the rock.

10:26.200 --> 10:26.650
Okay.

10:26.650 --> 10:32.770
Now the last thing I'd like to take care of is these rocks are hurting other enemies.

10:32.770 --> 10:38.470
We want those rocks to just ignore all the enemies and go straight to aura.

10:38.470 --> 10:42.160
But I don't want to just check for aura.

10:42.190 --> 10:49.960
I want to make sure that it's not trying to hurt something if it's friendly to that particular objects

10:49.960 --> 10:51.400
team, so to speak.

10:51.400 --> 10:57.030
In other words, we should use our aura ability system library function.

10:57.040 --> 10:58.270
Where is it?

10:58.300 --> 11:00.010
It's called is not friend.

11:00.040 --> 11:06.520
We should check that and I'm going to check that in our aura projectile as it overlaps.

11:06.520 --> 11:12.710
So we're going to go to Aura Projectile and go down to the on sphere overlap and we're going to check

11:12.710 --> 11:13.520
that right away.

11:13.550 --> 11:20.780
We're going to check if you aura ability system library is not friend.

11:21.760 --> 11:23.760
We want this to be true.

11:23.770 --> 11:27.880
Otherwise we should not do anything on sphere overlap.

11:27.910 --> 11:36.100
Now we need to pass in the effect causer that we can get from our damage effect spec handle like we

11:36.100 --> 11:37.030
did up here.

11:37.060 --> 11:42.010
We're making sure that the thing overlapped is not the effect causer here.

11:42.040 --> 11:46.930
We can also get the avatar from the effect context, can't we?

11:46.960 --> 11:48.700
So there are multiple ways.

11:48.700 --> 11:50.620
I'm just going to use the effect causer.

11:50.890 --> 11:53.650
We're going to pass that in as the first actor.

11:54.480 --> 11:57.450
The second actor is going to be the other actor.

11:57.480 --> 11:59.160
The actor being overlapped.

12:01.440 --> 12:05.610
Now we want is not friend to be false.

12:06.200 --> 12:09.750
If we want to return, we want it to be true.

12:09.770 --> 12:15.800
If we want to cause damage and do everything else now, yes, we're using this damage effect spec handle

12:15.800 --> 12:23.390
data, but we're checking that pointer before and returning early before that so we can use it safely

12:23.390 --> 12:24.050
here.

12:24.320 --> 12:28.880
So if is not friend is false, then we'll just return.

12:28.880 --> 12:33.950
And this should prevent any enemies from damaging each other with projectiles.

12:33.950 --> 12:40.280
So let's go ahead and just launch again and make sure those slingshot enemies are not hitting each other

12:40.280 --> 12:41.750
with their rocks.

12:41.780 --> 12:46.730
And in turn, we can also make sure that Ora can damage the enemies.

12:46.850 --> 12:54.950
And keep in mind, this is now going to prevent PvP because now Ora cannot damage other auras because

12:54.950 --> 12:56.660
they're both going to be players.

12:56.990 --> 13:01.470
So just something to keep in mind, but let's try this out.

13:01.490 --> 13:02.960
Yes, we can damage enemies.

13:02.960 --> 13:04.070
Can enemies damage us?

13:04.070 --> 13:05.180
They can.

13:05.330 --> 13:06.930
Are they damaging each other?

13:06.960 --> 13:08.700
No, they are not.

13:08.700 --> 13:10.710
And that is perfect.

13:10.950 --> 13:11.580
All right.

13:11.580 --> 13:16.260
And I'm also noticing that those rocks are kind of flying a little bit low.

13:16.350 --> 13:20.640
They're hitting the ground before they reach Ora in some cases.

13:20.640 --> 13:27.930
So it is possible that we may wish to have some kind of a pitch override for that initial direction

13:27.930 --> 13:31.920
for spawning the projectile here in ora projectile spell.

13:31.920 --> 13:34.580
So that's something to also keep in mind.

13:34.590 --> 13:39.780
We may wish to angle that projectile upward a bit in the case that it's using gravity.

13:39.780 --> 13:43.050
So we'll get to those fine tweaks as well.

13:43.080 --> 13:48.270
But for now, we know that our slingshot enemies are firing projectiles.

13:48.270 --> 13:49.650
This is looking great.

13:49.680 --> 13:56.910
The only thing left is to make that slingshot actually stretch and look like a real slingshot should

13:56.910 --> 13:59.580
when enemies are shooting.

13:59.820 --> 14:00.860
Excellent job.

14:00.870 --> 14:03.000
I'll see you in the next video.
