WEBVTT

00:06.810 --> 00:07.870
Welcome back.

00:07.890 --> 00:15.450
So now that our eye is moving around, we've uncovered a couple of things that we may need to fix now.

00:15.480 --> 00:22.020
For one, they're interacting with our effect actors, which means they're picking up our pickups.

00:22.020 --> 00:24.660
And those pickups are for us, not for the enemies.

00:24.690 --> 00:30.690
Now, on top of that, some of the effect actors are affecting the enemies in ways that perhaps we do

00:30.690 --> 00:35.670
like maybe we do like that that fire is causing damage to those enemies.

00:35.670 --> 00:36.840
That's kind of cool.

00:36.840 --> 00:43.200
So we're probably going to want our Effect actors to be a little bit more configurable so we can set

00:43.200 --> 00:49.020
a setting that determines whether or not those effect actors should affect those enemies.

00:49.200 --> 00:50.340
That's one issue.

00:50.340 --> 00:55.950
Now, another is that our enemies are kind of snapping in their rotation.

00:56.220 --> 01:03.960
Notice as I run circles around them, they're snapping and that should be more of a smooth transition

01:03.960 --> 01:06.000
in their orientation.

01:06.000 --> 01:12.220
And that's actually a pretty easy fix that I'd like to take care of now before moving on to our effect

01:12.220 --> 01:12.910
actor.

01:13.030 --> 01:20.950
So let's go into our enemy base class, and I'm going to search here for use controller.

01:21.820 --> 01:24.070
And notice we have use controller rotation.

01:24.070 --> 01:31.930
Your the controller is actually going to orient in the direction that our eye is telling these goblins

01:31.930 --> 01:32.860
to move.

01:32.980 --> 01:37.980
And that happens as a result of the move to task in our behavior tree.

01:37.990 --> 01:43.330
If we uncheck that, however, and press play, then let's see what happens now.

01:43.330 --> 01:48.040
Well, they're following us, but they're not orienting towards us at all.

01:48.040 --> 01:54.040
So what I'd like to do instead is have the character orient in the rotation of its movement in a smooth

01:54.040 --> 01:54.700
manner.

01:54.700 --> 02:02.080
So instead of using use controller rotation, Yaw, we're going to use our movement component to orient

02:02.080 --> 02:03.400
in the direction of movement.

02:03.400 --> 02:10.390
So let's go to our character movement component and check use controller desired rotation.

02:10.390 --> 02:12.070
We'll set that to true.

02:12.070 --> 02:19.930
And now that we're using the controller desired rotation, we'll rotate to face that controller rotation

02:19.930 --> 02:23.190
and we'll do so in a smooth manner using rotation rate.

02:23.200 --> 02:30.250
If we increase that rotation rate, at least the Z component, which is the yaw component, if we drag

02:30.250 --> 02:36.880
this up to a really high value, then we'll see that Snappiness it's going to really just snap to that

02:36.880 --> 02:37.660
rotation.

02:37.660 --> 02:43.990
But if we lower that value, say 360 was what it was at, we could be a little faster, we could say

02:44.020 --> 02:45.220
400 here.

02:45.250 --> 02:49.690
Then in that case we'll see a smoother rotation.

02:49.690 --> 02:51.460
They'll turn to face us.

02:51.460 --> 02:58.540
And if that's even slower than 400, then we won't even notice that it's being set in periodic intervals.

03:01.810 --> 03:03.250
So I think that looks pretty good.

03:03.250 --> 03:04.570
We could actually lower it.

03:04.600 --> 03:06.670
360 was a pretty good value.

03:06.670 --> 03:11.800
So a couple of variable values that we changed gave us smoother behavior.

03:11.800 --> 03:18.040
For one, we don't want our enemy using controller rotation yaw, but we do want our movement component

03:18.040 --> 03:20.740
using the controller desired rotation.

03:20.740 --> 03:24.130
And those two booleans should be set in C plus plus.

03:24.130 --> 03:25.870
So that's the default values of them.

03:25.870 --> 03:28.780
But the rotation rate is something we can tweak from blueprint.

03:28.870 --> 03:36.250
So here in Writer, why don't we go into our character folder open ora enemy and make sure those properties

03:36.250 --> 03:38.560
are set here in the constructor?

03:38.560 --> 03:46.870
So the first is B use controller rotation and there are yaw pitch and roll.

03:46.870 --> 03:48.700
I'd like to set them all to false.

03:49.270 --> 03:56.440
So we're going to say use controller rotation pitch, set that to false, we're going to use false for

