WEBVTT

00:00.350 --> 00:02.360
Welcome to your next quest.

00:02.570 --> 00:05.510
For this quest, you're going to handle the death impulse.

00:05.540 --> 00:10.730
Now, there are a number of steps to this, and I feel like you can handle it without me telling you

00:10.730 --> 00:11.810
all the steps.

00:11.810 --> 00:14.810
So this is going to be up to you.

00:14.840 --> 00:21.500
Once you get that death impulse vector, I'd like you to make that enemy as soon as it has died fly

00:21.500 --> 00:22.610
in that direction.

00:22.640 --> 00:27.200
Now, if you'd like a hint, you can call add impulse on the mesh.

00:27.200 --> 00:33.440
So by the time you know that damage is fatal, then at some point you can do that.

00:33.440 --> 00:37.640
But I'd like you to keep the code structure well maintained.

00:37.670 --> 00:42.490
Don't go in and make unnecessary dependencies where they shouldn't be.

00:42.500 --> 00:47.390
I don't want the attribute set dependent on or a base character or anything like that.

00:47.420 --> 00:53.210
We have solid principles in place, so pause the video and conquer this quest.

00:53.240 --> 00:53.930
Now.

00:57.100 --> 00:58.060
Welcome back.

00:58.060 --> 01:00.460
So I'm here in my attribute sets.

01:00.460 --> 01:04.810
And I know that if be fatal I want to use my death impulse.

01:05.020 --> 01:11.670
And I know that I can call add impulse on the mesh of the thing getting hit right.

01:11.710 --> 01:19.030
But I don't want my attribute set dependent on, say, or a base character or something like that.

01:19.030 --> 01:20.890
I'd rather be more flexible than that.

01:20.890 --> 01:24.280
So what I'm going to do is go through my combat interface.

01:24.310 --> 01:30.880
I'd like to go into my interaction folder, into combat interface, and before I go through all that,

01:30.880 --> 01:35.230
I'm going to close all tabs except for aura attribute set.

01:35.230 --> 01:43.150
And here in Combat Interface, we can figure out a way to send that death impulse to the character upon

01:43.150 --> 01:43.780
death.

01:43.780 --> 01:47.260
And I think we could just send that through in the die function.

01:47.380 --> 01:56.230
If we add a const f vector reference called death impulse to the die function, then it'll be really

01:56.230 --> 01:58.780
easy to use that death impulse vector.

01:58.780 --> 02:03.760
So as soon as we add an input parameter to die here we've just broken a bunch of things.

02:03.760 --> 02:07.120
So we need to go in and make sure that everything's compatible.

02:07.120 --> 02:10.960
So we'll start by going into base character or a character base.

02:11.350 --> 02:16.420
And we can see right here the die function has red squiggles on override.

02:16.420 --> 02:20.110
Because there is no base class that has this function.

02:20.110 --> 02:23.590
It now needs a const vector death impulse.

02:23.590 --> 02:26.770
And we need to fix it in the cpp file as well.

02:26.950 --> 02:30.850
Or a character base die needs to take that death impulse.

02:30.940 --> 02:35.680
So what are we going to do with the death impulse once it's finally passed in here?

02:35.680 --> 02:42.040
Well, I'd like to pass it down into multicast handle death, and in multicast handle death, we could

02:42.040 --> 02:44.980
take that death impulse and we can apply it to the mesh.

02:44.980 --> 02:46.900
We could even apply it to the weapon too.

02:46.930 --> 02:52.600
So I'm going to add death impulse to multicast handle death as an input parameter.

02:52.600 --> 02:54.850
And we'll put it right there in the function.

02:54.850 --> 02:59.530
And we'll pass death impulse through into multicast handle death.

02:59.530 --> 03:02.800
And then by the time we get here we can add an impulse.

03:02.800 --> 03:04.210
We can do it to the weapon.

03:04.300 --> 03:07.990
We can call add impulse passing in death impulse.

03:07.990 --> 03:09.700
And we can do it to the mesh.

03:09.700 --> 03:15.820
We can call it mesh and call add impulse passing in that death impulse.

03:15.970 --> 03:21.580
So all we need to do is make sure that die gets the death impulse passed through.

03:22.270 --> 03:26.070
Now, are we overriding die in other classes?

03:26.080 --> 03:27.730
Well, we can check.

03:28.060 --> 03:32.410
We can go to Aura enemy and it looks like we're overriding die here.

