WEBVTT

00:06.870 --> 00:08.040
Welcome back.

00:08.370 --> 00:15.300
Now, so far, all of our gameplay effects are using scalable float for their modifier magnitudes.

00:15.450 --> 00:25.230
For example, if I open actor and potion and potion heal and I scroll down, I can see that right here

00:25.230 --> 00:27.130
I have a single modifier.

00:27.150 --> 00:34.290
It's modifying the health attribute, it's adding to it, and the modifier magnitude calculation type

00:34.290 --> 00:36.000
is set to scalable float.

00:36.210 --> 00:44.910
Now the dropdown shows us three other options and attribute based is the next one After scalable float

00:44.910 --> 00:52.230
and attribute based is quite an interesting and useful option for magnitude calculation type.

00:52.230 --> 01:01.230
It's actually very cool and it gives us the ability to have an attribute change based on other attribute

01:01.230 --> 01:02.100
values.

01:02.430 --> 01:08.770
This can make it really easy to have an attribute that is derived from other attributes.

01:09.220 --> 01:16.090
So in order to see how attribute based gameplay effects work, I'd like to make a new effect.

01:16.090 --> 01:25.480
Actor That applies a test effect that uses attribute based modifier magnitude calculation types.

01:25.480 --> 01:28.120
So let's go ahead and create one of those.

01:28.120 --> 01:34.660
So first here in Actor, I'm going to make a new folder called Test Actor.

01:36.140 --> 01:39.530
And here in test actor I'm going to make an effect.

01:39.530 --> 01:41.520
Actor And a gameplay effect.

01:41.540 --> 01:44.090
So I'll start with the effect.

01:44.090 --> 01:47.870
Actor Searching for aura effect Actor.

01:48.610 --> 01:52.090
And I'll call this BP underscore test actor.

01:53.290 --> 01:56.860
I'm going to open it up and I'm going to give it a.

01:58.050 --> 01:59.280
Box collision.

01:59.850 --> 02:06.540
And here in the event graph with the box selected, I'm going to use on component began overlap.

02:08.290 --> 02:13.240
And we'll call apply effect to Target.

02:14.070 --> 02:16.230
So we'll go ahead and hook these up.

02:17.340 --> 02:25.530
And I'd like to make a gameplay effect to apply and we can just make it an instant gameplay effect.

02:25.650 --> 02:31.500
So I'm going to get the instant gameplay effect class and we can make a gameplay effect and apply that.

02:31.530 --> 02:36.440
Now for testing purposes, I'm going to make the box a little bit more visible.

02:36.450 --> 02:42.930
I'm going to select my box and set my line thickness to something a little bigger.

02:43.670 --> 02:50.180
Perhaps five, and I'm going to search for the rendering section and uncheck Hidden in game.

02:50.930 --> 02:57.140
Compile save and now I have my test actor and I can just drag one in right here.

02:59.370 --> 03:02.920
Now we just need an effect to apply.

03:02.940 --> 03:07.470
So let's make that I'm going to create a new blueprint class.

03:07.830 --> 03:09.210
Gameplay Effect.

03:11.670 --> 03:15.420
And I'll call this GE underscore test.

03:15.570 --> 03:17.490
Attribute based.

03:18.740 --> 03:22.580
And open that up and we'll go ahead and configure this.

03:22.580 --> 03:29.120
But first I'm going to go to my test actor and set its instant gameplay effect.

03:29.780 --> 03:33.290
So all the way up at the top we have instant gameplay effect class.

03:33.290 --> 03:36.620
It's going to be GE test attribute based.

03:36.650 --> 03:42.860
We don't care about the instant effect application policy because we're just calling apply effect to

03:42.860 --> 03:44.120
target directly.

03:44.150 --> 03:44.720
Okay.

03:44.720 --> 03:49.160
So now we can configure this gameplay effect.

03:49.160 --> 03:51.620
It's going to be an instant gameplay effect.

03:51.650 --> 03:56.000
So all we need to care about here is adding a modifier.

03:56.000 --> 04:00.050
And if I click plus to add a new modifier, I can expand it.

04:00.050 --> 04:01.790
I can choose an attribute.

04:01.790 --> 04:04.370
I think I'll go ahead and choose the health attribute.

04:04.370 --> 04:07.940
And for modifier OP, we can leave it at Add.

04:07.940 --> 04:14.690
And for modifier magnitude, I'm going to expand it and for the magnitude calculation type instead of

04:14.690 --> 04:18.620
scalable float, I'm going to choose attribute based.

04:18.710 --> 04:25.190
Now, as soon as I do that, suddenly we have this attribute based magnitude which we can expand and

04:25.190 --> 04:29.610
we have quite a few options here and we're going to discuss all of these.

04:29.610 --> 04:32.130
But for now, just ignore the first three.

04:32.160 --> 04:38.790
We'll talk about these shortly, but take a look at backing attribute, expand that and we have the

04:38.790 --> 04:45.060
option to choose an attribute to capture and we can choose the attribute source.