03:56.440 --> 04:01.960
roll and especially the yaw.

04:01.960 --> 04:05.890
We're going to set that to false and then we can get our movement component.

04:05.890 --> 04:08.830
So we're going to use get character movement.

04:10.680 --> 04:16.110
And if we search for comptroller here's that be used comptroller desired rotation.

04:16.110 --> 04:21.930
We're going to set that one to true and next time we compile, those changes will be compiled.

04:21.930 --> 04:24.510
But we've also set that in the blueprint as well.

04:24.510 --> 04:27.450
So that takes care of smoothing out character movement.

04:28.040 --> 04:29.510
So that looks pretty good.

04:29.540 --> 04:37.550
Now, next, we want to avoid having our enemies pick up pickups, but these are all effect actors.

04:37.550 --> 04:43.280
So maybe we do want our enemies to actually be affected by the fire.

04:43.610 --> 04:44.840
So some effect.

04:44.840 --> 04:48.110
Actors should affect enemies, some should not.

04:48.110 --> 04:53.550
And for that reason, we're going to want to check what that other actor is.

04:53.570 --> 04:57.860
Now, recall that we gave our enemy base a tag.

04:57.860 --> 05:03.140
If we search for tags, we have the enemy tag and we can check for that.

05:03.170 --> 05:04.790
We can go into writer.

05:04.790 --> 05:11.330
I'm going to close out of the editor now and we're going to go into our effect actor so I can close

05:11.360 --> 05:11.930
our enemy.

05:11.930 --> 05:12.560
We're done with that.

05:12.560 --> 05:19.430
For now, we're going to go into aura effect actor and we can check before applying an effect to the

05:19.430 --> 05:20.210
target.

05:20.240 --> 05:24.140
We can check that target actor and see if it has the enemy tag.

05:24.140 --> 05:30.870
Now, sometimes we want to actually affect the enemy tag, and for that reason, I'd like a setting

05:30.870 --> 05:37.170
on the effect actor that we can set a boolean of sorts just like destroy on effect removal, which we

05:37.170 --> 05:39.020
never actually used, did we?

05:39.030 --> 05:41.030
So we can actually use that too.

05:41.040 --> 05:46.290
So let's make a be apply effects to enemy.

05:46.290 --> 05:53.910
Or we can say to enemies and it'll be set to false by default and I think be destroy on effect removal

05:53.910 --> 05:58.440
makes less sense than say destroy on effect application.

05:58.440 --> 06:00.030
So I think this should be changed.

06:00.030 --> 06:08.880
I'm going to double click on it and right click go to refactor and rename and instead call this be destroy

06:08.910 --> 06:11.550
on effect application.

06:13.110 --> 06:16.950
Now renaming a property can break existing data in assets.

06:16.980 --> 06:22.560
Adding a core redirect to the configuration file tells Unreal Engine to remap obsolete data while loading

06:22.560 --> 06:26.310
assets so we can go ahead and add the core redirect.

06:26.430 --> 06:29.820
And now it's called Destroy on Effect application.

06:29.910 --> 06:35.450
So now we can check these booleans if we want to check be apply effects to enemies.

06:35.460 --> 06:40.980
We should do that here in our apply effect to target as that's what all these overlap functions are

06:40.980 --> 06:41.700
doing.

06:41.700 --> 06:48.240
But really I'd like to check in on overlap and on end overlap as well because those have to do with

06:48.240 --> 06:50.490
storing active effect handles.

06:50.640 --> 06:57.570
So first of all, here in apply effect to Target, I'm going to make a local const boolean called be

06:57.570 --> 07:05.250
is enemy and set that equal to and we're going to get the target actor and call actor has tag specifying

07:05.250 --> 07:06.690
the name enemy.

07:06.690 --> 07:11.340
So we know that the target actor is an enemy if it has the tag.

07:11.640 --> 07:20.500
So if it is an enemy, so if B is enemy and we're not supposed to apply this effect to enemies, in

07:20.500 --> 07:26.470
other words, and not be apply effects to enemies, then we can return.

07:26.800 --> 07:32.500
So if it is an enemy and we're not supposed to apply effects to enemies, we'll just return.

07:32.500 --> 07:36.550
We're going to take this line here and in fact, we don't need be is enemy.

07:36.550 --> 07:40.720
If we want to compact this into one line, we can take this target.

07:40.720 --> 07:43.420
Actor actor has tag and replace it there.

07:43.980 --> 07:45.660
And we have a single line.

