Welcome back.
So we're initializing health and mana with hardcoded values, and that's definitely not something that
we like to do, is it?
So we're not going to do it that way.
We're not going to call init health and init mana here in the constructor anymore.
I'm removing those now.
What do we want to initialize health and mana to?
Well, our max health and max mana are dependent on other attributes.
Max health is dependent on vigor.
It's also dependent on player level.
Max Mana is dependent on intelligence and player level, so it's kind of hard to tell what that's going
to be if we want to hard code it in, but we don't want to hard code it in.
We want to set health and mana to the max values and we have to do that after max health and Max Mana
have been set.
So timing is important here.
And again, what's our preferred or at least my preferred way to set attribute values that's well by
gameplay effects.
So I would like to have gameplay effects that initialize health and mana and initialize them to the
values of max health and max mana.
That's what I'd like them to be set to and this doesn't need to be an infinite gameplay effect.
It could be an instant one that just sets health and mana just initializes them.
So that's what I'd like.
And this is going to be your quest.
So you're going to initialize your vital attributes.
And I'd like you to do this by creating a gameplay effect to do so.
So for now, our vital attributes are health and max health.
So set health equal to the value of max health and set your mana equal to the value of max mana.
And after that of course you can play test.
This will ensure that our health, globe and mana globe are initialized to full right and you have to
do this after max Health and Max Mana have already been initialized or at least set for the first time.
So make sure that you figure out the right timing and everything else.
You have all the skills that you need to do this.
So pause the video, conquer this quest and initialize your vital attributes now.
Okay.
So if we're going to have a gameplay effect to initialize our vital attributes, I think that should
be a variable and I'd like to set that where we have our other variables for the gameplay effects that
initialize our attributes.
And that's going to be on our Aura character base class right here.
We have default primary attributes, default secondary attributes, and I'd like to set our default
vital attributes.
So we're going to have whoops, we're going to have a gameplay effect class for that and this will be
default vital attributes.
And how are we going to apply it?
Well, we have our nice apply effect to self.
We can call that if I control over into the CPP file, I see that first we're applying the default primary
attributes, then the default secondary, and after that we can do the vital because our secondary attributes
have to be set before the vital because the secondary attributes include max health and max mana.
So after this function call, the secondary attributes will be initialized and now we can initialize
vital equal to the values of those secondary attributes.
So we're going to call apply effect to self passing in default vital attributes and we'll pass in a
level of one and that's it.
Now we just need to create our default vital attributes gameplay effect.
So let's go ahead and run.
I'll go ahead and run in debug mode and then we'll create that and hopefully we should see our health
and Mana Globes start off full.
Okay.
So what we can do is we can go into our blueprints, ability system, gameplay effects, default attributes,
and we can create our default vital attributes gameplay effect.
So I'm going to make a new blueprint class choosing gameplay effect as the parent class and we'll call
this G underscore aura vital attributes.
Let's open this up and we want this to be an instant gameplay effect.
I'll leave that at instant and we'll add a modifier to set the value of health.
We're going to initialize it.
So the attribute is going to be health.
The modifier OP will be override.
The magnitude is going to be attribute based because we want to set it equal to the attribute of our
max health.
So the attribute to capture will be max health.
The attribute source will be target and that's all we need for health.
We're going to do the same thing for Mana.
So I'm going to collapse that index and add another modifier.
This modifier is attribute will be mana.
The modifier op will be override modifier magnitude calculation type is going to be attribute based.
We'll expand this and our backing attribute is going to be Max Mana.
It's going to be from the target and that's it.
Now as soon as we start the game, we should have this gameplay effect applied as long as we set it
on aura.
So we need to go back to blueprints, character, aura, BP Aura, character, and we need to set that.
It's right here under attributes our default vital attributes.
If we didn't set this, we're doing a check there.
So we are asserting that we have this set.
So let's set it G or a vital attributes.
Now it's set.
We can save all.
And we can press play and look at that.
We have two nice big, beautiful full globes of health and mana.
And if we go ahead and show debug, well, I don't really see health or mana anymore, so show debug
is a little bit less useful these days, but we're good.
I trust it.
I think that my health and my mana are correct and we're going to verify that very soon by actually
showing things like the numerical values of our attributes in our UI elements.
So we'll be doing those things next.
But for now, great job and this is a good milestone.
You've learned a lot about gameplay effects.
We've learned a whole lot about the different modifiers and there are different types of magnitude calculation
types.
We learned about scalable float and attribute based.
We know about custom calculation class.
We don't know about that fourth one there set by caller.
So that's the one that we still need to learn.
We'll get to that in this course.
Don't worry, we're covering them all.
But it was a lot to learn just these three and you're a lot more powerful just knowing those three.
So it's just a testament to how useful and powerful gas is.
So congratulations on all we've learned so far, and it only gets better from here.
I'll see you in the next video.