WEBVTT

00:06.910 --> 00:07.930
Welcome back.

00:07.930 --> 00:10.600
Now we just created three new gameplay tags.

00:10.600 --> 00:17.560
If we go to project settings and open gameplay tags, we can see under abilities we have passive and

00:17.560 --> 00:21.700
we have Halo of protection, life siphon, and mana siphon.

00:22.030 --> 00:26.740
Now, if we're going to have passive abilities, we should have a class for them.

00:26.740 --> 00:32.320
So I'm going to make a new Cplusplus class for our passive gameplay ability.

00:32.320 --> 00:38.500
So I'm going to go into our ability system abilities folder, and we'll just make a new Cplusplus class.

00:38.500 --> 00:44.560
Here I'm going to choose all classes and search for aura gameplay ability.

00:44.560 --> 00:48.700
So this will be an aura gameplay ability, not an Aura damage ability.

00:48.700 --> 00:54.100
Although that's not to say that we can't cause damage with passive abilities, it's just not going to

00:54.100 --> 00:55.540
be based on that class.

00:55.540 --> 01:02.590
So I'm going to click next and call this aura Passive Ability, and this will be the base class for

01:02.590 --> 01:03.790
our passive abilities.

01:03.790 --> 01:07.480
We'll go ahead and create this class and close the editor.

01:07.840 --> 01:17.320
Now I'm done with aura gameplay tags and I can open my new Aura passive ability dot h and get that CP

01:17.350 --> 01:19.240
file open as well.

01:19.480 --> 01:22.030
So this will be for our passive spells.

01:22.030 --> 01:27.910
It doesn't necessarily have to be a base class for every passive ability we make, but I'm going to

01:27.910 --> 01:33.040
designate this for our spells specifically and for our spells.

01:33.040 --> 01:40.000
The way that I'd like these to behave is I'd like to activate them and keep them active until I manually

01:40.000 --> 01:44.290
deactivate them in response to something in the game.

01:44.410 --> 01:51.190
And that's something will be assigning these abilities to slots in our spell menu.

01:51.640 --> 01:57.970
So the first thing I'm going to do is make a public section, and I'm going to override activate ability

01:57.970 --> 02:03.700
so we can determine what these passive abilities do when they become active.

02:03.700 --> 02:07.420
So we're going to override virtual void activate ability.

02:07.420 --> 02:14.980
And if I let autocomplete fill this in it gives me all the input parameters the ability spec handle,

02:15.010 --> 02:22.720
the gameplay ability actor info, the gameplay ability activation info, and the gameplay event data.

02:22.720 --> 02:28.480
So we have that we can go ahead and generate the definition for activate ability, and we can go ahead

02:28.480 --> 02:36.760
and let this call super, and we can continue with any logic that we want executed as soon as the ability

02:36.760 --> 02:38.110
becomes active.

02:38.230 --> 02:45.100
Now, I'd like to be able to deactivate one of my passive abilities at any point in time, and I'd like

02:45.100 --> 02:50.590
to be able to do this from my ability system component, as the ability system component has control

02:50.590 --> 02:54.550
over things as soon as we manage icons in our spell menu.

02:55.290 --> 03:03.150
So my ability system component is going to broadcast a delegate to end this gameplay ability and really

03:03.150 --> 03:05.760
any gameplay ability that we wish to end.

03:05.910 --> 03:10.400
And I'd like to be able to do this by gameplay tag for the ability tag.

03:10.410 --> 03:14.820
So I'm going to open my Aura Ability System component.

03:16.760 --> 03:21.440
And here in the ability system component, I'm going to declare a new delegate.

03:22.010 --> 03:25.640
Now I plan on binding to this delegate from within Cplusplus.

03:25.640 --> 03:30.230
So I'm going to declare a multicast delegate.

03:33.100 --> 03:34.840
With only one param.

03:35.940 --> 03:41.130
And I'm going to call this f deactivate passive ability.

03:42.550 --> 03:46.570
And we'll give it a const F gameplay tag.

03:48.640 --> 03:50.260
By reference, of course.

03:50.260 --> 03:58.570
And for a multicast, we don't say the name of the parameter, but we can go ahead and give it a inline

03:58.570 --> 03:59.890
comment like this.

03:59.890 --> 04:02.470
So we know that this is the ability tag.

04:02.530 --> 04:08.370
So our Ask our ability system component can have this deactivate passive ability.

04:08.380 --> 04:10.180
We can put this down here.

04:10.540 --> 04:15.760
We can make one of these called deactivate passive ability in the public section.