03:32.440 --> 03:36.550
So this needs to take a const f vector reference called death impulse.

03:38.630 --> 03:41.970
And we'll have to fix it in the cpp file.

03:41.990 --> 03:44.420
Di needs to take that death impulse.

03:44.420 --> 03:46.880
And really it's calling super di.

03:46.910 --> 03:51.360
So we need to pass death impulse there and or a character H.

03:51.410 --> 03:53.330
I don't believe overrides it.

03:53.360 --> 03:54.530
We see that it doesn't.

03:54.530 --> 04:00.380
So these comments are really useful because I didn't have to go search through the entire file.

04:00.380 --> 04:02.050
I could just search right here.

04:02.060 --> 04:07.220
So we've fixed or a character or an enemy and or a character base.

04:07.370 --> 04:08.540
Those are done.

04:08.540 --> 04:14.030
We can go back to the attributes set and make sure we pass a death impulse into die.

04:14.060 --> 04:20.720
Well, we know that we have an aura ability system library function called get death impulse right?

04:20.750 --> 04:23.720
All it needs is the effect context handle.

04:23.720 --> 04:30.380
But we're nice and crafty and we collected all of our relevant properties in F effect properties.

04:30.380 --> 04:34.400
So we can take props and we have the effect context handle there.

04:34.400 --> 04:39.170
So by the time we hit die we can use that effect context.

04:39.200 --> 04:43.010
We can get the death impulse using our easy to use function.

04:43.010 --> 04:46.370
Aren't these easy to use functions nice and easy to use?

04:46.400 --> 04:52.880
And now that that's happening, by the time a character dies, we should be adding that death impulse.

04:52.880 --> 04:54.920
And we don't need this to do here anymore.

04:54.950 --> 04:56.180
We're all done.

04:56.180 --> 05:03.140
So the last thing to do is to compile, launch and start launching some fireballs and seeing if we can

05:03.140 --> 05:04.760
fling some enemies around.

05:06.880 --> 05:07.510
Okay.

05:07.510 --> 05:09.880
So we're going to go ahead and press play.

05:10.060 --> 05:13.390
We're going to launch some fireballs.

05:15.270 --> 05:15.650
Okay.

05:15.650 --> 05:17.670
I didn't see any death impulse there.

05:18.550 --> 05:20.920
Didn't see any flinging around there.

05:21.630 --> 05:23.910
So let's see what the death impulse is.

05:23.910 --> 05:28.110
By the time we hit this line here where we're calling die.

05:28.140 --> 05:36.780
I'm just going to make an f vector called impulse and use get death impulse on our function library,

05:36.780 --> 05:40.190
and then place a breakpoint here so we can see what that's equal to.

05:40.200 --> 05:42.960
So I'll go ahead and close down and launch again.

05:43.230 --> 05:47.730
I'd like to see if we're actually getting that death impulse and make sure perhaps we haven't forgotten

05:47.730 --> 05:48.870
a step somewhere.

05:49.500 --> 05:51.090
So I'm just going to launch.

05:52.920 --> 05:55.230
One more should do it.

05:55.320 --> 06:00.840
I believe that the enemy has died from the fire damage, actually.

06:01.110 --> 06:06.780
And I think the fire damage isn't going to have a death impulse and its effect context.

06:06.780 --> 06:08.640
So what I'm going to do is.

06:09.160 --> 06:12.940
To make things simple, I'm going to open my.

06:13.670 --> 06:14.240
Game play.

06:15.440 --> 06:16.670
Firebolt.

06:16.670 --> 06:22.460
And I'm going to set its debuff chance to zero so we don't get that debuff.

06:25.790 --> 06:28.400
And now we can test this.

06:32.290 --> 06:36.610
Okay, now we're getting our impulse and it looks like it does have a magnitude.

06:36.610 --> 06:38.440
So I'm going to continue.

06:39.460 --> 06:41.170
And it's already dissolved.

06:41.170 --> 06:42.910
So I'm going to have to do this again.

06:46.370 --> 06:51.080
Okay, so it has a death impulse, but it might be too small.

06:51.500 --> 06:54.710
I'm going to set it to 6000 for the magnitude.

06:59.050 --> 07:03.130
Okay, so I saw the weapon go the mesh did not.

07:03.130 --> 07:05.680
The weapon flung out to the side.

07:06.560 --> 07:08.000
Or flung back.

07:09.360 --> 07:11.730
So here's what I'm going to try to do.

