WEBVTT

00:07.580 --> 00:08.630
Welcome back.

00:08.630 --> 00:15.380
Now in the last video, we just did a whole bunch of work for our electrocutes stun ability.

00:15.500 --> 00:22.700
And we noticed at the very end that if we right click and hold and release, things look fine on the

00:22.700 --> 00:23.420
client.

00:23.420 --> 00:26.660
But if we right click and release right away, there's an issue.

00:27.430 --> 00:30.670
We see that we don't actually stop.

00:30.670 --> 00:31.410
Shocking.

00:31.420 --> 00:33.010
Now nothing else is happening.

00:33.010 --> 00:37.960
Our mana isn't draining, we just never actually remove that gameplay.

00:37.960 --> 00:39.580
Cue is what it appears.

00:39.580 --> 00:46.420
So if we go into electrocute into the event graph, let's see what happens if we release.

00:46.420 --> 00:49.060
And it's only when we're releasing right away.

00:49.060 --> 00:52.750
So it's when our time held is less than minimum spell time.

00:52.750 --> 00:54.730
And we have this delay.

00:55.000 --> 00:59.890
Now the delay happens before clear timer and end ability happens.

00:59.890 --> 01:01.300
And we're ending the ability.

01:01.300 --> 01:09.490
It appears a little too early, and we can easily fix this by making sure that we end the ability only

01:09.490 --> 01:10.990
on the server in this case.

01:10.990 --> 01:14.020
So in the true case we can check for authority.

01:14.020 --> 01:21.670
We can say has authority, and only if we have authority we'll do a delay and clear timer and end ability.

01:21.670 --> 01:28.270
And this will fix the issue in a sense that we can right click and release fast.

01:29.430 --> 01:30.480
So that works.

01:30.480 --> 01:32.460
But now we can't see our mouse cursor.

01:32.460 --> 01:39.080
So there are a few things we have to handle and those things are in prepare to end ability.

01:39.090 --> 01:45.720
These are those superficial things where we're showing the mouse cursor no longer setting our shock

01:45.720 --> 01:53.610
loop variable, setting our in shock loop to false, setting the movement mode back, removing gameplay

01:53.610 --> 01:56.850
cues, things like that, those we're doing here.

01:56.850 --> 01:58.920
So we're going to do that in the false case.

01:59.780 --> 02:06.350
And I don't really like the crisscrossing wires, so we can just really quickly fix that.

02:13.320 --> 02:16.110
And that way it's clear what's going on.

02:18.900 --> 02:20.190
And with that.

02:21.140 --> 02:22.760
We can test things out.

02:26.630 --> 02:28.340
We'll test a short press.

02:28.970 --> 02:30.950
And things appear to work.

02:34.600 --> 02:38.110
And we're still able to shock the enemy with a short press.

02:39.890 --> 02:41.720
Okay, so that's looking good.

02:42.350 --> 02:45.410
And while we're at it.

02:46.290 --> 02:47.970
While we're checking authority.

02:47.970 --> 02:52.830
There's another thing we shouldn't do unless we have authority and that's apply damage.

02:52.860 --> 02:55.170
And we're doing that in a couple places.

02:55.170 --> 03:01.020
One is in clear time or an end ability where we're adding damage, and it looks like if we check in,

03:01.020 --> 03:03.690
prepare to end ability, we're doing that here.

03:03.690 --> 03:10.020
And we should only do that if we're on the server, so we can have an authority check before we apply

03:10.020 --> 03:11.250
the damage effect.

03:11.550 --> 03:13.440
So we'll check has authority.

03:14.930 --> 03:17.870
And if we do have authority, we'll apply the damage effect.

03:17.870 --> 03:21.050
If we don't, we'll bypass the damage effect.

03:22.740 --> 03:32.940
So we'll take the false and we'll reroute it around and we'll continue and we'll do the same thing before

03:32.940 --> 03:34.440
applying damage here.

03:35.660 --> 03:41.120
We'll check has authority first, and only if we have authority should we apply the damage effect.

03:45.190 --> 03:48.940
And we should still cause damage because damage is done on the server.

03:48.940 --> 03:50.410
It's a predictive action.

03:52.140 --> 03:53.520
And it appears to work.

03:56.720 --> 03:57.500
Excellent.

03:58.560 --> 04:07.350
Okay, so that polishes electrocute a little bit, but when stunned, I'd like to have a Stun Niagara

04:07.350 --> 04:10.860
system, just like we have the Fire Niagara system when burned.

04:10.890 --> 04:12.480
If we burn an enemy.

04:13.550 --> 04:17.590
And it appears that we got a exception here.

04:17.600 --> 04:20.480
And on sphere overlap for the projectile.

04:21.400 --> 04:27.430
Where the source ability system component here is null, and it looks like that's going to be the case

