WEBVTT

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

00:08.060 --> 00:15.830
So we're initializing health and mana with hardcoded values, and that's definitely not something that

00:15.830 --> 00:17.150
we like to do, is it?

00:17.150 --> 00:19.760
So we're not going to do it that way.

00:19.790 --> 00:25.480
We're not going to call init health and init mana here in the constructor anymore.

00:25.490 --> 00:27.680
I'm removing those now.

00:27.680 --> 00:30.140
What do we want to initialize health and mana to?

00:30.140 --> 00:36.260
Well, our max health and max mana are dependent on other attributes.

00:36.290 --> 00:38.120
Max health is dependent on vigor.

00:38.120 --> 00:40.070
It's also dependent on player level.

00:40.280 --> 00:47.930
Max Mana is dependent on intelligence and player level, so it's kind of hard to tell what that's going

00:47.930 --> 00:52.310
to be if we want to hard code it in, but we don't want to hard code it in.

00:52.340 --> 01:00.500
We want to set health and mana to the max values and we have to do that after max health and Max Mana

01:00.500 --> 01:01.990
have been set.

01:02.000 --> 01:04.970
So timing is important here.

01:04.970 --> 01:12.780
And again, what's our preferred or at least my preferred way to set attribute values that's well by

01:12.780 --> 01:14.040
gameplay effects.

01:14.040 --> 01:21.870
So I would like to have gameplay effects that initialize health and mana and initialize them to the

01:21.870 --> 01:24.090
values of max health and max mana.

01:24.120 --> 01:29.520
That's what I'd like them to be set to and this doesn't need to be an infinite gameplay effect.

01:29.520 --> 01:34.140
It could be an instant one that just sets health and mana just initializes them.

01:34.140 --> 01:35.490
So that's what I'd like.

01:35.880 --> 01:38.910
And this is going to be your quest.

01:39.610 --> 01:43.360
So you're going to initialize your vital attributes.

01:43.360 --> 01:48.070
And I'd like you to do this by creating a gameplay effect to do so.

01:48.190 --> 01:51.670
So for now, our vital attributes are health and max health.

01:51.670 --> 01:58.890
So set health equal to the value of max health and set your mana equal to the value of max mana.

01:58.900 --> 02:01.510
And after that of course you can play test.

02:01.540 --> 02:08.440
This will ensure that our health, globe and mana globe are initialized to full right and you have to

02:08.440 --> 02:14.770
do this after max Health and Max Mana have already been initialized or at least set for the first time.

02:14.770 --> 02:19.570
So make sure that you figure out the right timing and everything else.

02:19.570 --> 02:22.240
You have all the skills that you need to do this.

02:22.240 --> 02:27.760
So pause the video, conquer this quest and initialize your vital attributes now.

02:31.080 --> 02:31.560
Okay.

02:31.560 --> 02:37.560
So if we're going to have a gameplay effect to initialize our vital attributes, I think that should

02:37.560 --> 02:44.400
be a variable and I'd like to set that where we have our other variables for the gameplay effects that

02:44.400 --> 02:46.320
initialize our attributes.

02:46.320 --> 02:52.770
And that's going to be on our Aura character base class right here.

02:52.770 --> 02:59.640
We have default primary attributes, default secondary attributes, and I'd like to set our default

02:59.640 --> 03:01.290
vital attributes.

03:01.290 --> 03:07.350
So we're going to have whoops, we're going to have a gameplay effect class for that and this will be

03:07.380 --> 03:09.990
default vital attributes.

03:09.990 --> 03:12.270
And how are we going to apply it?

03:12.270 --> 03:15.090
Well, we have our nice apply effect to self.

03:15.090 --> 03:25.230
We can call that if I control over into the CPP file, I see that first we're applying the default primary

03:25.230 --> 03:32.560
attributes, then the default secondary, and after that we can do the vital because our secondary attributes

03:32.560 --> 03:39.730
have to be set before the vital because the secondary attributes include max health and max mana.

03:39.730 --> 03:46.930
So after this function call, the secondary attributes will be initialized and now we can initialize

03:46.930 --> 03:51.250
vital equal to the values of those secondary attributes.

03:51.250 --> 03:59.890
So we're going to call apply effect to self passing in default vital attributes and we'll pass in a

03:59.890 --> 04:02.350
level of one and that's it.

04:02.350 --> 04:07.420
Now we just need to create our default vital attributes gameplay effect.