07:12.390 --> 07:21.480
I'm going to take my call to add impulse and hit comma and see that the pop up shows that there's a

07:21.480 --> 07:22.680
couple other parameters.

07:22.680 --> 07:24.480
One of them is B change.

07:24.480 --> 07:25.680
That's for velocity.

07:25.710 --> 07:31.510
Now if we set that to true then add impulse will no longer take the mass into account.

07:31.530 --> 07:36.120
So if I pass something in for bone name we can just pass in name none.

07:37.410 --> 07:40.500
And then for B change it says.

07:40.500 --> 07:47.520
If true, the strength is taken as a change in velocity instead of an impulse, i.e. mass will have

07:47.520 --> 07:48.440
no effect.

07:48.450 --> 07:53.240
So if we do that for the mesh, then we won't have to use such astronomical numbers.

07:53.250 --> 07:55.290
So I'm going to pass in true for that.

07:55.320 --> 08:00.420
So with that little change, we should be able to start seeing those bodies fly around.

08:01.110 --> 08:07.740
Okay, we can open our Firebolt and let's see how it looks at 6000 with that change.

08:09.290 --> 08:09.650
Okay.

08:09.650 --> 08:11.330
It did move a little bit.

08:11.360 --> 08:16.280
Not quite as much as the weapon, so we might have to scale the weapon impulse differently.

08:16.280 --> 08:17.850
But we have 6000.

08:17.870 --> 08:19.910
I'm going to change it to three times that.

08:19.910 --> 08:23.270
Let's go to 18,000 for that magnitude.

08:25.340 --> 08:27.020
So one more should do it here.

08:29.030 --> 08:29.990
There we go.

08:29.990 --> 08:31.490
That's what I wanted to see.

08:35.290 --> 08:36.130
One more.

08:37.130 --> 08:38.210
There we go.

08:38.210 --> 08:42.200
Now, the spear kind of flew a little too violently.

08:42.940 --> 08:44.770
Yeah, way too violently.

08:44.800 --> 08:48.860
So the spear doesn't quite need as much added to it.

08:48.880 --> 08:52.780
We could scale that by perhaps a quarter of the force.

08:54.670 --> 08:59.650
But I'd like to do the same thing that we're doing here, namely call add impulse.

09:02.250 --> 09:02.850
Passing in.

09:02.850 --> 09:09.210
True for velocity change, but we may need to scale that impulse by zero point.

09:09.210 --> 09:11.460
Let's try 0.1 F.

09:11.490 --> 09:13.020
We'll see if that's not enough.

09:13.020 --> 09:18.930
But in general, those weapons are going to be a lot lighter than the mesh of the character itself.

09:18.930 --> 09:21.660
So we might be able to get away with that.

09:21.660 --> 09:28.710
It may actually be a parameter that you would set on your character if it becomes a problem, right?

09:28.710 --> 09:37.110
If your weapons vary too much, you might just have a death impulse weapon scale factor of sorts.

09:37.110 --> 09:38.910
But let's see how this works.

09:43.030 --> 09:43.570
Okay.

09:43.570 --> 09:45.880
That seems okay for the slingshot.

09:46.470 --> 09:49.110
But let's see how it looks on the spear.

09:51.220 --> 09:53.140
That actually looks pretty nice.

09:56.670 --> 09:58.230
One more should do it.

10:00.740 --> 10:03.260
Yeah, that looks like a pretty good impulse.

10:08.960 --> 10:10.150
I'm liking it.

10:10.160 --> 10:11.570
I'm liking it.

10:11.900 --> 10:15.920
Okay, we have a death impulse, and it's looking good.

10:16.100 --> 10:24.650
Now, we know that if an enemy dies due to fire damage from the burn debuff, it's not going to receive

10:24.650 --> 10:25.910
any death impulse.

10:25.910 --> 10:27.250
And I'm okay with that.

10:27.260 --> 10:32.090
So, realistically, I think my debuff chance can be about 20%.

10:34.330 --> 10:36.040
That could change per level.

10:36.070 --> 10:43.170
Maybe not, but as you can see, that Firebolt missed because it already died due to fire damage.

10:43.180 --> 10:47.590
And of course five fire damage per second could be a little op.

10:48.400 --> 10:53.380
Oh, it looks like my fire debuff particle system survived.

10:54.880 --> 11:02.200
I'm going to need to make sure to handle that, but I'm going to set my debuff damage, I think, to

11:02.200 --> 11:04.390
one at least at this level.