04:27.430 --> 04:28.960
on clients, isn't it?

04:29.680 --> 04:31.720
So let's do a null check here.

04:31.720 --> 04:38.230
We'll say if and we're going to check if that source ability system component is null.

04:40.410 --> 04:42.270
And we'll just return if that's the case.

04:42.270 --> 04:44.580
So if equals null pointer return.

04:44.880 --> 04:47.300
Now this brings up an important point though.

04:47.310 --> 04:49.890
This projectile should be replicated.

04:49.890 --> 04:52.020
Its movement should also be replicated.

04:52.020 --> 04:56.370
So we should go up to where we're setting be replicates to true.

04:56.370 --> 04:58.710
And we should also set replicate movement.

05:00.760 --> 05:04.390
Now, if we try to set it here, we see that it's inaccessible.

05:04.390 --> 05:09.040
And if we try to call, set, replicate movement and set that to true.

05:09.070 --> 05:15.400
Well, we'll also see that this is not something that's resolved at compile time.

05:15.400 --> 05:17.110
And this is a virtual function.

05:18.070 --> 05:20.200
So we can set that and begin play.

05:20.860 --> 05:26.230
But we could also just check it in the blueprint because it is exposed to the details panel.

05:26.290 --> 05:27.730
So with that.

05:29.100 --> 05:34.200
We can go ahead and just open up Firebolt and check for replicate.

05:34.970 --> 05:36.950
And we can check replicate movement.

05:36.980 --> 05:38.810
Now if we do that.

05:40.490 --> 05:44.410
Then on the client, we should be able to launch Firebolts.

05:44.420 --> 05:46.280
We should still get.

05:47.100 --> 05:48.480
Then replicate it.

05:48.480 --> 05:51.000
As far as their movement goes, we're still causing damage.

05:51.000 --> 05:52.240
We're still burning.

05:52.730 --> 05:54.540
Everything's looking good.

05:55.260 --> 06:02.760
Okay, so now the thing we want to add is particle system effects for whenever.

06:02.760 --> 06:03.450
Stunned.

06:03.570 --> 06:07.950
So we can do this just like we did our burn component.

06:07.950 --> 06:10.050
In fact, this is going to be quite easy.

06:10.440 --> 06:14.490
I'm going to close all tabs except for aura character base.

06:15.630 --> 06:21.990
And here in or a character base, I'm going to take a look at where we added a component.

06:23.550 --> 06:26.220
For burn, we have a burn debuff component.

06:26.220 --> 06:28.830
It's a you debuff Niagara component.

06:28.950 --> 06:35.700
I'm going to add one for stun now and call this Stun Debuff component.

06:35.700 --> 06:40.500
And if I go into the constructor I can construct one of these.

06:40.500 --> 06:47.940
I'm just going to copy the three lines for Burn Debuff component and paste them and change this to Stun

06:47.970 --> 06:52.080
Debuff Component and change its name.

06:52.470 --> 06:53.760
Change that.

06:53.760 --> 06:59.280
We're setting attachment for it to the root component, and we're going to change its debuff tag as

06:59.280 --> 07:02.490
well to debuff underscore stun.

07:03.450 --> 07:11.040
And with that everything should work because in the debuff component, if we go to Debuff Debuff Niagara

07:11.040 --> 07:18.720
component, we see that we're registering a gameplay tag event for its debuff tag that we have set for

07:18.720 --> 07:19.200
it.

07:19.530 --> 07:26.130
Now, we notice earlier that we weren't actually removing this at the appropriate time and or a character

07:26.130 --> 07:26.580
base.

07:26.610 --> 07:35.340
If we search for multicast handle death down here at the bottom, we're taking a burn debuff component

07:35.340 --> 07:37.110
and calling deactivate on it.

07:38.120 --> 07:46.850
And that was because our debuff Niagara component did not seem to be able to deactivate itself.

07:46.880 --> 07:52.820
Now, part of that is because of one important detail when it comes to.

07:53.500 --> 07:55.620
Get on a registered delegate.

07:55.630 --> 07:57.650
This is on the combat interface.

07:57.670 --> 08:06.010
If we go to the combat interface and Interaction combat interface, the age file, then we'll see that

08:06.010 --> 08:10.900
we have two delegates on ASC registered and on death signature.

08:10.900 --> 08:13.270
And we have getters for those.

08:13.270 --> 08:18.320
And on death signature returns a reference to the actual delegate.

08:18.340 --> 08:25.270
But on ASC registered the getter for that down here does not return a reference to it.

08:25.270 --> 08:28.150
So we can change that to return a reference.

08:29.410 --> 08:32.950
And if we change it here, we must change it in or a character base.

08:34.880 --> 08:36.440
So we can change it here.