04:45.090 --> 04:53.580
You see, this gameplay effect is going to be caused by something to something so we can capture the

04:53.580 --> 04:56.250
attribute from the source or the target.

04:56.700 --> 05:03.150
Now I'm going to choose Target because we're applying this gameplay effect to Aura when she overlaps

05:03.150 --> 05:03.840
with it.

05:03.840 --> 05:06.450
So I'm going to capture attributes from Aura.

05:06.630 --> 05:10.590
Now we'll talk more about Snapshot later in the course.

05:10.590 --> 05:18.210
It has to do with when to capture the attribute, when should we use that attributes value?

05:18.240 --> 05:24.690
Should we use it when the gameplay effect spec that caused this gameplay effect was created or when

05:24.690 --> 05:25.830
it was applied?

05:25.830 --> 05:30.990
Snapshot determines when exactly we'll be capturing that attribute.

05:31.020 --> 05:37.050
We're going to leave it unchecked for now, but we're not really going to discuss it until we have a

05:37.050 --> 05:40.890
situation more appropriate to consider it.

05:41.160 --> 05:47.250
Now, for the backing attribute, we can choose an attribute, and since I chose Target for the attribute

05:47.250 --> 05:54.720
source, then we know that we'll be taking that attribute from Aura as soon as she overlaps with our

05:54.720 --> 05:57.180
box component on Test Actor.

05:57.600 --> 06:05.460
And if I choose one of my attributes, for example, the vigor attribute, then by default, all we're

06:05.460 --> 06:13.440
going to do is add Since our modifier op is Add, we're going to add the value of vigor to our health.

06:13.440 --> 06:15.240
So let's see this in action.

06:15.240 --> 06:17.000
I'm going to go back and press play.

06:17.010 --> 06:23.880
I'm going to show debug ability system and I see that my health is 50 and my vigor is nine.

06:23.880 --> 06:29.700
So as soon as I overlap with this volume, now I see that my health is 59.

06:29.700 --> 06:30.270
Why?

06:30.300 --> 06:32.490
Because we had vigor added to it.

06:32.520 --> 06:35.880
We had the value of vigor added to it.

06:35.940 --> 06:38.490
So that seems simple enough, right?

06:38.490 --> 06:44.970
But the thing is, with all these options, this can get complicated very quickly and we know that we

06:44.970 --> 06:47.430
can add multiple modifiers.

06:47.430 --> 06:55.950
For example, what if I collapse this index for my modifiers and I click plus on the modifiers bar one

06:55.950 --> 06:56.490
more time?

06:56.490 --> 07:03.960
Now we have two elements in this array, and if I expand this one, I can choose to have another modifier.

07:03.960 --> 07:06.060
Now let's say I choose health again.

07:06.060 --> 07:11.400
So I have two modifiers modifying my health and I can leave this as Add.

07:11.400 --> 07:18.810
And let's say that I expand modifier magnitude, I change the calculation type to attribute based.

07:18.810 --> 07:26.010
I expand attribute based magnitude and expand backing attribute, and this time choose a different attribute

07:26.010 --> 07:27.300
like strength.

07:27.300 --> 07:30.240
And I choose the attribute source to be target.

07:30.240 --> 07:32.550
So now I'm going to collapse this.

07:32.550 --> 07:36.090
My modifiers array has two elements in it.

07:36.120 --> 07:43.410
They're both set to add for their modifier OP, but the first one is backed by the attribute vigor.

07:43.440 --> 07:46.470
The second is backed by the attribute strength.

07:46.470 --> 07:53.070
Now you would just expect to have vigor and strength added to our health.

07:53.070 --> 07:55.560
Well, let's see if that's the case.

07:57.000 --> 08:01.680
I see that my health is 50, vigor is nine and strength is ten.

08:01.680 --> 08:05.270
So if I overlap now, my health is 69.

08:05.280 --> 08:06.510
It was 50.

08:06.540 --> 08:09.420
We added nine and we added ten.

08:09.450 --> 08:10.860
That equals 69.

08:10.860 --> 08:13.500
So it works as expected.

08:13.680 --> 08:19.620
Now, when all of our modifier operations are just Add, then it's pretty intuitive.

08:19.620 --> 08:21.480
We just add them all together.

08:21.480 --> 08:28.650
But it's important to understand exactly how these modifiers work and how the order is taken into account.

08:28.650 --> 08:37.350
So we're going to have a more in depth conversation about how these modifiers are applied and how it

08:37.350 --> 08:40.500
works depending on what the modifier operation is.

08:40.500 --> 08:47.550
And after we do that, we're going to then start talking about these additional parameters coefficient

08:47.550 --> 08:54.060
pre-multiply, additive, post-multiply additive and so on, so that we understand completely how all

08:54.060 --> 08:55.170
of these things work.

08:55.170 --> 09:02.920
So in the next video we're going to take a deep dive looking at the modifiers and the order of operations,

09:02.920 --> 09:06.490
depending on what our modifier ops are set to.

09:06.490 --> 09:09.190
So we'll do that next and I'll see you soon.
