WEBVTT

00:00.770 --> 00:02.990
Welcome to your next quest.

00:03.380 --> 00:06.620
In this quest, you're going to make your resistance attributes.

00:06.620 --> 00:12.110
So this is all familiar stuff, but it's good practice for you to remember all the steps.

00:12.110 --> 00:18.290
So create your attributes for your resistances and complete all the boilerplate code.

00:18.290 --> 00:21.740
So no need for me to spell it all out for you.

00:21.860 --> 00:23.930
You know the steps at this point.

00:23.960 --> 00:28.370
Now I'd like you to add your attributes to the attribute menu as well.

00:28.370 --> 00:31.850
This involves another set of steps that you'll have to go through.

00:31.850 --> 00:38.300
And in addition to this, I'd like your resistances to behave as secondary attributes.

00:38.300 --> 00:44.270
In other words, they're going to be based on other attributes, and you're going to choose which attributes

00:44.270 --> 00:47.660
and what those mathematical relationships will be.

00:47.660 --> 00:51.800
And then you'll add the modifiers to your secondary attributes.

00:51.800 --> 00:58.430
Now, be as simple or complex as you wish with these, if you want to make some MKs for them and take

00:58.460 --> 01:01.260
other things like level into account, feel free.

01:01.260 --> 01:05.130
But just simple modifiers will do as well.

01:05.130 --> 01:08.700
So pause the video and conquer this quest now.

01:11.370 --> 01:11.730
Okay.

01:11.730 --> 01:15.150
So this quest is a little bit of a tall order, isn't it?

01:15.150 --> 01:18.510
Because we have to do quite a number of things.

01:18.510 --> 01:21.900
So let's see if we can cover all the bases here.

01:21.930 --> 01:25.100
The first thing we need are the resistance attributes.

01:25.110 --> 01:27.710
That's going to be in our attribute set.

01:27.720 --> 01:35.130
So I'm going to go into my public folder into ability system and aura attribute set.

01:35.130 --> 01:39.460
And these are going to be just like the rest of our secondary attributes.

01:39.480 --> 01:43.770
In fact, we can put them just under secondary attributes if we like.

01:43.770 --> 01:52.590
We can use our own multi-line comment that says what they are resistance attributes and we can just

01:52.590 --> 01:54.900
place the four new attributes here.

01:54.900 --> 02:04.290
So I'm going to copy the three boilerplate lines for Max Mana and paste them right here four times and

02:04.290 --> 02:06.210
I'm going to change the first one.

02:06.210 --> 02:09.330
And this is going to be fire resistance.

02:09.960 --> 02:15.340
Now that means the on ramp needs to be changed to on rep fire resistance.

02:15.340 --> 02:24.100
I'm going to change the category to resistance attributes and the attribute accessors needs fire resistance

02:24.100 --> 02:25.840
instead of max Mana.

02:26.080 --> 02:31.990
Now I'm going to go ahead and copy resistance and paste it into the category for all three of the rest

02:31.990 --> 02:32.620
of these.

02:32.620 --> 02:38.590
And I'll go ahead and place an empty line here as soon as I finished one of the attributes.

02:39.010 --> 02:42.880
So next we're going to do our next attribute instead of Max Mana.

02:42.880 --> 02:45.940
It's going to be lightning resistance.

02:47.520 --> 02:50.520
And I need to copy this for the on ramp.

02:50.700 --> 02:57.150
So that's on Rep Lightning resistance Attribute Accessors gets lightning resistance and we're done.

02:57.270 --> 03:04.680
And if you like, you can use that little trick that writer has by using control H You can search here,

03:04.680 --> 03:14.040
I can search for Max Mana and replace Max Mana for the next one, which is going to be arcane resistance.

03:14.580 --> 03:18.390
And I see that it will replace it in the three spaces here.

03:18.390 --> 03:25.020
I'm going to go ahead and replace all and then I can do the same thing here and replace this with physical.

03:25.020 --> 03:26.310
So physical.

03:27.530 --> 03:31.100
Resistance and I can replace all their.

03:31.220 --> 03:33.560
Now we need our rep notifies.

03:33.560 --> 03:40.010
So we'll scroll down to our rep, notifies down here at the bottom, and we'll make four copies of Max