08:37.130 --> 08:42.410
And we also need to change it in the cpp file right here.

08:44.100 --> 08:47.490
And that way it will be sure to get that actual delegate.

08:47.670 --> 08:53.730
Now in addition, we can go to multicast Handle death, and still deactivate the stun debuff component

08:53.730 --> 08:55.410
just to be sure.

09:00.080 --> 09:06.260
And with that, we now have a stun debuff component and we can set the Niagara system for it in the

09:06.260 --> 09:06.950
editor.

09:08.460 --> 09:15.990
So back here in the editor, I'm going to go into my character folder into enemy base.

09:15.990 --> 09:23.010
And here I can select my stun debuff component and set its Niagara system.

09:23.160 --> 09:26.550
Now if I search for stun I have NS stars.

09:26.550 --> 09:30.480
And if I go to that it's in the effects stun folder.

09:30.480 --> 09:32.220
And here's what it looks like.

09:33.460 --> 09:39.340
We're going to put these above our characters heads, and I think that's going to look pretty good for

09:39.340 --> 09:39.970
stun.

09:40.270 --> 09:44.500
And I'll stick it right about this high by default.

09:44.500 --> 09:52.600
And for the stun debuff component, we can check auto activate if we want to see it and uncheck it.

09:52.600 --> 09:53.590
If we don't.

09:53.800 --> 09:59.110
And we can just make sure that all of our enemies have it at the correct height.

09:59.110 --> 10:04.120
So I'm going to go to character and I'll start with the demon.

10:05.140 --> 10:07.480
We'll go to BP Demon Ranger.

10:09.120 --> 10:12.870
And take my stun debuff component and check auto activate.

10:12.870 --> 10:18.240
It's a little low, and what I'd like to do is go to the enemy base and move it up a little.

10:18.270 --> 10:19.470
Hit compile.

10:20.390 --> 10:22.010
And check it out here.

10:22.040 --> 10:25.070
It's a little low still, so I'm going to move it up a little more.

10:26.350 --> 10:28.210
And that's going to work.

10:28.210 --> 10:34.040
And since I moved it on enemy base, then it works on the other demon as well.

10:34.070 --> 10:36.610
Looks like this one has auto activate for burn.

10:36.610 --> 10:42.250
So I'm going to uncheck that and take my stun and check auto Activate and see what it looks like there.

10:43.370 --> 10:44.030
Now.

10:44.030 --> 10:49.100
We need to keep in mind, too, that this isn't what the enemies look like when they're in the stunned

10:49.130 --> 10:49.640
pose.

10:49.640 --> 10:53.120
In fact, for demons, we're going to want it a little lower.

10:56.250 --> 11:01.200
So I'm going to uncheck auto activate for both of them and close those.

11:01.230 --> 11:03.920
We'll go back and tweak them more if we need to.

11:03.930 --> 11:05.700
But let's go to the Google.

11:08.350 --> 11:12.580
And for the ghoul, I'm going to take the stun debuff check auto activate.

11:12.580 --> 11:15.760
And for this I'm going to need to move it forward a bit.

11:15.880 --> 11:17.710
And we'll put it up about there.

11:20.490 --> 11:23.790
Next we can go to the goblins.

11:25.160 --> 11:27.110
Go to Goblin slingshot.

11:27.890 --> 11:31.400
By the way, I'm going to uncheck auto activate on the Google.

11:31.400 --> 11:38.210
And for Goblin Slingshot I'll take the stun check auto activate, and I think the goblins have it at

11:38.210 --> 11:38.810
a good height.

11:38.810 --> 11:40.250
So I'm going to uncheck that.

11:42.550 --> 11:45.700
And I think we're fine on the goblins, even the shaman.

11:45.700 --> 11:47.650
But we'll check the shaman as well.

11:47.770 --> 11:50.350
Take that stun debuff component.

11:50.500 --> 11:51.010
Check.

11:51.010 --> 11:51.760
Auto activate.

11:51.760 --> 11:53.080
Yeah, I think that's fine.

11:53.080 --> 11:53.920
So.

11:54.770 --> 11:56.390
Now we have those set.

11:56.420 --> 11:57.840
We can also set it for.

11:57.860 --> 11:58.160
Aura.

11:58.160 --> 11:59.570
So we can go to blueprints.

11:59.600 --> 12:00.260
Character.

12:00.260 --> 12:00.950
Aura.

12:02.420 --> 12:03.830
Open or a character.

12:04.880 --> 12:07.130
Select stun debuff component.

12:07.850 --> 12:10.430
And for aura, we'll need to move it up a bit.

12:12.100 --> 12:14.470
And we'll check auto activate to see.

12:15.660 --> 12:18.450
Looks like we also need to set it to stars.