04:15.760 --> 04:21.520
And then our passive abilities as soon as they become active can bind to that delegate.

04:21.610 --> 04:26.020
And they can have a callback function for ending themselves.

04:26.260 --> 04:28.410
So that's how I'd like to treat this.

04:28.420 --> 04:30.250
So an aura passive ability.

04:31.540 --> 04:38.590
I'm going to have my callback that I want to bind to this delegate that our ability system component

04:38.590 --> 04:40.240
eventually will broadcast.

04:40.240 --> 04:45.130
So I'm going to make a void function and I'm going to call this receive deactivate.

04:46.490 --> 04:52.250
And this will take a const f gameplay tag, of course, by reference called Ability tag.

04:53.740 --> 04:59.860
And I'd like our passive abilities to have their own ability tag in their ability tags container.

04:59.980 --> 05:05.410
And we'll check the ability tag passed into this delegate against our own ability tags.

05:05.440 --> 05:07.270
So that's how I'm going to do this.

05:07.270 --> 05:14.530
I'm going to say if ability tags, because our gameplay ability has access to its ability tags and we

05:14.530 --> 05:16.900
can check has tag exact.

05:16.930 --> 05:21.670
This will see if those ability tags have this tag we're checking for.

05:21.670 --> 05:23.650
And it's going to be ability tag.

05:24.100 --> 05:27.850
So if that's the case then we can simply call end ability.

05:29.180 --> 05:31.550
So the ability can end itself now.

05:31.580 --> 05:34.720
End ability requires five inputs.

05:34.730 --> 05:41.960
The first is the spec handle, and we can pass in current spec handle as abilities have access to their

05:41.960 --> 05:43.280
current spec handle.

05:43.550 --> 05:50.510
Next is game play ability, actor info and abilities also have access to their current actor info as

05:50.510 --> 05:53.750
well, so we can get current actor info and pass that in.

05:53.780 --> 06:00.080
Next is the activation info and again we have current activation info at our disposal.

06:00.110 --> 06:02.630
Next is replicate end ability.

06:02.660 --> 06:06.260
Yes, I want that end ability action replicated.

06:06.260 --> 06:11.360
And there's a bool for whether or not we cancel this ability we can say true.

06:11.390 --> 06:12.110
Yeah sure.

06:12.110 --> 06:13.640
We canceled the ability.

06:13.640 --> 06:16.910
And this was initiated from the ability system component.

06:16.940 --> 06:22.160
Now we have a callback, but we haven't actually bound it to the ability system component.

06:22.160 --> 06:26.120
And that's what I'd like to do as soon as the ability becomes active.

06:26.150 --> 06:28.310
So we'll do it in activate ability.

06:28.400 --> 06:35.060
We'll wrap this in an if statement and we'll get our ability system component from the actor info,

06:35.060 --> 06:40.220
and we'll cast it so we can create a new Aura ability system component.

06:42.960 --> 06:44.190
That's a pointer.

06:44.220 --> 06:46.530
There's our include for that header.

06:46.530 --> 06:48.360
And I'm going to call it Ora ASC.

06:48.930 --> 06:55.440
And I'm going to set it equal to the result of a cast to this type you or ability system component.

06:55.440 --> 07:03.810
And what I'm going to cast will be what I get from the ability system library function you ability system

07:04.470 --> 07:08.400
blueprint library get ability system component.

07:08.400 --> 07:14.070
And we'll pass in the avatar actor, which we can get with get avatar actor from actor info.

07:14.130 --> 07:19.890
So this is all wrapped in an if statement, and if we make it to the inside, we get a successful cast

07:19.890 --> 07:22.290
and we can bind to that ability.

07:22.290 --> 07:29.070
So we can take Ora ASC and get that deactivate passive ability and we can bind to it.

07:29.100 --> 07:31.020
We can add you object.

07:32.140 --> 07:34.720
So this will be the user object.

07:34.720 --> 07:35.860
And.

07:36.360 --> 07:41.190
We'll pass in the address of our callback function and it should be bound to it.

07:41.370 --> 07:49.380
So when deactivate passive ability is broadcast, this passive ability will end itself if that delegate

07:49.380 --> 07:51.830
broadcasts the correct ability tag.

07:51.840 --> 07:55.440
And with that we have a passive ability.

07:55.860 --> 08:00.270
So we have the basic class for a passive spell.

08:00.270 --> 08:03.810
And this is what will make our passive spells with.

08:04.530 --> 08:06.810
And we'll start that in the next video.

08:06.840 --> 08:08.010
I'll see you soon.
