Welcome back.
Now we just created three new gameplay tags.
If we go to project settings and open gameplay tags, we can see under abilities we have passive and
we have Halo of protection, life siphon, and mana siphon.
Now, if we're going to have passive abilities, we should have a class for them.
So I'm going to make a new Cplusplus class for our passive gameplay ability.
So I'm going to go into our ability system abilities folder, and we'll just make a new Cplusplus class.
Here I'm going to choose all classes and search for aura gameplay ability.
So this will be an aura gameplay ability, not an Aura damage ability.
Although that's not to say that we can't cause damage with passive abilities, it's just not going to
be based on that class.
So I'm going to click next and call this aura Passive Ability, and this will be the base class for
our passive abilities.
We'll go ahead and create this class and close the editor.
Now I'm done with aura gameplay tags and I can open my new Aura passive ability dot h and get that CP
file open as well.
So this will be for our passive spells.
It doesn't necessarily have to be a base class for every passive ability we make, but I'm going to
designate this for our spells specifically and for our spells.
The way that I'd like these to behave is I'd like to activate them and keep them active until I manually
deactivate them in response to something in the game.
And that's something will be assigning these abilities to slots in our spell menu.
So the first thing I'm going to do is make a public section, and I'm going to override activate ability
so we can determine what these passive abilities do when they become active.
So we're going to override virtual void activate ability.
And if I let autocomplete fill this in it gives me all the input parameters the ability spec handle,
the gameplay ability actor info, the gameplay ability activation info, and the gameplay event data.
So we have that we can go ahead and generate the definition for activate ability, and we can go ahead
and let this call super, and we can continue with any logic that we want executed as soon as the ability
becomes active.
Now, I'd like to be able to deactivate one of my passive abilities at any point in time, and I'd like
to be able to do this from my ability system component, as the ability system component has control
over things as soon as we manage icons in our spell menu.
So my ability system component is going to broadcast a delegate to end this gameplay ability and really
any gameplay ability that we wish to end.
And I'd like to be able to do this by gameplay tag for the ability tag.
So I'm going to open my Aura Ability System component.
And here in the ability system component, I'm going to declare a new delegate.
Now I plan on binding to this delegate from within Cplusplus.
So I'm going to declare a multicast delegate.
With only one param.
And I'm going to call this f deactivate passive ability.
And we'll give it a const F gameplay tag.
By reference, of course.
And for a multicast, we don't say the name of the parameter, but we can go ahead and give it a inline
comment like this.
So we know that this is the ability tag.
So our Ask our ability system component can have this deactivate passive ability.
We can put this down here.
We can make one of these called deactivate passive ability in the public section.
And then our passive abilities as soon as they become active can bind to that delegate.
And they can have a callback function for ending themselves.
So that's how I'd like to treat this.
So an aura passive ability.
I'm going to have my callback that I want to bind to this delegate that our ability system component
eventually will broadcast.
So I'm going to make a void function and I'm going to call this receive deactivate.
And this will take a const f gameplay tag, of course, by reference called Ability tag.
And I'd like our passive abilities to have their own ability tag in their ability tags container.
And we'll check the ability tag passed into this delegate against our own ability tags.
So that's how I'm going to do this.
I'm going to say if ability tags, because our gameplay ability has access to its ability tags and we
can check has tag exact.
This will see if those ability tags have this tag we're checking for.
And it's going to be ability tag.
So if that's the case then we can simply call end ability.
So the ability can end itself now.
End ability requires five inputs.
The first is the spec handle, and we can pass in current spec handle as abilities have access to their
current spec handle.
Next is game play ability, actor info and abilities also have access to their current actor info as
well, so we can get current actor info and pass that in.
Next is the activation info and again we have current activation info at our disposal.
Next is replicate end ability.
Yes, I want that end ability action replicated.
And there's a bool for whether or not we cancel this ability we can say true.
Yeah sure.
We canceled the ability.
And this was initiated from the ability system component.
Now we have a callback, but we haven't actually bound it to the ability system component.
And that's what I'd like to do as soon as the ability becomes active.
So we'll do it in activate ability.
We'll wrap this in an if statement and we'll get our ability system component from the actor info,
and we'll cast it so we can create a new Aura ability system component.
That's a pointer.
There's our include for that header.
And I'm going to call it Ora ASC.
And I'm going to set it equal to the result of a cast to this type you or ability system component.
And what I'm going to cast will be what I get from the ability system library function you ability system
blueprint library get ability system component.
And we'll pass in the avatar actor, which we can get with get avatar actor from actor info.
So this is all wrapped in an if statement, and if we make it to the inside, we get a successful cast
and we can bind to that ability.
So we can take Ora ASC and get that deactivate passive ability and we can bind to it.
We can add you object.
So this will be the user object.
And.
We'll pass in the address of our callback function and it should be bound to it.
So when deactivate passive ability is broadcast, this passive ability will end itself if that delegate
broadcasts the correct ability tag.
And with that we have a passive ability.
So we have the basic class for a passive spell.
And this is what will make our passive spells with.
And we'll start that in the next video.
I'll see you soon.