12:20.570 --> 12:22.850
And we see the particles.

12:22.850 --> 12:23.660
Perfect.

12:23.690 --> 12:26.540
Now that those are set, we can save all.

12:27.590 --> 12:29.480
And we can stun some things.

12:31.330 --> 12:34.300
So we'll try getting stunned on the client.

12:38.770 --> 12:42.300
Now we are stunned, but we're not seeing those particles.

12:42.310 --> 12:45.250
And on the server, if we get stunned.

12:46.740 --> 12:53.280
We do see the particles, and we'll see if aura loses them when no longer stunned.

12:53.280 --> 12:54.240
And we do.

12:54.330 --> 12:58.410
So we just need the client to show those particles.

12:58.830 --> 13:00.120
And that makes sense, right?

13:00.120 --> 13:04.170
Because we're not getting that debuff tag on the client.

13:04.170 --> 13:12.960
So because we have on rep stunned in aura character, we can handle the debuff component for aura separately.

13:12.960 --> 13:15.990
So we're going to go into aura character.

13:19.570 --> 13:21.130
In on rep, stunned.

13:21.130 --> 13:23.520
And we know whether or not we're stunned.

13:23.530 --> 13:29.620
So what we can do is we can activate or deactivate based on is stunned.

13:29.620 --> 13:35.590
So if is stunned, we're going to take our stun debuff component and call activate.

13:36.010 --> 13:43.510
And if we're not stunned we're going to take stun debuff component and call deactivate.

13:46.610 --> 13:47.780
And with that.

13:48.920 --> 13:53.360
We should get those particles on aura as well on the client.

13:54.100 --> 13:56.140
So one last little check.

13:56.320 --> 13:57.700
We'll test this out.

13:58.560 --> 14:01.020
So on the client, we're going to get stunned.

14:03.890 --> 14:05.420
There's our particles.

14:11.980 --> 14:13.570
And they go away.

14:15.520 --> 14:16.450
Perfect.

14:17.060 --> 14:19.460
Now, this raises an important point.

14:19.490 --> 14:26.780
If we have this problem with the stun tag only being applied on the server and only getting those particles

14:26.780 --> 14:30.200
on the server for stun, the same goes for burn.

14:30.200 --> 14:35.450
So we are going to want to know if we're burned as well.

14:35.480 --> 14:41.720
So even though we don't need to know if we're burned in the animation blueprint, we could use a replicated

14:41.750 --> 14:49.100
B is burned just to activate and deactivate the burn debuff component for our client.

14:49.770 --> 14:57.090
So the last thing I'd like to do is just add a replicated B is burned just like B is stunned.

14:57.120 --> 14:59.610
We can add it to or a character base.

14:59.640 --> 15:05.190
We could just add it to or a character as we only have a need for it in or a character right now, but

15:05.190 --> 15:08.280
I'm just going to add it to or a character base anyway.

15:08.310 --> 15:12.150
So we'll have a B is burned and an on rep burned.

15:12.840 --> 15:17.790
So in addition to on rep stunned, we'll have on rep burned.

15:20.510 --> 15:21.760
It'll be virtual.

15:21.770 --> 15:27.350
We'll make it empty in over a character base, and we'll override it in or a character.

15:29.990 --> 15:31.250
So just like on rep.

15:31.250 --> 15:32.060
Stunned.

15:32.850 --> 15:35.730
We have virtual void on rep burned.

15:38.230 --> 15:41.860
Generate the definition and we'll just check if burned.

15:41.860 --> 15:45.970
So if be burned or is burned.

15:48.510 --> 15:53.490
Then we'll take the burn debuff component and activate.

15:55.590 --> 15:57.120
And we'll have an else.

15:57.570 --> 16:05.400
We'll take the burn debuff component and deactivate, and we'll test this when aura gets burned in the

16:05.400 --> 16:06.060
future.

16:06.060 --> 16:12.570
But for now, we know this will work, and we do need to add this to Aura Character Base and get lifetime

16:12.570 --> 16:14.010
replicated props.

16:14.010 --> 16:19.350
So we'll add do rep lifetime here for B is burned.

16:21.330 --> 16:23.310
So that'll take care of that issue.

16:23.310 --> 16:26.490
And with that that's going to wrap up this video.

16:26.490 --> 16:29.610
So now we have the stun mechanic.

16:29.610 --> 16:31.110
And it looks pretty good.

16:32.470 --> 16:38.440
So now that we're able to stun enemies and enemies are able to stun aura, this is pretty cool.

16:38.990 --> 16:46.040
We now have a new type of debuff and we're now ready to move on, making more abilities for our spell

16:46.070 --> 16:46.760
tree.

16:46.850 --> 16:49.280
Excellent job and I'll see you soon.