03:40.010 --> 03:45.020
Mana and we'll just change these one by one.

03:45.050 --> 03:48.230
This first one will be fire resistance.

03:51.050 --> 03:53.900
The input will be old fire resistance.

03:53.930 --> 03:57.230
The next one will be lightning resistance.

04:02.310 --> 04:05.400
Changing the input to old lightning resistance.

04:05.760 --> 04:09.750
Next, we're going to have arcane resistance.

04:11.170 --> 04:13.060
Changing the input there.

04:13.420 --> 04:16.630
And finally, physical resistance.

04:18.550 --> 04:20.920
And we'll change the input there.

04:21.550 --> 04:30.130
And it looks like this last on Rep Max Mana needs to be there because I went ahead and changed the original.

04:30.130 --> 04:31.270
This is one of the copies.

04:31.270 --> 04:31.930
That's fine.

04:31.930 --> 04:34.780
We'll move it up there and we still have Max Mana.

04:35.050 --> 04:40.090
Now that we have the declarations, we can go ahead and define the functions.

04:40.510 --> 04:42.100
Generate definition.

04:42.100 --> 04:45.280
Looks like it just gave me fire resistance.

04:45.640 --> 04:49.240
I'm going to want all the rest of them, so I'm going to highlight them again.

04:50.480 --> 04:51.290
And there we go.

04:51.290 --> 04:53.270
Generate definitions by declarations.

04:53.270 --> 04:54.440
That's what I wanted.

04:54.890 --> 04:56.930
And we have the rest of them now.

04:56.930 --> 04:59.120
We just need our gameplay attribute rep.

04:59.120 --> 05:07.730
Notify another piece of boilerplate and we need to change this to fire resistance and old fire resistance.

05:08.060 --> 05:10.400
And we'll need to do the same thing for the rest of them.

05:10.400 --> 05:13.370
So really quickly, just doing the same thing.

05:21.560 --> 05:22.040
Okay.

05:22.040 --> 05:25.020
So there are the rep notifies.

05:25.040 --> 05:31.400
Now we need these to be replicated, which means we add them up to our git lifetime replicated props.

05:31.430 --> 05:37.730
I'll go ahead and put these just under secondary attributes and say resistance attributes.

05:38.090 --> 05:44.630
We'll copy one of these lines and change the variable to fire resistance.

05:45.250 --> 05:50.860
And we'll go ahead and do three copies of that and change these.

05:50.950 --> 05:53.020
We have lightning resistance.

05:54.450 --> 05:59.010
We have arcane resistance and we have physical resistance.

05:59.700 --> 06:02.530
Now, that's not quite all that we need to do.

06:02.550 --> 06:08.700
Remember, we added one additional boilerplate step if we wanted these attributes associated with their

06:08.700 --> 06:10.620
corresponding gameplay tags.

06:10.650 --> 06:16.590
Now, these we plan on having in our attribute menu, which means we do want these associated with their

06:16.590 --> 06:18.720
corresponding gameplay tags.

06:18.840 --> 06:25.150
Now we created that association with our tags two attributes map, so we can add that here.

06:25.170 --> 06:30.960
So I'm going to go ahead and add another comment that says resistance attributes and we're going to

06:30.960 --> 06:37.080
add the resistance attributes and associate them with their resistance tags, which means we're going

06:37.080 --> 06:42.960
to have gameplay tags, dot attributes resistance looks like it's showing me in alphabetical order,

06:42.960 --> 06:48.240
so I'll go in alphabetical order and I'll use get arcane resistance attribute.

06:49.130 --> 06:52.310
Now Autocomplete thinks I want to call the function.

06:52.310 --> 06:53.080
I don't.

06:53.090 --> 06:55.250
I'm going to remove those parentheses.

06:55.250 --> 07:01.810
And now I've associated the arcane resistance tag to the arcane resistance attribute.

07:01.820 --> 07:04.550
Careful not to map the damage type tag.

07:04.550 --> 07:06.430
We want the resistance tag.

07:06.440 --> 07:07.480
There's a difference.

07:07.490 --> 07:13.670
Now, in addition to arcane, I'm going to let Autocomplete show me the next one That's fire and I'm

