WEBVTT

00:07.560 --> 00:08.720
Welcome back.

00:08.730 --> 00:14.070
Since our section is called Combat Tricks and we're adding more features for combat.

00:14.100 --> 00:18.690
One of the features that I'd like to see implemented in this game is a death impulse.

00:18.720 --> 00:21.300
Now, what do I mean by death impulse?

00:21.330 --> 00:27.870
Well, as soon as I launch a fireball at something, if that fireball was fatal, I'd like to add an

00:27.870 --> 00:29.910
impulse on the character.

00:29.940 --> 00:36.270
Now we're implementing a ragdoll system where when the character dies, it ragdolls.

00:36.270 --> 00:36.930
Right?

00:37.230 --> 00:39.630
We can see that by killing the creature.

00:40.700 --> 00:44.150
And as soon as we've done so, the creature falls down.

00:44.150 --> 00:50.360
But what I'd like to see is the creature to fly back, perhaps bounce off the walls and get some kind

00:50.360 --> 00:51.940
of force applied.

00:51.950 --> 00:56.640
So the death impulse gives death a little bit more oomph to it.

00:56.660 --> 01:00.100
It makes the death a little bit more impactful.

01:00.110 --> 01:01.700
It feels better.

01:01.700 --> 01:07.400
And especially if we're starting to do explosions and cool things with our other abilities we're going

01:07.400 --> 01:08.390
to implement.

01:08.570 --> 01:10.920
A death impulse can go a long way.

01:10.940 --> 01:13.610
So for that reason, we're going to implement it.

01:13.610 --> 01:16.070
And there are quite a few steps to it.

01:16.220 --> 01:23.510
Now, a death impulse is something I believe should be only related to a damage gameplay ability.

01:23.750 --> 01:30.260
So, for example, our Firebolt is a damage gameplay ability, and I'd like to be able to just set a

01:30.260 --> 01:33.050
magnitude here for a death impulse.

01:33.050 --> 01:39.650
I'd like to have a death impulse magnitude, and if I set it here, then I want everything to automatically

01:39.650 --> 01:45.140
work for me so that if I kill something with a Firebolt, I want to see it fly back.

01:45.320 --> 01:47.570
So that's what I'm interested in.

01:47.570 --> 01:53.810
And we're going to get started by adding that parameter in the aura damage gameplay ability.

01:53.810 --> 01:56.330
So let's go ahead and do that.

01:56.450 --> 02:01.130
So I'm going to go into abilities and open aura damage gameplay ability.

02:01.130 --> 02:03.080
And we're going to add a new parameter.

02:03.080 --> 02:04.460
It's going to be a float.

02:04.490 --> 02:07.370
We can leave it at edit defaults only.

02:07.460 --> 02:09.350
I'm going to go ahead and paste it here.

02:09.350 --> 02:14.180
And I'm going to call this death impulse magnitude.

02:14.690 --> 02:17.810
And we'll give it a default value something like 60.

02:17.810 --> 02:21.830
But we'll see what 60 looks like when we implement all this.

02:22.070 --> 02:29.360
Now all we need to do when using this is set the death impulse magnitude and everything else is going

02:29.360 --> 02:30.530
to work, right.

02:30.710 --> 02:36.170
Well, for that reason we need to handle all the stuff that happens under the hood.

02:36.170 --> 02:39.380
And we'll start with our damage effect params.

02:39.380 --> 02:45.440
I think our damage effect params can carry the death impulse magnitude along with it.

02:46.230 --> 02:50.880
So if I go to where we've defined that, it's an aura ability types.

02:50.880 --> 02:54.840
So we can add the death impulse magnitude here.

02:59.320 --> 03:08.110
So we'll make a death impulse magnitude float on our damage effect params.

03:08.110 --> 03:14.980
And what we'll do is set this in our damage gameplay abilities make damage effect params from class

03:14.980 --> 03:17.890
defaults, so we can go to that function.

03:17.890 --> 03:26.320
And all we need to do here is take params dot death, impulse magnitude and set that to the abilities

03:26.320 --> 03:29.380
death impulse magnitude and that's it.

03:29.530 --> 03:35.590
Now once we have this, we need a way to push this along through the pipeline of damage.

03:35.590 --> 03:41.770
And so far we just have one offensive ability that's using damage effect params.

03:41.770 --> 03:44.380
That's our projectile spell.

03:44.380 --> 03:50.620
So if we go to aura projectile spell in the private folder I'm going to go to the cpp file.

03:51.880 --> 03:56.450
Here we're setting the projectile damage effect params here.

03:56.470 --> 04:05.980
Now at this point it's really not meaningful to set a death impulse, as an impulse is a vector, and

04:05.980 --> 04:08.590
a vector is going to depend on a direction.

04:08.590 --> 04:14.350
And while yes, we know the direction our projectile is traveling in and our projectile does travel

04:14.350 --> 04:15.190
linearly.

04:15.220 --> 04:18.430
Pretty soon we're going to make this projectile have gravity.

04:18.520 --> 04:21.250
That means it's going to have a parabolic trajectory.

04:21.250 --> 04:27.100
And because the trajectory changes, it wouldn't be appropriate to set any vector direction at this

04:27.100 --> 04:27.760
point.

04:27.790 --> 04:32.430
It would be more appropriate to set a vector direction when the projectile hits.

04:32.440 --> 04:40.240
So if we go into our actor folder and open aura projectile dot cpp, then at this point an on sphere

04:40.270 --> 04:47.770
overlap, it would be appropriate before applying the damage effect to set some kind of vector based

04:47.770 --> 04:52.600
on the projectiles direction for the death impulse that we can send along.

04:52.600 --> 04:58.930
And how can we send an arbitrary vector along through the pipeline so we can receive it, say later

04:58.930 --> 05:03.130
on, like in the attribute set where we determine if death has occurred?

05:03.160 --> 05:09.640
Well, we know that we have a custom effect context right here in aura ability types.

05:09.670 --> 05:15.520
It's an aura gameplay effect context, and we know how to add new things to it.

05:15.550 --> 05:21.220
We've seen that there's a number of steps involved, and we're going to add a death impulse to this,

05:21.220 --> 05:23.800
and we'll do that in the next video.

05:23.830 --> 05:24.970
I'll see you soon.
