Welcome back.
Now we have our ability types which now contains an effect context that's been souped up.
It's a great deal better new and improved.
And now we're going to use it well we're already kind of using it but not really.
You see we're not using it with our new capabilities, these new variables I'd like to set those.
So where are we going to do that.
Well if we go back to our exec calc.
Notice we left a to do there.
Let's go to exit calc damage cpp and we'll scroll until we find.
Determine debuff.
We have this function that determines whether we got a debuff and we have that information in be debuff.
But here's our to do.
What do we do.
Well we'd like to set some parameters on our effect context right.
So how can we get that effect context.
Well we have the spec here.
It's called spec.
Why don't we take that spec and just call get context that returns an gameplay effect context handle.
So we can store that in gameplay effect.
Context handle.
We'll call it context handle.
So now that we have the context we can call functions like you or ability system library is successful
debuff.
Well we also want a setter.
And I'm remembering now I just made the getters.
I didn't make the setter functions for these new variables.
So I'm really going to have to go back and do what I forgot to do the first time when we made these
getters, we should have made the setters.
You probably did.
So right down here under set is blocked hit.
I'm going to go ahead and make a setter.
I'll make it under set as critical hit and this will be for set is successful debuff.
So set is successful debuff.
And just like the other setters, we're going to have an gameplay effect context handle as an input,
but it's a reference, a non-const reference, and the new param ref allows us to put that as an input
parameter in this blueprint callable node.
Otherwise, Unreal Engine makes Non-const references out parameters in nodes, so the boolean will be
called be in.
We'll just say successful.
Debuff.
And we'll have other functions for setting the other parameters.
So I'm going to go ahead and just make the definition here for set is successful debuff.
And this is going to be similar to the other centers that we have.
Like set is critical hit.
I'm going to copy the contents of that.
Paste it here.
The difference is we're calling set is successful debuff on the effect context.
So we'll say set is successful debuff and pass in be in is successful debuff.
And now that this function exists our exec calc can call it.
So we can take your ability system library call set is successful debuff and pass in the context handle
and then pass in.
True because we know that it is a successful debuff.
So we're going to follow this pattern for the other key variables for debuff.
So we'll take Aura Ability System Library take set as successful debuff and make the functions for setting
debuff damage, debuff duration, debuff frequency and damage type.
So I'm going to go ahead and time lapse the creation of at least the three floats.
And then we'll talk about the gameplay tag damage type.
Okay, so pretty simple just setting floats instead of booleans.
But same principle here.
Now for the gameplay tag I want a function that can receive a gameplay tag.
So it's going to be a static void function called Set damage type.
It's going to take a u param passing in ref here, and that's for the context handle.
So we'll put that there.
But then I'd like to pass in a const f gameplay tag reference called n damage type.
So let's see how we'll handle this one.
Let's go ahead and generate the definition.
I'm going to copy the contents of set debuff frequency.
And once we get inside here where we have aura effect context.
If we type set damage type we don't have the function for it.
So let's take a look at aura ability types.
You might have handled this, but I didn't add a setter for it.
So I'm going to make a void function here called set damage type.
That takes in a shared pointer of type gameplay tag.
So f gameplay tag called in damage type and we'll simply set damage type to end damage type.
And now that we have this function in our ability system blueprint library, we're going to call set
damage type.
And what are we going to pass in to set damage type?
It needs to be a shared pointer.
Well, we can make one.
We can make one from the in damage type we can say t shared pointer using F gameplay tag.
I'll just call this damage type and we can use make shared not make shareable.
Make shared which requires the type.
So gameplay tag and we can initialize it within damage type.
So this will make a new shared pointer that we can pass in right here.
So now we have a function that can take in the damage tag, and we can pass it right in to set damage
type.
This can even be a const shared pointer.
So now that we have this we can go back and use our aura ability system library function or a ability
system library.
Set damage type passing in the context handle and damage type which we have access to here.
Now in addition to those we want to set those three float values.
So we got the setters.
Set debuff damage.
Set debuff duration.
Set debuff frequency.
We need to pass those in.
But where are those.
Well if you'll recall we set those.
We set them as tag set by caller magnitudes.
We did that in Aura Ability system library.
If we scroll all the way down.
At least mine's all the way at the bottom.
We assign tags set by color magnitude for all the debuff things in the spec handle here, so we can
actually get set by color magnitudes from the spec.
And that's what I'm going to do here.
I'm going to take this back and call get set by color magnitude.
Now we can pass in the game play tag and I need the game play tag.
Game play tags dot.
And it's going to be debuff.
We have damage duration and frequency.
We need to set those three.
So we're going to get those three.
I'm going to make a const float called Debuff Damage.
And we'll pass in the gameplay tag.
Debuff damage I don't want to warn if not found.
So I'm passing in false for that.
And the default if not found can be negative one point f.
So I have debuff damage.
I need duration and frequency.
So const float debuff duration.
And I'm just going to copy the function call paste it here, change that tag to debuff duration.
And I'll just copy the whole thing.
And paste it and this one will be debuff frequency and the tag will be debuff frequency.
Now that we have those three values now we can set them on the effect context.
So we're going to say you or a ability system library set debuff damage passing in the context handle
and debuff damage.
And we'll also call the other two functions set Debuff duration.
We'll pass in context Handle and debuff Duration and frequency.
So set Debuff frequency passing in the handle and debuff frequency.
So that's what we do to do.
That's what we do.
So we fixed our to do.
We've done it.
And now this effect context handle associated with this gameplay effect is carrying this information
through.
And we can get it by the time we get all the way back into our attribute set.
So I'm going to go into the attribute set or attribute set and we can handle debuff.
So right here when we're getting our incoming we'll go to the incoming damage attribute.
We're doing lots of things, including show floating text, right?
We can also handle debuffs.
We can check the effect context.
We can say if and we can call you or ability system library is successful.
Debuff passing in props dot effect context handle.
Because we have that then we can say handle debuff.
And with that I'd like to make a function because this is getting out of hand as well.
So actually look around.
This place is filthy.
Let's clean it up right.
Handling health and mana.
We're only doing one thing each, but handling the incoming damage.
We're doing kind of a lot of stuff.
This is something that could be its own function.
So what I'd like to do is handle incoming damage in its own function and handle incoming exp in its
own function.
So I'm going to close all but this.
Oops.
I closed all tabs.
That's okay.
Go back to the aura attribute set and open the H file.
Scroll all the way down and I'm going to have a couple more functions here.
I'll put them in the private section.
They're internal to this class.
And I'm going to call this first one handle incoming damage.
And this can just take a const f effect properties reference called props.
All the information I need is in props.
I'm also going to make a void handle incoming exp that takes the same input.
Props.
So I can go ahead and generate two function definitions.
Here they are.
And I'm going to cut and paste them so that they're closer to post gameplay effect execute.
So I'm going to search for post.
Here it is.
I'm going to put them right under it.
Now handle incoming damage.
That's going to be these lines of code here.
So I'm going to paste them in here.
Now we shouldn't have to change anything because we're calling it props.
And we can replace those lines of code.
By calling.
Handle incoming damage.
Passing in props.
Handle incoming XP.
I could be even more Uber and Control X instead of control C, control V and paste it in to handle incoming
XP, and I can call handle incoming XP passing in.
You guessed it props.
So post gameplay effect execute looks better, and we're handling incoming damage in XP in these functions,
which are more isolated now.
So when we handle incoming damage, if we got a successful debuff, I want to handle the debuff.
So I want a debuff function.
And I'd like that function to take some props as well.
So I'm going to go in to the private section make void debuff which takes in some props.
And it's going to handle what we do when we debuff.
So we're getting closer.
Ryder gave me an inline definition.
Thanks, Ryder for nothing.
I'm going to put it back in the cpp file where I want it.
And I'm going to call debuff right here.
Passing in props.
Debuff handled.
Actually, no, it's not because it's an empty.
Function.
But now we're ready to.
Handle it right.
We're ready to handle debuffs.
And that's going to be the next thing we do.
Now I want you to start thinking about how we're going to handle debuffs.
What exactly are we going to do?
How are we going to handle debuffs?
What are debuffs?
Well, I know that when I cause fire damage, I want to burn my enemies.
I want them to take fire damage every second for a duration, right?
Every debuff frequency until we're done.
So I want to apply a gameplay effect is what I'm trying to say.
So think about it.
How can we apply a gameplay effect from right here in this line of code?
Well, don't go and implement it just yet, because the way we're going to do this is different than
anything else we've done so far.
And you'll find out in the next video of this course.
So I'll see you then.