07:13.670 --> 07:16.610
going to change this to get fire resistance attribute.

07:16.700 --> 07:20.180
I'm going to go ahead and paste again after fire.

07:20.180 --> 07:28.310
Is lightning changing this to get lightning resistance attribute copying and pasting one last time.

07:29.180 --> 07:30.650
We have physical.

07:33.220 --> 07:39.700
So we have get physical resistance attribute and now our tags are mapped to our attributes.

07:39.940 --> 07:41.620
That's an important step.

07:41.650 --> 07:48.220
Okay, so now that our attribute set has the attributes and we've performed all the boilerplate code,

07:48.250 --> 07:53.260
the next step is to handle things on the blueprint side.

07:53.260 --> 07:59.560
And I'd like to make sure to set up the mathematical relationships between the resistances and their

07:59.560 --> 08:01.050
backing attributes.

08:01.120 --> 08:04.750
So what I'm going to do is go ahead and compile and launch the editor.

08:06.810 --> 08:07.170
Okay.

08:07.170 --> 08:12.900
So back in the editor, I'm going to go into blueprints, ability system and gameplay effects and go

08:12.900 --> 08:14.610
into default attributes.

08:14.760 --> 08:21.030
Now we know that Aura is using the secondary attributes and secondary attributes.

08:21.030 --> 08:26.160
We have a modifier that's attribute based for most of our secondary attributes.

08:26.160 --> 08:28.160
They're based on other attributes.

08:28.170 --> 08:35.520
Now to me, resilience is probably one of the more important attributes that should back these resistances.

08:35.520 --> 08:40.830
But if we like, we can make our resistances dependent on multiple attributes.

08:40.830 --> 08:46.260
If we want to do that, what I'm going to do is I'm going to collapse all the modifier indices.

08:47.390 --> 08:49.010
We have ten of them total.

08:49.010 --> 08:53.030
And I'm going to add modifiers for our resistances.

08:53.060 --> 09:00.230
Now, if you really wanted to, you could create a new gameplay effect called G resistance attributes

09:00.230 --> 09:03.680
and you could apply it separately to make things simpler.

09:03.680 --> 09:11.000
I'm just going to keep one secondary attributes gameplay effect and treat our resistances as secondary

09:11.000 --> 09:11.800
attributes.

09:11.810 --> 09:13.820
So I'm going to add a new modifier.

09:13.850 --> 09:17.600
This will be index ten and I'm going to choose the attribute.

09:17.630 --> 09:19.670
It's going to be fire resistance.

09:19.670 --> 09:21.410
I'm going to use override.

09:21.410 --> 09:29.810
Just like with our others, modifier magnitude is going to be attribute based and we're going to expand

09:29.810 --> 09:31.070
the backing attribute.

09:31.070 --> 09:35.180
And I'm going to choose resilience as the backing attribute.

09:35.210 --> 09:45.050
Now for fire resistance, I would like each point of fire resistance to ignore 1% of fire damage, which

09:45.050 --> 09:48.350
means fire resistance should be relative low.

09:48.470 --> 09:57.890
I'd like to have about perhaps three for my post-multiply additive value and then for every point of

09:57.890 --> 10:04.610
resilience, I'd like to add about maybe 0.5 to my fire resistance.

10:04.700 --> 10:09.380
And the attribute source is going to be target and I'm not going to snapshot.

10:09.530 --> 10:16.400
Now this is Override, and if we want to base this on multiple attributes, we could, for example,

10:16.400 --> 10:22.580
we could add another modifier and instead of override, we can just choose Add as these modifiers are

10:22.580 --> 10:24.230
applied one after the other.

10:24.230 --> 10:32.090
So let's say I'd like my resistances to be based on resilience, but also one of my other attributes,

10:32.090 --> 10:37.730
let's say for the elements, all the damage types except for physical can have their resistances buffed

10:37.730 --> 10:40.520
up based on intelligence as well.

10:40.520 --> 10:43.130
So I can add another modifier.

10:43.680 --> 10:48.690
For index 11, we can choose fire resistance, for example.

10:48.930 --> 10:51.450
Choose Add instead of override.

10:51.450 --> 10:57.870
And for the modifier magnitude, we can make it attribute based and it can be based on the backing attribute