07:45.840 --> 07:50.500
Now we can use this same line in our overlap functions as well.

07:50.520 --> 07:55.860
So we'll go ahead and add this to on overlap and we'll add this to on end overlap.

07:56.010 --> 08:01.500
So basically these functions will all ignore actors that are enemies.

08:02.010 --> 08:03.150
Okay, great.

08:03.150 --> 08:07.790
So now we have this other boolean destroy on effect application.

08:07.800 --> 08:14.490
If that's true, we should destroy as soon as we apply the effect and we can do that in apply effect

08:14.490 --> 08:15.380
to target.

08:15.390 --> 08:23.210
And I think that we should really only destroy our effect actor if our effect is an instant effect.

08:23.220 --> 08:29.970
So if it's an infinite effect, why would we destroy it if the effect is going to linger until possibly

08:29.970 --> 08:31.550
we stop overlapping?

08:31.560 --> 08:35.550
So what I'd like to do is check to see if this is an instant effect.

08:35.580 --> 08:39.920
If it is, then we're going to go ahead and destroy the self.

08:39.930 --> 08:48.850
So let's say if B destroy effect on application An and and we'll also take our effect spec handle dot

08:48.850 --> 08:57.370
data dot get we'll get the def from that have to use dot get there and get the duration policy.

08:59.610 --> 09:01.770
And we'll see if this is equal to E.

09:01.800 --> 09:04.440
Gameplay effect duration instant.

09:05.940 --> 09:11.790
So if it's an instant effect and we're supposed to destroy an effect application, we'll destroy.

09:13.600 --> 09:18.760
So in this case, only if that boolean is set are we going to destroy.

09:18.850 --> 09:23.170
So let's go ahead and test this out with our pickups.

09:24.830 --> 09:25.340
Okay.

09:25.340 --> 09:34.640
I'm going to go ahead and get my actor folder open and go into area and open fire area.

09:34.790 --> 09:40.840
I'm going to leave destroy on effect application off, but I'm going to check apply effects to enemies

09:40.850 --> 09:43.550
now because these are false by default.

09:43.580 --> 09:49.490
That makes it a little easier because I don't want to apply these other effects to enemies, but I do

09:49.490 --> 09:53.570
want to go in and check destroy on effect application.

09:53.570 --> 10:00.920
So I'm going to go into Potion BP Health Potion, and I'm going to check Destroy on Effect application

10:00.920 --> 10:02.090
for that.

10:02.180 --> 10:06.800
I'm also going to do that for mana destroy on effect application.

10:08.460 --> 10:11.490
And I'll do the same for my crystals as well.

10:11.820 --> 10:14.010
So here's my health, Crystal.

10:15.340 --> 10:17.670
Destroy on effect application.

10:17.680 --> 10:20.800
Here's my mana crystal destroy on effect application.

10:20.800 --> 10:24.730
And now we can save all and test these things out.

10:28.820 --> 10:31.070
And they do destroy those crystals.

10:31.070 --> 10:37.580
But I'm remembering now if I go back into Mana Crystal, we're calling destroy actor here in the blueprint.

10:37.580 --> 10:38.450
And that would be why.

10:38.480 --> 10:41.240
So I'm going to remove that from Mana Crystal.

10:41.540 --> 10:43.670
I'm going to remove it from health crystal.

10:43.700 --> 10:50.990
We're going to remove destroy actor from mana potion and from health potion because now apply effect

10:50.990 --> 10:53.570
to target will take care of destroying the actor.

10:53.570 --> 10:58.580
So saving all again let's try that again and make sure that.

10:59.270 --> 11:03.190
Those effect actors ignore the enemies.

11:03.200 --> 11:07.370
Let's see if they take damage and they are taking damage from the fire.

11:07.460 --> 11:10.130
Let's see if they take any of these other pickups.

11:10.130 --> 11:11.030
They don't.

11:11.060 --> 11:13.280
Let's make sure we can still pick those up.

11:13.280 --> 11:14.570
And we can.

11:16.990 --> 11:23.410
And things are looking great and those pickups are still being destroyed when we pick them up.

11:23.830 --> 11:26.890
Actually, it looks like the crystals are not being destroyed.

11:26.890 --> 11:29.980
Let's go to Health Crystal.

11:30.190 --> 11:36.880
And the reason they're not being destroyed actually here is because we're not destroying them, because

11:36.880 --> 11:39.490
we're using a duration gameplay effect class.

11:39.490 --> 11:41.200
So you know what?

