Welcome back.
Now, so far, all of our gameplay effects are using scalable float for their modifier magnitudes.
For example, if I open actor and potion and potion heal and I scroll down, I can see that right here
I have a single modifier.
It's modifying the health attribute, it's adding to it, and the modifier magnitude calculation type
is set to scalable float.
Now the dropdown shows us three other options and attribute based is the next one After scalable float
and attribute based is quite an interesting and useful option for magnitude calculation type.
It's actually very cool and it gives us the ability to have an attribute change based on other attribute
values.
This can make it really easy to have an attribute that is derived from other attributes.
So in order to see how attribute based gameplay effects work, I'd like to make a new effect.
Actor That applies a test effect that uses attribute based modifier magnitude calculation types.
So let's go ahead and create one of those.
So first here in Actor, I'm going to make a new folder called Test Actor.
And here in test actor I'm going to make an effect.
Actor And a gameplay effect.
So I'll start with the effect.
Actor Searching for aura effect Actor.
And I'll call this BP underscore test actor.
I'm going to open it up and I'm going to give it a.
Box collision.
And here in the event graph with the box selected, I'm going to use on component began overlap.
And we'll call apply effect to Target.
So we'll go ahead and hook these up.
And I'd like to make a gameplay effect to apply and we can just make it an instant gameplay effect.
So I'm going to get the instant gameplay effect class and we can make a gameplay effect and apply that.
Now for testing purposes, I'm going to make the box a little bit more visible.
I'm going to select my box and set my line thickness to something a little bigger.
Perhaps five, and I'm going to search for the rendering section and uncheck Hidden in game.
Compile save and now I have my test actor and I can just drag one in right here.
Now we just need an effect to apply.
So let's make that I'm going to create a new blueprint class.
Gameplay Effect.
And I'll call this GE underscore test.
Attribute based.
And open that up and we'll go ahead and configure this.
But first I'm going to go to my test actor and set its instant gameplay effect.
So all the way up at the top we have instant gameplay effect class.
It's going to be GE test attribute based.
We don't care about the instant effect application policy because we're just calling apply effect to
target directly.
Okay.
So now we can configure this gameplay effect.
It's going to be an instant gameplay effect.
So all we need to care about here is adding a modifier.
And if I click plus to add a new modifier, I can expand it.
I can choose an attribute.
I think I'll go ahead and choose the health attribute.
And for modifier OP, we can leave it at Add.
And for modifier magnitude, I'm going to expand it and for the magnitude calculation type instead of
scalable float, I'm going to choose attribute based.
Now, as soon as I do that, suddenly we have this attribute based magnitude which we can expand and
we have quite a few options here and we're going to discuss all of these.
But for now, just ignore the first three.
We'll talk about these shortly, but take a look at backing attribute, expand that and we have the
option to choose an attribute to capture and we can choose the attribute source.
You see, this gameplay effect is going to be caused by something to something so we can capture the
attribute from the source or the target.
Now I'm going to choose Target because we're applying this gameplay effect to Aura when she overlaps
with it.
So I'm going to capture attributes from Aura.
Now we'll talk more about Snapshot later in the course.
It has to do with when to capture the attribute, when should we use that attributes value?
Should we use it when the gameplay effect spec that caused this gameplay effect was created or when
it was applied?
Snapshot determines when exactly we'll be capturing that attribute.
We're going to leave it unchecked for now, but we're not really going to discuss it until we have a
situation more appropriate to consider it.
Now, for the backing attribute, we can choose an attribute, and since I chose Target for the attribute
source, then we know that we'll be taking that attribute from Aura as soon as she overlaps with our
box component on Test Actor.
And if I choose one of my attributes, for example, the vigor attribute, then by default, all we're
going to do is add Since our modifier op is Add, we're going to add the value of vigor to our health.
So let's see this in action.
I'm going to go back and press play.
I'm going to show debug ability system and I see that my health is 50 and my vigor is nine.
So as soon as I overlap with this volume, now I see that my health is 59.
Why?
Because we had vigor added to it.
We had the value of vigor added to it.
So that seems simple enough, right?
But the thing is, with all these options, this can get complicated very quickly and we know that we
can add multiple modifiers.
For example, what if I collapse this index for my modifiers and I click plus on the modifiers bar one
more time?
Now we have two elements in this array, and if I expand this one, I can choose to have another modifier.
Now let's say I choose health again.
So I have two modifiers modifying my health and I can leave this as Add.
And let's say that I expand modifier magnitude, I change the calculation type to attribute based.
I expand attribute based magnitude and expand backing attribute, and this time choose a different attribute
like strength.
And I choose the attribute source to be target.
So now I'm going to collapse this.
My modifiers array has two elements in it.
They're both set to add for their modifier OP, but the first one is backed by the attribute vigor.
The second is backed by the attribute strength.
Now you would just expect to have vigor and strength added to our health.
Well, let's see if that's the case.
I see that my health is 50, vigor is nine and strength is ten.
So if I overlap now, my health is 69.
It was 50.
We added nine and we added ten.
That equals 69.
So it works as expected.
Now, when all of our modifier operations are just Add, then it's pretty intuitive.
We just add them all together.
But it's important to understand exactly how these modifiers work and how the order is taken into account.
So we're going to have a more in depth conversation about how these modifiers are applied and how it
works depending on what the modifier operation is.
And after we do that, we're going to then start talking about these additional parameters coefficient
pre-multiply, additive, post-multiply additive and so on, so that we understand completely how all
of these things work.
So in the next video we're going to take a deep dive looking at the modifiers and the order of operations,
depending on what our modifier ops are set to.
So we'll do that next and I'll see you soon.