10:57.870 --> 10:59.070
of intelligence.

10:59.830 --> 11:05.330
And we need to determine how much is added to the intelligence.

11:05.350 --> 11:11.920
For example, for every point of intelligence, fire resistance can go up by 0.1, for example.

11:11.920 --> 11:13.630
So that's another possibility.

11:13.660 --> 11:19.000
I'm going to keep this simple, though, and base these all on resilience only.

11:19.000 --> 11:24.270
So I'm going to go ahead and delete that modifier and consider fire resistance done.

11:24.280 --> 11:29.980
So I'm going to add another modifier and take care of my next resistance.

11:29.980 --> 11:33.130
That's going to be lightning resistance.

11:33.160 --> 11:35.080
It's going to be override.

11:35.440 --> 11:40.990
We're going to choose a modifier magnitude attribute based, expanding our backing attribute.

11:40.990 --> 11:44.620
It's going to be also resilience taken from the target.

11:44.620 --> 11:48.070
And I'd like the same coefficients for all of these attributes.

11:48.190 --> 11:54.430
A three for post-multiply and a coefficient of 0.5, so three and 0.5.

11:54.430 --> 11:59.720
And it's kind of nice to just put them all at the same settings in the beginning.

11:59.720 --> 12:03.500
And then as we play test the game, we can come back and tweak these.

12:03.500 --> 12:08.930
So it doesn't make a whole lot of sense to try to put in values that you think are perfect right at

12:08.930 --> 12:11.420
this point, because we don't know if they're perfect yet.

12:11.450 --> 12:12.860
We haven't tested them.

12:12.860 --> 12:13.250
Okay.

12:13.250 --> 12:17.240
So in addition to lightning resistance, we need another one.

12:17.240 --> 12:21.020
And this one is going to be arcane resistance.

12:21.020 --> 12:22.940
It's going to be override.

12:22.970 --> 12:25.850
We're going to make it attribute based.

12:25.850 --> 12:32.540
The backing attribute is going to be also resilience taken from the target with a post-multiply of three

12:32.720 --> 12:34.730
and a coefficient of 0.5.

12:34.940 --> 12:37.310
And finally, one last.

12:37.830 --> 12:39.450
Resistance attribute.

12:39.480 --> 12:41.890
It's going to be physical resistance.

12:41.910 --> 12:43.890
We'll make it override.

12:44.430 --> 12:45.960
Attribute based.

12:46.320 --> 12:47.040
Backing.

12:47.040 --> 12:48.900
Attribute Resilience.

12:49.320 --> 12:54.930
Captured from target Post-multiply of three Coefficient of 0.5.

12:55.200 --> 13:00.630
So now that we have this taken care of and because we placed it in secondary attributes, we don't need

13:00.630 --> 13:04.170
to go and make another attribute setting gameplay effect.

13:04.170 --> 13:07.980
We don't need to take care of applying that effect.

13:07.980 --> 13:09.870
It's all taken care of for us.

13:10.020 --> 13:13.800
Now all we need to do is implement this in the attribute menu.

13:13.800 --> 13:18.920
Now, just by the way we're implementing these resistances for aura.

13:18.930 --> 13:25.790
We haven't bothered adding these to the enemies gameplay effect for setting the enemy attributes.

13:25.800 --> 13:30.160
If you want, you can add them to the enemies gameplay effect as well.

13:30.180 --> 13:36.090
For now, I'm not going to implement resistances for enemies, but it's just as simple as adding those

13:36.090 --> 13:38.830
to the gameplay effect for the enemy.

13:38.830 --> 13:40.080
Secondary attributes.

13:40.090 --> 13:42.220
I leave that as optional for you.

13:42.720 --> 13:48.640
And I very well may add that later on in the course, but for now it's not important.

13:48.660 --> 13:56.310
I'm moving on to the UI because we need to go to the attribute menu and our attribute menu now needs

13:56.340 --> 13:59.640
attribute rows for our resistances.

13:59.670 --> 14:02.520
Now I'm going to add it to the secondary attributes.

14:02.670 --> 14:06.240
I'm just going to consider it to be one of the secondary attributes.

14:06.240 --> 14:10.290
So we just need four more rows here in our scroll box.