11:41.230 --> 11:47.500
I think it's okay to destroy duration based effects as well, and we'll just choose not to destroy infinite

11:47.500 --> 11:48.040
effects.

11:48.040 --> 11:53.230
So because we know whether or not it's infinite, we'll only destroy if be infinite is false.

11:53.230 --> 11:57.190
So I'm going to change this line to say, if not, be infinite, destroy.

11:57.930 --> 12:02.510
And I think that is going to give us the behavior we want.

12:04.260 --> 12:08.670
Okay, so with that change, let's test things out.

12:09.660 --> 12:14.490
And everything looks like it's behaving correctly.

12:15.760 --> 12:16.900
Perfect.

12:17.810 --> 12:18.410
All right.

12:18.410 --> 12:21.390
So that is a great milestone.

12:21.410 --> 12:24.320
Things are working smoothly so far.

12:24.320 --> 12:26.990
And we have I chasing us around.

12:26.990 --> 12:32.570
It's not picking up pickups that it shouldn't pick up, but it is interacting with effect actors that

12:32.570 --> 12:36.170
it should interact with, which is exactly what we want.

12:36.350 --> 12:43.730
Now, while we're on the subject of polishing and before we wrap up this video, I'm noticing one small

12:43.730 --> 12:47.120
little annoying issue, and that's with my health globe.

12:47.150 --> 12:54.770
I'm noticing my ghost globe isn't quite going all the way to where it should go, and I already know

12:54.770 --> 12:56.690
and suspect what that's from.

12:56.690 --> 12:59.030
I think that is from the padding.

12:59.810 --> 13:09.080
So if I go to my Globe Progress Bar and Select Ghost, I'm pretty sure that it's because this has no

13:09.080 --> 13:09.830
padding.

13:09.830 --> 13:15.030
But my progress bar globe itself has padding of ten.

13:15.050 --> 13:22.080
Now, a couple of students also mentioned that if your globe and your background ring image are not

13:22.110 --> 13:30.150
100% perfect and it looks like you have a little bit of an offset, you can make that ring, that background

13:30.150 --> 13:32.910
image, the very, very front.

13:32.940 --> 13:39.630
We can bring it all the way to the front and that way you may not even need any padding at all.

13:39.720 --> 13:41.820
So I'm going to keep that on the front there.

13:41.820 --> 13:43.370
I think that's going to look pretty good.

13:43.380 --> 13:51.630
But I also think I want my progress bar ghost to have the same padding as my progress bar globe, which

13:51.630 --> 13:59.070
means I'm going to need to go up into my update functions where I'm updating my globe padding.

13:59.070 --> 14:00.090
While I'm at it.

14:00.090 --> 14:02.520
I'm going to go ahead and just set my progress bar.

14:02.550 --> 14:04.710
Ghost padding as well.

14:04.710 --> 14:06.060
So I'm going to get that.

14:06.180 --> 14:09.240
I'm going to use slot as overlay slot.

14:09.960 --> 14:12.120
And I'm going to call set padding.

14:13.570 --> 14:20.530
The function version of this, and I'm going to use the same exact padding as for my globe.

14:20.620 --> 14:27.760
Now, if I do that and press play, not only do my rings look a bit better, my globes are behind them.

14:27.760 --> 14:34.450
But as I take damage, let's just make sure that Ghost Globe goes down all the way to where it should

14:34.450 --> 14:34.750
go.

14:34.750 --> 14:36.320
And it looks like it is.

14:36.340 --> 14:37.900
That's looking pretty good.

14:40.340 --> 14:41.930
Yes, much better.

14:41.930 --> 14:44.510
And I can go drink a health potion.

14:45.770 --> 14:47.680
Maybe also a crystal.

14:47.690 --> 14:48.410
That was a man.

14:48.410 --> 14:49.460
A crystal, though, by the way.

14:49.460 --> 14:50.690
Let's get a health crystal.

14:50.780 --> 14:51.880
There it goes.

14:51.890 --> 14:55.430
Looks like it took me all the way up to 100%, but we're clamping.

14:55.430 --> 15:01.790
So if I get some fire, I should start taking damage right away and everything is going to the correct

15:01.790 --> 15:02.240
values.

15:02.240 --> 15:03.290
Perfect.

15:03.500 --> 15:03.890
Okay.

15:03.890 --> 15:07.010
So just a nice little tweak on the progress bar there.

15:07.010 --> 15:09.760
I'm going to save all and things are looking great.

15:09.770 --> 15:12.050
I'll see you in the next video.