11:04.390 --> 11:06.970
And this of course could scale by level.

11:08.710 --> 11:15.760
But I think that kind of a debuff is a little too overpowered at five damage per second.

11:17.470 --> 11:22.510
And we're getting our really cool looking damage death impulse.

11:23.710 --> 11:25.240
And it's looking great.

11:34.230 --> 11:35.100
I love it.

11:35.310 --> 11:39.540
So we do need to make sure that we kill those Niagara particles.

11:39.540 --> 11:41.930
We need to find out why they're not dying.

11:41.940 --> 11:46.680
And I just have this sneaking suspicion that they're being activated when they shouldn't be.

11:46.680 --> 11:48.720
So let's go into that component.

11:48.840 --> 11:52.710
Let's go into ability system debuff Niagara component.

11:52.710 --> 11:55.380
And right here in debuff tag changed.

11:55.380 --> 11:57.390
We're only activating here.

11:57.390 --> 12:03.150
And I'd only like to activate if the owner isn't dead.

12:03.180 --> 12:06.600
So I'm going to check that I'm going to say if get owner.

12:07.790 --> 12:12.730
And I'm going to call implements the interface you combat interface.

12:12.740 --> 12:17.810
And while I'm at it I could check is valid.

12:19.360 --> 12:20.410
Get owner.

12:22.070 --> 12:29.540
Make sure it hasn't been set to pending kill yet, and we can also check if it implements the interface

12:29.540 --> 12:33.200
if it's dead, so we can take a combat interface.

12:33.530 --> 12:40.460
Execute is dead, and of course we'd have to pass in get owner and to execute is dead.

12:40.460 --> 12:45.830
So actually we have several reasons that we wouldn't want to activate this component, right?

12:45.830 --> 12:50.330
In fact, if is valid, return false for the owner.

12:50.360 --> 12:52.820
We wouldn't want to activate.

12:52.970 --> 13:01.280
So to make this really easy to understand and avoid confusion, I'll make a const bool be owner valid

13:02.540 --> 13:04.520
and I'll call is valid.

13:05.000 --> 13:09.140
Get owner here and I'll say const bool.

13:09.170 --> 13:18.140
Be owner alive and that will be if the owner implements the interface and is not dead.

13:18.470 --> 13:23.030
So I'll copy these two and say not is dead.

13:24.020 --> 13:29.210
And then we will only activate if the owner is alive and valid.

13:29.300 --> 13:34.850
Alive and well, so be owner alive checks if we implement the interface.

13:34.880 --> 13:37.850
If we don't, this would be set to false.

13:37.850 --> 13:39.950
And if we're not dead.

13:39.980 --> 13:42.050
If is dead, returns false.

13:42.080 --> 13:43.850
Owner alive is true.

13:43.880 --> 13:52.040
So we only want to activate if new count is greater than zero and be owner valid.

13:53.170 --> 13:56.350
And be owner alive.

13:57.360 --> 14:00.580
If any of these fail, then we'll deactivate.

14:00.600 --> 14:04.860
So this should fix any unwanted activations.

14:04.890 --> 14:06.270
Let's test that out.

14:07.260 --> 14:15.320
And I think what caused the issue was if we hit the enemy with a fireball that does two things simultaneously,

14:15.330 --> 14:18.870
one adds the debuff and two kills the enemy.

14:18.870 --> 14:21.030
That's when we're running into problems.

14:21.030 --> 14:25.590
So we can test that theory by setting debuff chance to 100.

14:25.590 --> 14:31.680
So we always apply the debuff and then we can set that damage to a higher value.

14:31.680 --> 14:39.750
It's ten, but if I set this value in the text box to say 100 then we'll be causing a thousand damage.

14:39.750 --> 14:46.950
So now a single fireball is going to not only kill the enemy, but also apply the fire debuff.

14:48.370 --> 14:50.290
And we don't see that fire.

14:50.970 --> 14:53.100
Which is exactly what we wanted.

14:56.980 --> 14:58.810
So that's an easy way to check.

14:58.810 --> 15:04.900
Now, if we want to go back to our normal amount of damage, we can test what happens when we kill an

15:04.900 --> 15:06.640
enemy that's got the debuff.

15:07.430 --> 15:09.380
After we've applied the debuff.

15:12.210 --> 15:14.250
And make sure that the debuff goes away.

15:14.250 --> 15:16.710
At least the particle effect goes away.

15:17.350 --> 15:18.670
And it does.