14:11.380 --> 14:13.990
Now we have row armor through row.

14:14.020 --> 14:14.380
Max.

14:14.380 --> 14:14.770
Mara.

14:15.070 --> 14:18.910
I'm going to stick the resistances down at the bottom just to keep things simple.

14:18.940 --> 14:21.130
I'm going to select Row Max Mana.

14:21.400 --> 14:28.270
I'm going to hit control C control V, and we now have another row and I'm going to call this row.

14:29.150 --> 14:31.010
Fire resistance.

14:31.730 --> 14:36.740
I'm going to hit control C, control V and call this one row.

14:36.920 --> 14:39.440
Lightning Resistance.

14:39.830 --> 14:41.090
Control V.

14:41.120 --> 14:43.040
Call this one row.

14:43.130 --> 14:44.180
Arcane.

14:45.060 --> 14:47.730
Resistance Control V.

14:47.850 --> 14:52.710
Rename this one Physical resistance.

14:52.710 --> 14:54.900
So we now have four new rows.

14:55.170 --> 15:00.220
These must have their gameplay tags set, which means we should go into the graph.

15:00.240 --> 15:04.690
Now we have our set attribute tags where we're setting the primaries.

15:04.710 --> 15:09.600
The secondaries will have another sequence here for our resistances.

15:09.600 --> 15:16.710
Even though our resistances are technically secondary attributes, we're just going to separate them

15:16.710 --> 15:17.200
here.

15:17.220 --> 15:18.930
We're going to have another sequence.

15:20.010 --> 15:23.420
And this one will handle our resistance attributes.

15:23.430 --> 15:25.710
I'm going to move these out of the way for now.

15:30.800 --> 15:37.190
And for our resistance attributes, we're going to get our ro fire resistance.

15:38.520 --> 15:45.120
Our row, lightning resistance, our row, arcane resistance and our row physical resistance.

15:45.120 --> 15:47.310
And we're going to set their gameplay tags.

15:47.700 --> 15:52.950
So we're going to say set, attribute tag, going to duplicate it three more times.

15:53.250 --> 15:59.520
And for row fire resistance, I'm going to set it two attributes Resistance.

15:59.520 --> 16:03.180
Fire for row Lightning resistance.

16:04.980 --> 16:09.180
We're going to set it to resistance lightning and hook that up.

16:11.590 --> 16:17.230
And you already know what we'll do for these arcane resistance gets arcane.

16:18.290 --> 16:20.480
Physical resistance gets physical.

16:23.680 --> 16:26.530
We hook these up to the sequence and we're done.

16:26.980 --> 16:32.830
Now, this function looks a little bit unwieldy, right?

16:32.830 --> 16:34.150
It's a little bit out of hand.

16:34.150 --> 16:38.020
And we could just refactor each of these into their own functions.

16:38.020 --> 16:47.860
For example, I could highlight these right click collapse the function and call this set primary attribute

16:47.890 --> 16:48.760
tags.

16:50.130 --> 16:53.100
I can highlight these collapse the function.

16:55.050 --> 17:02.790
Call this set secondary attribute tags and I can highlight these.

17:03.210 --> 17:04.830
Collapse the function.

17:06.800 --> 17:10.730
Set resistance Attribute tags.

17:11.640 --> 17:12.870
Like so.

17:15.220 --> 17:19.180
Okay, So it seems like we're almost done, if not completely done.

17:19.180 --> 17:19.660
Right.

17:19.660 --> 17:25.570
And if you got to this point and you went and tried to playtest and you opened your attribute menu and

17:25.570 --> 17:32.050
scroll down and you said, why did these just say attribute, you're forgetting one important step.

17:32.050 --> 17:40.360
And that's that our attribute menu receives a struct of type or attribute info, and this is data driven

17:40.360 --> 17:42.550
by a data asset, isn't it?

17:42.580 --> 17:44.950
We have to fill in that data asset.

17:45.100 --> 17:52.710
We have to go into blueprints, ability system data and we have to go into attribute info.

17:52.720 --> 17:59.740
Remember, each attribute has the gameplay tag for the attribute, the attribute tag associated with

17:59.740 --> 18:00.310
it.