04:07.420 --> 04:08.950
So let's go ahead and run.

04:08.950 --> 04:15.910
I'll go ahead and run in debug mode and then we'll create that and hopefully we should see our health

04:15.910 --> 04:18.550
and Mana Globes start off full.

04:19.410 --> 04:19.950
Okay.

04:19.950 --> 04:28.260
So what we can do is we can go into our blueprints, ability system, gameplay effects, default attributes,

04:28.260 --> 04:34.230
and we can create our default vital attributes gameplay effect.

04:34.230 --> 04:40.890
So I'm going to make a new blueprint class choosing gameplay effect as the parent class and we'll call

04:40.890 --> 04:45.780
this G underscore aura vital attributes.

04:45.900 --> 04:51.090
Let's open this up and we want this to be an instant gameplay effect.

04:51.090 --> 04:56.850
I'll leave that at instant and we'll add a modifier to set the value of health.

04:56.850 --> 04:58.350
We're going to initialize it.

04:58.350 --> 05:00.960
So the attribute is going to be health.

05:00.960 --> 05:03.810
The modifier OP will be override.

05:03.840 --> 05:11.310
The magnitude is going to be attribute based because we want to set it equal to the attribute of our

05:11.310 --> 05:11.910
max health.

05:11.910 --> 05:15.120
So the attribute to capture will be max health.

05:15.120 --> 05:19.870
The attribute source will be target and that's all we need for health.

05:19.870 --> 05:22.570
We're going to do the same thing for Mana.

05:22.570 --> 05:26.350
So I'm going to collapse that index and add another modifier.

05:26.620 --> 05:29.170
This modifier is attribute will be mana.

05:29.200 --> 05:36.580
The modifier op will be override modifier magnitude calculation type is going to be attribute based.

05:36.610 --> 05:41.770
We'll expand this and our backing attribute is going to be Max Mana.

05:41.770 --> 05:44.950
It's going to be from the target and that's it.

05:44.980 --> 05:52.450
Now as soon as we start the game, we should have this gameplay effect applied as long as we set it

05:52.480 --> 05:53.320
on aura.

05:53.320 --> 06:01.840
So we need to go back to blueprints, character, aura, BP Aura, character, and we need to set that.

06:01.840 --> 06:05.710
It's right here under attributes our default vital attributes.

06:05.710 --> 06:08.230
If we didn't set this, we're doing a check there.

06:08.230 --> 06:11.770
So we are asserting that we have this set.

06:11.770 --> 06:15.160
So let's set it G or a vital attributes.

06:15.160 --> 06:16.210
Now it's set.

06:16.240 --> 06:17.890
We can save all.

06:18.450 --> 06:21.420
And we can press play and look at that.

06:21.420 --> 06:26.850
We have two nice big, beautiful full globes of health and mana.

06:26.850 --> 06:35.070
And if we go ahead and show debug, well, I don't really see health or mana anymore, so show debug

06:35.070 --> 06:39.720
is a little bit less useful these days, but we're good.

06:39.720 --> 06:40.620
I trust it.

06:40.620 --> 06:47.790
I think that my health and my mana are correct and we're going to verify that very soon by actually

06:47.790 --> 06:54.480
showing things like the numerical values of our attributes in our UI elements.

06:54.480 --> 06:56.490
So we'll be doing those things next.

06:56.490 --> 06:59.850
But for now, great job and this is a good milestone.

06:59.850 --> 07:02.250
You've learned a lot about gameplay effects.

07:02.250 --> 07:11.280
We've learned a whole lot about the different modifiers and there are different types of magnitude calculation

07:11.280 --> 07:11.640
types.

07:11.640 --> 07:14.940
We learned about scalable float and attribute based.

07:14.970 --> 07:17.370
We know about custom calculation class.

07:17.370 --> 07:20.740
We don't know about that fourth one there set by caller.

07:20.740 --> 07:23.860
So that's the one that we still need to learn.

07:23.860 --> 07:26.200
We'll get to that in this course.

07:26.200 --> 07:27.880
Don't worry, we're covering them all.

07:27.910 --> 07:34.090
But it was a lot to learn just these three and you're a lot more powerful just knowing those three.

07:34.090 --> 07:39.220
So it's just a testament to how useful and powerful gas is.

07:39.220 --> 07:45.720
So congratulations on all we've learned so far, and it only gets better from here.

07:45.730 --> 07:47.440
I'll see you in the next video.