15:22.290 --> 15:23.040
Awesome.

15:23.220 --> 15:30.960
Now another thing regarding the fire debuff before we just completely wrap up is the enemy hit reacts

15:30.960 --> 15:34.140
and while the enemy is hit reacting it cannot run.

15:34.140 --> 15:37.410
And that hit react is happening every second.

15:37.410 --> 15:43.020
Which basically means that if the enemy is on fire, it cannot chase us anymore.

15:43.050 --> 15:44.670
Now that may be what you want.

15:44.700 --> 15:45.840
It may not.

15:45.870 --> 15:48.060
If you're okay with it, then great.

15:48.060 --> 15:50.670
We can leave these mechanics as they are.

15:50.700 --> 15:56.640
But if you want the enemy to be able to run around while it's on fire, well, that's going to be something

15:56.640 --> 15:58.520
that you need to fix, right?

15:58.530 --> 16:00.060
Your hit react.

16:01.120 --> 16:02.950
Is going to need to either.

16:02.950 --> 16:04.000
Not happen.

16:05.220 --> 16:11.340
Or you should be able to run while hit reacting, which that would require some more animation blending.

16:11.340 --> 16:12.900
So I'm not going to get into that.

16:12.900 --> 16:18.930
But what you can do is you can avoid hit reacting if the damage is debuff damage.

16:19.620 --> 16:21.210
Specifically burn damage.

16:23.150 --> 16:25.730
So where do we make the hit react happen?

16:25.730 --> 16:29.900
We make it happen in our attribute set.

16:31.050 --> 16:38.790
If we search for hit react, we try activate abilities by tag with this tag container, and the hit

16:38.790 --> 16:44.840
react ability could very easily be blocked by a specific tag.

16:44.850 --> 16:47.280
The debuff burn tag.

16:47.310 --> 16:51.510
This is just a really nice built in feature of gas.

16:51.510 --> 16:54.380
These activation blocked tags.

16:54.390 --> 17:01.370
If the hit react is blocked by that tag, then we can't hit react if we're already burning.

17:01.380 --> 17:08.860
So let's go to blueprints ability system enemy abilities and hit react.

17:08.880 --> 17:18.270
If we go to our activation blocked tags right here, we can add debuff burn because we know that our

17:18.270 --> 17:19.920
enemy will have this tag.

17:19.920 --> 17:21.720
If it's debuff burning.

17:21.720 --> 17:27.690
If it's burning, if its head is on fire, then we should block the hit react activation.

17:27.690 --> 17:29.250
So let's try that.

17:29.250 --> 17:34.560
Let's go and burn a couple of these things and see if they stay hit.

17:34.560 --> 17:35.430
Reacting.

17:35.430 --> 17:37.020
Nope, they're still attacking.

17:37.020 --> 17:38.340
They're running around.

17:38.340 --> 17:39.030
Right.

17:39.030 --> 17:45.570
Because the hit react is blocked if they have that tag, if the specifically if the activating actor

17:45.570 --> 17:50.640
or component has any of these tags and what's the activating actor slash component?

17:50.670 --> 18:00.060
Well, that if we look in the attribute set for hit, react is the target as the thing getting hit is

18:00.060 --> 18:07.620
activating it, and we know that our debuff is applying that tag again because we added that tag to

18:07.620 --> 18:10.020
inheritable own tags container.

18:10.050 --> 18:15.780
This is the granted tags that we see in the blueprint for gameplay effects.

18:15.780 --> 18:25.410
If you don't believe me, go to Gameplay Effect and find that inheritable own tags, inheritable own

18:25.410 --> 18:27.750
tags container and look at its display name.

18:27.750 --> 18:29.690
Granted tags right?

18:29.790 --> 18:34.740
These tags are applied to the actor I am applied to, says the comment.

18:34.740 --> 18:36.660
So this is the granted tags.

18:36.660 --> 18:40.950
I should have come in here and showed you that back when we added to this, because that could have

18:40.950 --> 18:42.360
been a source of confusion.

18:42.360 --> 18:44.370
This is the granted tags.

18:44.940 --> 18:46.800
Okay, excellent.

18:46.800 --> 18:51.150
So now our enemies can run around while they're on fire, but they're still taking damage.

18:51.150 --> 18:53.790
They're just not hit reacting perfect.

18:53.910 --> 18:54.840
Excellent job.

18:54.840 --> 18:56.670
And I'll see you in the next video.