18:00.320 --> 18:04.120
It has the attribute name and the attribute description.

18:04.120 --> 18:09.520
We're not using that description just yet, but we have the attribute name and that's what we use to

18:09.520 --> 18:13.120
display in our attribute menu what the attribute is.

18:13.150 --> 18:15.110
We're going to need more of these.

18:15.110 --> 18:16.550
We're going to add four more.

18:16.550 --> 18:20.030
So I'm going to click plus that's going to be index 14.

18:20.060 --> 18:25.250
For me, the attribute tag is going to be attributes resistance.

18:25.250 --> 18:26.750
We'll start with our Cain.

18:26.780 --> 18:29.330
The attribute name will be arcane.

18:29.820 --> 18:35.520
And for the description, we'll just say resistance to arcane damage.

18:36.240 --> 18:37.980
Now I can click plus.

18:38.560 --> 18:40.240
For index 15.

18:40.270 --> 18:42.550
I'm going to choose resistance fire.

18:42.640 --> 18:48.100
The attribute name is going to be and actually this should be fire resistance.

18:48.100 --> 18:53.740
And the attribute name for the last one should actually be arcane resistance.

18:54.040 --> 18:56.230
That's what we want to see in our menu.

18:56.620 --> 19:02.950
Now, attribute description will be resistance to fire damage and we can add another one.

19:02.950 --> 19:05.380
I'm going to collapse these as I go.

19:05.500 --> 19:10.120
So adding another one we have, let's see, what did we have?

19:10.120 --> 19:12.190
We had fire and arcane.

19:12.220 --> 19:14.200
We need lightning.

19:15.080 --> 19:17.780
The name will be Lightning Resistance.

19:18.780 --> 19:23.250
The description resistance to lightning damage.

19:23.550 --> 19:26.400
And one more for physical.

19:27.640 --> 19:29.770
We're going to choose the physical tag.

19:30.670 --> 19:38.140
Physical resistance and description resistance to physical damage.

19:38.800 --> 19:45.700
Now that we have this in our attribute info, if we go and press play, go to the attributes and scroll

19:45.700 --> 19:46.240
down.

19:46.240 --> 19:48.010
Look at that.

19:48.040 --> 19:53.550
We have fire resistance through physical resistance and we're seeing the actual number.

19:53.560 --> 19:55.780
Now we're not using that number yet.

19:55.810 --> 19:59.340
We still have to do that, but now we have the attributes.

19:59.350 --> 20:00.850
So that's great.

20:00.910 --> 20:09.310
Now because these are all using basically the same modifier coefficients and parameters all based on

20:09.310 --> 20:10.180
resilience.

20:10.180 --> 20:15.340
Well, they all change when resilience changes and all by the same amount.

20:15.370 --> 20:20.530
And as resilience gets really, really high, these resistances get really high as well.

20:22.450 --> 20:27.880
So that gives us an incentive to increase our resilience, which also increases a lot of our other attributes.

20:27.880 --> 20:34.620
So resilience might be verging on the edge of overpowered, but that's okay.

20:34.630 --> 20:40.350
This is all stuff that we can change the framework and the system is in place and that's what's important.

20:40.360 --> 20:48.100
So now that we have resistance attributes, it was fairly easy to incorporate it into all of the systems

20:48.100 --> 20:49.090
in our game.

20:49.180 --> 20:56.110
Just those boilerplate steps in the attribute set are what's keeping this all tied together, right?

20:56.110 --> 21:02.230
And we didn't have to touch one line of code in our attribute menu widget controller because it's just

21:02.230 --> 21:03.520
coded so well.

21:03.520 --> 21:11.050
So if you want an example of good code, use the attribute menu widget controller as a prime example

21:11.050 --> 21:11.830
of that.

21:11.860 --> 21:16.870
So you can always go back to that class if you need an example of robust code.

21:16.870 --> 21:19.420
So anyway, we have our resistances.

21:19.450 --> 21:23.270
We're not taking them into account when it comes to causing damage.

21:23.270 --> 21:25.190
So that's going to be our next step.

21:25.190 --> 21:27.230
And I'll see you in the next video.

21:27.230 --> 21:28.670
Great job on the challenge.

21:28.670 --> 21:29.720
I'll see you soon.
