WEBVTT

00:06.960 --> 00:12.000
Now in this video, we're about to make some really cool stuff happen.

00:12.300 --> 00:18.780
As soon as we click on one of these and click on Equip, our spell menu is waiting for us to click on

00:18.780 --> 00:19.830
one of these.

00:20.040 --> 00:28.680
What happens when we do that is going to result in making some significant changes to our abilities.

00:28.830 --> 00:34.980
We're going to either change their input tag or we're going to assign a new tag to them and they're

00:34.980 --> 00:37.770
now going to be something we can activate.

00:38.310 --> 00:44.520
So this is a big step in our RPG game and we're going to make it happen.

00:45.320 --> 00:49.310
Now with this step comes a couple of complexities.

00:49.340 --> 00:52.870
For one, we need to handle certain things.

00:52.880 --> 01:00.180
When we select an ability that's already in our spell row and hit, equip and then click somewhere else.

01:00.200 --> 01:07.170
Well, now we need to reassign that input tag and we have to clear where it was before.

01:07.190 --> 01:10.280
In other words, we need to remember where it was.

01:10.310 --> 01:13.160
In that case, so we can go back and clear it.

01:13.190 --> 01:15.170
That's a little bit of a challenge.

01:15.720 --> 01:22.260
We also want to make sure that when we change down here, we need to change out here as well, because

01:22.260 --> 01:27.000
both of these are a reflection of our abilities and they need to be consistent.

01:27.120 --> 01:32.310
So we'll keep all these things in mind as we accomplish this feat.

01:32.340 --> 01:35.550
Let's close the editor and let's make this happen.

01:36.180 --> 01:41.680
The first thing I'm going to do is go back to equip button pressed an equip button pressed.

01:41.700 --> 01:48.210
I'm going to check to see if our currently selected ability has the status of equipped.

01:48.880 --> 01:54.280
And if it does, I'm going to save its input tag so we know the slot that it's in.

01:54.430 --> 02:00.430
So I'm going to make a gameplay tag variable to store the selected slot.

02:00.460 --> 02:06.070
I'm going to call them slots while I'm in the spell menu because these are the input tags that have

02:06.070 --> 02:08.800
been assigned a slot in the menu.

02:08.830 --> 02:09.700
Make sense.

02:09.700 --> 02:14.230
So I'm going to make a private gameplay tag.

02:15.020 --> 02:19.430
So f game play tag and I'm going to call it selected slot.

02:23.750 --> 02:28.940
Now selected slot is going to be set as soon as I click the equip button pressed.

02:28.970 --> 02:37.550
If our selected ability that we have selected, if the currently selected ability has the status of

02:37.550 --> 02:38.480
equipped.

02:38.720 --> 02:41.750
So I can remember what that slot is.

02:41.780 --> 02:46.790
And if we choose a different one, we can clear the previously selected slot.

02:46.970 --> 02:49.970
So what I'm going to do is get that status.

02:49.970 --> 02:54.080
I'm going to make a const F gameplay tag called status.

02:54.740 --> 02:58.700
We can also call it selected status if we want to be more specific.

03:00.820 --> 03:05.530
And this is going to be the status that we get from our ability system component.

03:05.770 --> 03:08.740
We need to get the status for that ability.

03:08.770 --> 03:11.650
Now, if we call, get or ask.

03:14.160 --> 03:15.750
And type get status.

03:15.780 --> 03:22.140
We only have get status from spec, so we have to get the ability spec first and then get the ability

03:22.140 --> 03:22.770
tag.

03:22.770 --> 03:29.460
Unless of course we create a convenient function that can get the status from the ability tag.

03:29.610 --> 03:35.160
At this point, since I'm doing this for the second time, I believe I'm going to go to our ability

03:35.160 --> 03:40.860
system component and make an easy to use function that can return the status.

03:41.010 --> 03:44.220
So this function will return an gameplay tag.

03:44.220 --> 03:50.450
It can't be static as we need to call get status from spec, which is a member variable.

03:50.460 --> 03:57.270
So we're going to call this get status from ability tag and it's going to take a const gameplay tag

03:57.270 --> 03:59.760
called ability tag as an input.

04:00.000 --> 04:02.370
So let's generate this function.

04:02.900 --> 04:11.780
And first I'm going to check to see if the const gameplay ability spec pointer that I get from the function

04:11.780 --> 04:17.120
get spec from ability tag passing in ability tag is a null pointer.

04:17.630 --> 04:24.260
If it's not null, then I can simply return get status from spec passing in spec.

04:24.260 --> 04:28.490
But if it is a null pointer I have to return an f gameplay tag.

04:32.980 --> 04:37.300
And of course spec has to be referenced if we pass it in there.

04:37.480 --> 04:40.260
So now we have git status from ability tag.

04:40.270 --> 04:45.190
Let's go back to spell menu widget controller and just call that.

04:45.700 --> 04:49.300
Passing in the ability tag of our selected ability.

04:49.300 --> 04:50.770
So selected ability.

04:50.840 --> 04:51.970
Dot ability.

04:52.240 --> 04:55.630
So now that our selected status is known.

04:55.750 --> 04:57.700
I'm going to check that status.

04:57.910 --> 05:01.030
So I'm going to say if selected status.

05:02.300 --> 05:07.910
Dot matches tag exact and I'm going to check against for a gameplay tags.

05:10.980 --> 05:12.600
Abilities, status equipped.

05:12.690 --> 05:14.310
I want to know if it's equipped.

05:14.310 --> 05:19.980
If it is, I'm going to save that slot as we have now a selected slot.

05:20.010 --> 05:21.380
I'm going to set that here.

05:21.390 --> 05:26.850
I'm going to say selected slot equals and we need to get that slot.

05:26.880 --> 05:28.950
So we're going to use get or ask.

05:32.210 --> 05:35.840
And the function we want to call is get input tag from spec.

05:35.840 --> 05:37.760
But we don't have the spec, do we?

05:38.120 --> 05:42.270
It'd be nice if we had get input tag from ability tag.

05:42.290 --> 05:44.340
So let's make that function too.

05:44.360 --> 05:47.540
So we'll go back to our ability system component.

05:47.630 --> 05:53.780
We'll have one that returns a gameplay tag called get input tag from ability tag.

05:53.810 --> 05:56.360
These are all good functions to have.

05:58.910 --> 06:01.400
So let's generate this function definition.

06:02.310 --> 06:04.210
And this one will be similar.

06:04.230 --> 06:07.390
We're going to get our slot from the spec, right?

06:07.410 --> 06:12.510
We can say if const F actually I'll just copy this.

06:12.540 --> 06:14.430
It's the same thing almost.

06:15.140 --> 06:17.690
We'll get the ability spec check it.

06:17.690 --> 06:22.160
If it's not null, we're going to return our input tag from the spec.

06:22.160 --> 06:26.540
Get input tag from spec passing in a dereferenced spec.

06:26.720 --> 06:27.680
That's it.

06:27.710 --> 06:30.450
So now we have get input tag from ability tag.

06:30.470 --> 06:32.390
Just a convenience function.

06:32.420 --> 06:40.610
So we're going to call that get input tag from ability tag passing in selected ability dot ability.

06:42.080 --> 06:51.170
Okay, so now when we click the equip button, we're saving the selected slot or the input tag of our

06:51.170 --> 06:54.490
currently selected ability if it's an equipped ability.

06:54.500 --> 06:57.680
Otherwise it doesn't really have an input tag, right?

06:57.710 --> 06:59.120
So that's important.

06:59.120 --> 07:00.770
We'll keep track of that.

07:01.130 --> 07:04.370
We also know that we're waiting for an equip selection.

07:04.730 --> 07:10.100
So when our user actually makes a selection, we need to handle it.

07:10.130 --> 07:17.090
When they click on one of the spell globes and the equipped spell row icon, we need to handle that.

07:17.090 --> 07:19.970
So let's make a blueprint callable function for that.

07:20.690 --> 07:25.730
We'll make it void and it's going to be called spell row globe pressed.

07:28.090 --> 07:34.690
Now, when we press one of those globes in the equipped spell row, we need to know what the slot tag

07:34.690 --> 07:37.990
is, what's the input tag for that particular globe.

07:38.050 --> 07:42.640
And we need to know the ability type, whether it's offensive or passive.

07:42.640 --> 07:44.620
So we need to gameplay tags.

07:44.620 --> 07:51.760
So const gameplay tag reference, we'll call it slot tag and const gameplay tag reference and we'll

07:51.760 --> 07:53.470
call it ability type.

07:54.590 --> 07:56.690
We need to know both of those things.

07:56.690 --> 07:59.330
So let's generate this definition.

08:00.810 --> 08:02.760
Now, what are we going to do here?

08:03.320 --> 08:07.010
Well, if we're not waiting for an equipped selection, we should return.

08:07.100 --> 08:13.210
We don't really want to do anything, so we're going to say, if not, be waiting for equip selection,

08:13.220 --> 08:14.630
simply return.

08:14.990 --> 08:22.940
Now, another reason to return right here is if we're trying to assign an offensive ability to a passive

08:22.940 --> 08:24.770
slot and vice versa.

08:25.070 --> 08:26.360
We don't want to do that.

08:26.360 --> 08:36.620
I'm actually going to make a comment here that says check selected ability against the slots ability

08:36.620 --> 08:47.840
type and then in parentheses don't equip an offensive spell in a passive slot and vice versa.

08:49.810 --> 08:51.790
We'll put this on two lines.

08:53.690 --> 08:55.310
So how do we check that?

08:55.700 --> 09:00.140
Well, we get the selected ability type, so const f gameplay tag.

09:01.800 --> 09:08.310
Selected ability type and we get that from ability info.

09:10.420 --> 09:16.000
We findability info for tag using our selected ability ability.

09:17.100 --> 09:26.160
And we get the ability type from that and we check if selected ability type dot matches tag exact against

09:26.160 --> 09:29.490
our ability type for the globe that we're pressing.

09:30.720 --> 09:32.820
So this is true.

09:32.820 --> 09:39.480
If we're pressing on a globe that's the same ability type as our selected ability type, that's okay.

09:39.510 --> 09:41.760
What's not okay if they're not the same?

09:41.760 --> 09:45.090
So we'll put a negation operator and return.

09:45.090 --> 09:50.130
In that case, Actually, I don't really need this to be in a function body.

09:50.130 --> 09:51.780
We'll just put it all on one line.

09:53.520 --> 09:55.770
So we'll return in that case too.

09:55.770 --> 10:02.310
If we make it past this point, then we have an ability selected from one of our trees.

10:02.310 --> 10:05.400
We've pressed the equip button, so we're waiting for a selection.

10:05.400 --> 10:09.600
And then we've pressed one of the globes in our equip spells row.

10:09.600 --> 10:15.540
And at this point it's time to let the server know we're trying to do something important here.

10:15.660 --> 10:22.470
We're trying to reassign an ability to a new slot or assign it for the first time.

10:22.590 --> 10:29.430
This is important enough for the server to know, so the ability system component needs a server RPC

10:29.520 --> 10:31.320
to equip an ability.

10:31.320 --> 10:38.610
So at this point we go over to ability system component, the aura ability system component that is,

10:38.610 --> 10:41.790
and we make a public function that's a server RPC.

10:42.120 --> 10:48.600
We'll put it just under server spin spell point and this will be void server equip ability.

10:49.950 --> 10:52.170
Now, this needs a couple of tags.

10:52.170 --> 10:56.270
It needs a const gameplay tag reference called ability tag.

10:56.280 --> 11:00.210
We need to know what the ability is and we need to know the slot.

11:00.240 --> 11:03.450
So we need const gameplay tag ref.

11:04.310 --> 11:05.090
Slot.

11:06.400 --> 11:08.080
That input tag, right?

11:08.170 --> 11:12.040
Now, this needs to be server and it needs to be reliable.

11:12.970 --> 11:14.710
We don't do this lightly.

11:14.860 --> 11:19.090
Let's generate the definition, the implementation version of this.

11:19.900 --> 11:22.870
And here is where we need to make some checks.

11:22.900 --> 11:29.920
So first of all, we need to check to make sure that the ability spec exists in our activatable abilities

11:29.920 --> 11:31.870
for this ability tag.

11:32.020 --> 11:34.560
Otherwise there's no point in continuing.

11:34.570 --> 11:38.410
So we're going to say if f gameplay ability spec.

11:40.670 --> 11:43.430
That's a pointer called ability spec.

11:44.030 --> 11:48.770
We're setting it with git spec from ability tag passing in the ability tag.

11:49.640 --> 11:54.530
If we don't make it this far, there's no point in doing anything else because we're trying to equip

11:54.530 --> 11:57.840
an ability that's not in our activatable abilities.

11:57.860 --> 12:01.520
If it's not at least eligible, in other words, locked.

12:01.520 --> 12:04.040
It's not in our activatable abilities.

12:04.070 --> 12:08.270
It's like it doesn't exist, and that's what we consider locked abilities.

12:08.300 --> 12:09.590
Now, here's the thing.

12:09.590 --> 12:13.370
We need to know this abilities input tag.

12:13.370 --> 12:19.640
And we're assuming that this ability, if it's already equipped, is going to get a new input tag.

12:19.640 --> 12:26.510
So the current input tag for this ability is the previous slot because we're about to change it.

12:26.510 --> 12:30.260
So we're going to say const gameplay tag ref.

12:30.970 --> 12:31.990
Previous slot.

12:31.990 --> 12:36.760
I'll just say prev slot and we're going to use get input tag from spec.

12:36.910 --> 12:41.560
We could get it from the tag too, but we're going to pass in the ability spec.

12:44.650 --> 12:45.550
Dereferencing it.

12:45.580 --> 12:46.360
Of course.

12:46.450 --> 12:48.510
Now we also want the status.

12:48.520 --> 12:50.800
We want to know what that status is.

12:51.990 --> 12:59.760
So we're going to make a gameplay tag called status, and that's going to be from get status from spec

12:59.760 --> 13:02.040
and we'll pass that spec right in.

13:04.660 --> 13:09.430
Now that we know the previous slot, it's still the current slot, but it's about to be the previous

13:09.430 --> 13:10.300
slot, right.

13:10.330 --> 13:15.460
We want to know if that status is either equipped or unlocked.

13:15.490 --> 13:21.490
If it's equipped or unlocked, then we can assign it to a new slot.

13:21.640 --> 13:29.560
Otherwise, it's either locked, which we should never get here if that's the case or it's eligible

13:29.740 --> 13:30.880
if it's eligible.

13:30.880 --> 13:32.500
We've never spent any points on it.

13:32.530 --> 13:34.750
We have no business trying to equip it.

13:34.900 --> 13:41.050
So what we can do is say const bool B status valid.

13:42.040 --> 13:50.500
And the only way the status is valid is if status is equal to and we need for a gameplay tags

13:52.960 --> 13:57.280
get dot abilities equipped.

13:57.960 --> 13:58.890
Or.

14:00.460 --> 14:02.740
Status is abilities unlocked?

14:03.800 --> 14:09.800
So we'll say or status equals abilities unlocked.

14:11.320 --> 14:17.590
That's the only way we have a valid status here, if it's locked or if it's eligible.

14:17.620 --> 14:22.210
We have no business trying to assign it to an input tag to a slot.

14:22.690 --> 14:29.440
Now, once we have that status and we know it's valid, we can check if B status valid.

14:29.470 --> 14:31.640
Now we need to do a few things.

14:31.660 --> 14:37.870
For one, any abilities that have this slot are now going to be cleared out.

14:37.900 --> 14:45.700
We need to get any abilities that have this particular input tag and clear them because we're pushing

14:45.700 --> 14:49.070
that ability out of its slot in favor of this one.

14:49.090 --> 14:50.430
We've just selected it.

14:50.440 --> 14:56.230
Let's say we already have an ability in the left mouse button slot and then we selected another one

14:56.230 --> 14:59.650
and now we're trying to equip it into the left mouse button slot.

14:59.680 --> 15:04.870
Well, that ability that was in the left mouse button slot needs to be cleared.

15:04.900 --> 15:08.080
So we need a function here that can do that.

15:08.230 --> 15:12.560
So let's do that here in our ability system component.

15:12.590 --> 15:14.570
We're going to have a new function.

15:15.140 --> 15:16.940
A couple functions, actually.

15:17.180 --> 15:24.140
For one, I want a function that can take an ability spec and remove its input tag and I'm going to

15:24.140 --> 15:25.440
call that clear slot.

15:25.460 --> 15:33.020
So I'm going to make a void function clear slot that takes an f gameplay ability spec.

15:33.590 --> 15:35.780
By Pointer and we'll call it spec.

15:36.140 --> 15:38.810
So I'm going to generate a definition for this.

15:38.840 --> 15:42.500
Now, all this function is going to do is first get its slot.

15:42.500 --> 15:49.850
So we're going to say F gameplay tag a const one called slot and that's going to be get input tag from

15:49.850 --> 15:54.830
spec passing in our Dereferenced spec pointer.

15:55.100 --> 16:01.970
So once we know that slot, then we can take the spec and get its dynamic ability tags and call remove

16:02.000 --> 16:03.070
tag from it.

16:03.080 --> 16:07.520
So we're going to remove the slot and as soon as we do that I want to force it to replicate.

16:07.520 --> 16:11.750
So I'm going to mark the ability spec as dirty passing in the spec.

16:11.780 --> 16:12.590
That's it.

16:12.590 --> 16:14.630
That's all I want to do for clear slot.

16:14.840 --> 16:20.930
Now I'd like a function that will clear any abilities we have of a given slot.

16:21.080 --> 16:25.580
So for that we'll make a function called clear abilities.

16:27.180 --> 16:28.230
Of slot.

16:28.260 --> 16:29.910
This will take a const.

16:30.880 --> 16:32.470
F game play tag.

16:32.770 --> 16:34.540
Ref called slot.

16:35.610 --> 16:44.220
So this is going to remove any input tags which are this particular slot from any of our gameplay abilities.

16:44.220 --> 16:51.840
So we're going to loop over our activatable abilities, which means we need an F scoped ability list

16:51.840 --> 16:54.060
lock called active scope lock.

16:57.370 --> 17:04.420
Passing in a dereference this pointer and we're going to loop over all of the ability specs in our activatable

17:04.420 --> 17:05.290
abilities.

17:05.530 --> 17:10.840
So for gameplay ability spec, we'll make it reference called spec.

17:10.870 --> 17:20.620
We'll use get activatable abilities and if that ability has this given slot I want to call clear slot

17:20.650 --> 17:21.360
on it.

17:21.370 --> 17:23.830
But how do we know if it has the slot?

17:23.860 --> 17:29.030
Well, I need a function that can easily tell me if an ability has a slot.

17:29.050 --> 17:36.580
So I'm going to make one more function that returns a bool called ability has slot and it's going to

17:36.580 --> 17:38.740
take the spec for the ability.

17:38.740 --> 17:47.560
We'll pass it in by pointer gameplay ability spec pointer called spec and a const gameplay tag called

17:47.560 --> 17:51.010
slot and it'll return a boolean.

17:51.900 --> 18:00.540
So for this function we'll return true if the given ability spec has the given slot and for that we

18:00.540 --> 18:04.350
have to loop over its dynamic ability tags.

18:04.380 --> 18:13.740
So for gameplay tag tag in spec dynamic ability tags if the tag dot matches tag.

18:16.170 --> 18:19.740
Exact for the slot will return.

18:19.740 --> 18:20.400
True.

18:22.460 --> 18:24.080
Otherwise we'll return.

18:24.080 --> 18:24.950
False.

18:28.400 --> 18:30.500
So now we have ability has slot.

18:30.530 --> 18:32.990
This can actually be a static function.

18:35.360 --> 18:38.480
And in clear abilities of slot.

18:38.510 --> 18:45.380
As we loop through all the specs and activatable abilities, we're going to check if ability has slot

18:45.410 --> 18:46.490
passing in.

18:46.490 --> 18:52.160
First of all the spec and we have to pass in the address of the spec and then the slot which we have

18:52.160 --> 18:52.910
here.

18:53.900 --> 18:59.930
And if the ability has the slot we're going to call clear slot on it, passing in the ability spec.

19:00.970 --> 19:05.170
And again by address because this takes a pointer.

19:05.290 --> 19:09.040
So clear abilities of slot loops through all the abilities.

19:09.040 --> 19:14.230
If they have the given input tag the slot, we're going to clear that slot, just remove it from their

19:14.230 --> 19:15.990
dynamic ability tags.

19:16.000 --> 19:24.490
So after we made those helpful functions we can come back to server equip ability and if we have an

19:24.490 --> 19:31.210
ability that's either equipped or unlocked and we're trying to assign it to a slot, what are we going

19:31.210 --> 19:31.600
to do?

19:31.600 --> 19:34.150
Well, first we're going to clear all abilities of that slot.

19:34.150 --> 19:39.220
So we're going to call clear abilities of slot passing in that slot.

19:39.610 --> 19:41.080
That's the first thing.

19:41.380 --> 19:51.610
So let's actually make a comment and say remove this input tag in parentheses slot from any abilities.

19:52.330 --> 19:56.800
We'll say any ability that has it because only one should have it.

19:56.830 --> 19:57.310
Now.

19:57.310 --> 20:03.980
In addition, we should also clear this abilities slot that we're trying to change, right?

20:03.980 --> 20:07.310
Because we're about to change its slot to something else.

20:07.310 --> 20:11.870
So I'm going to have another comment that says clear this ability.

20:13.100 --> 20:15.320
Slot this abilities slot.

20:15.350 --> 20:19.520
Just in case it's a different slot.

20:19.820 --> 20:23.780
So we're going to call clear slot on this ability spec.

20:25.360 --> 20:35.650
And now we'll say, now assign this slot to this ability or this ability to this slot, this ability

20:35.740 --> 20:39.730
to this slot, or maybe the other way around, whatever.

20:39.790 --> 20:45.970
We're going to take the ability spec, take its dynamic ability tags and add tag.

20:46.610 --> 20:47.630
This slot.

20:50.260 --> 20:54.160
Now there's something else we have to do if the status is unlocked.

20:54.160 --> 21:01.390
So we're going to say if status dot matches tag exact and we need to check to see if it's unlocked.

21:01.390 --> 21:08.560
So f or a gameplay tags get that ability status unlocked.

21:08.560 --> 21:13.030
And at this point I'm going to have a gameplay tags variable.

21:13.030 --> 21:15.250
So let's just do that right here.

21:15.370 --> 21:17.590
Const f or gameplay tags.

21:17.590 --> 21:24.310
Ref gameplay tags equals aura gameplay tags get and we'll use that.

21:26.220 --> 21:28.490
And replace it where we're calling.

21:28.500 --> 21:29.910
Get there and there.

21:29.910 --> 21:31.350
And down here.

21:32.990 --> 21:33.440
Okay.

21:33.440 --> 21:41.180
So if the status is unlocked, well, now we're assigning it to a slot so it's no longer going to be

21:41.180 --> 21:41.660
unlocked.

21:41.690 --> 21:45.470
We need to remove the unlocked tag and add the equipped tag.

21:45.470 --> 21:46.460
It's now equipped.

21:46.490 --> 21:47.780
We've promoted it.

21:47.780 --> 21:53.270
So we're going to take ability spec take its dynamic ability tags, call remove tag.

21:53.270 --> 21:56.690
We want to remove the unlocked tag.

21:57.140 --> 21:58.730
I just have it right here.

22:00.720 --> 22:07.760
And we want to add so ability spec dynamic ability tags, dot add tag.

22:07.770 --> 22:09.990
We want to add the equipped tag.

22:12.070 --> 22:16.330
Gameplay tags dot ability status equipped.

22:17.080 --> 22:22.420
Now when we called clear slot we marked the ability spec as dirty.

22:22.450 --> 22:29.080
Well, I'm going to actually do that up here with our ability spec.

22:30.470 --> 22:33.980
I want to mark it dirty here, but I'll leave it in clear slot.

22:34.010 --> 22:38.030
It doesn't matter if we call it twice, but just in case we clear it elsewhere.

22:38.120 --> 22:41.060
I just want to make it very clear that we're marking it dirty here.

22:41.060 --> 22:42.740
It won't make it replicate twice.

22:42.770 --> 22:51.710
Now we've just made major changes to this ability spec and we need our spell menu widget controller

22:51.710 --> 22:53.090
to know about it.

22:53.150 --> 23:02.000
We need to make a broadcast about our ability being equipped and this is done on the server here, which

23:02.000 --> 23:07.310
means we need a client RPC to call to get that information down to clients.

23:07.310 --> 23:10.130
So we're going to make a client RPC as well.

23:10.340 --> 23:16.790
So in addition to server equip ability, we're going to have a void function, client equip ability.

23:18.260 --> 23:23.740
And client equip ability is going to want to send the gameplay tag.

23:23.750 --> 23:25.970
Also send the new status.

23:26.180 --> 23:32.810
Also the new slot and the previous slot so that we can clear that out if we need to.

23:33.140 --> 23:35.960
So we're going to have several inputs.

23:36.010 --> 23:39.740
Const gameplay tag ref called ability tag.

23:43.230 --> 23:48.300
A const gameplay tag ref called status.

23:49.020 --> 23:55.260
A const gameplay tag for the slot as well and a const gameplay tag.

23:56.500 --> 23:58.300
For the previous slot.

24:00.370 --> 24:07.720
So for gameplay tags, the ability tag its status, its new slot and its old slot.

24:08.020 --> 24:10.630
So let's generate this definition here.

24:13.090 --> 24:15.640
And we need to call this function.

24:17.110 --> 24:18.100
Right here.

24:18.580 --> 24:25.030
So we're going to call it just outside this if statement, client equip ability, and we're going to

24:25.030 --> 24:27.070
pass the ability tag.

24:29.260 --> 24:32.170
We also know for sure that it's equipped now.

24:32.170 --> 24:36.310
So we're going to say gameplay tags, dot abilities.

24:36.340 --> 24:38.020
Status equipped.

24:38.200 --> 24:44.860
We need to pass that slot and we need to pass the previous slot which we cashed off before going and

24:44.860 --> 24:46.000
changing it.

24:46.240 --> 24:51.790
And client equip ability simply needs to let our widget controller know.

24:51.940 --> 24:58.990
So for that reason we're going to have a delegate to broadcast all four gameplay tags.

24:59.410 --> 25:00.940
So let's make that.

25:02.300 --> 25:05.990
So we're going to declare a multicast delegate.

25:08.500 --> 25:10.210
With four params.

25:10.750 --> 25:13.330
We'll call this f ability.

25:13.360 --> 25:14.350
Equipped.

25:17.060 --> 25:23.560
And we've been using the Convention on the ability system component to not put signature at the end.

25:23.570 --> 25:29.930
So we'll just keep up with that and we need const gameplay tag input parameters.

25:29.930 --> 25:33.650
And right here the first one can be the ability tag.

25:34.250 --> 25:38.150
Now the second one is going to be the status.

25:40.750 --> 25:43.900
The third one is going to be the slot.

25:45.900 --> 25:48.840
The fourth one will be the previous slot.

25:48.840 --> 25:50.970
So we'll say previous slot.

25:53.190 --> 25:54.390
And that's it.

25:54.480 --> 25:57.690
So we need to make one of these.

25:57.900 --> 26:00.720
We'll put it down here next to our other delegates.

26:00.810 --> 26:09.090
And this will be ability equipped and we'll broadcast this in client ability equipped.

26:09.120 --> 26:10.170
Here it is.

26:10.380 --> 26:19.800
So ability equipped broadcast and we'll broadcast ability tag status.

26:22.850 --> 26:25.130
Slot and previous slot.

26:26.650 --> 26:30.400
And now our widget controller just needs to subscribe to this.

26:30.430 --> 26:33.670
So let's make a callback function and spell menu.

26:33.670 --> 26:34.730
Widget controller.

26:34.750 --> 26:38.530
We could do a lambda, but trust me, we're going to need a function.

26:38.530 --> 26:44.270
So let's make one that takes four input parameters, all gameplay tags.

26:44.320 --> 26:48.820
So here in spell menu widget controller, we're going to have an on ability.

26:50.910 --> 26:55.950
Equipped and it'll take four input params.

26:56.980 --> 26:59.410
We'll have the ability tag.

27:01.670 --> 27:04.160
We'll have the status.

27:04.970 --> 27:08.930
We'll have the slot and the previous slot.

27:10.370 --> 27:11.660
We'll call it prev slot.

27:11.810 --> 27:13.280
We'll call it previous slot.

27:15.460 --> 27:17.440
So we'll generate this definition.

27:17.440 --> 27:22.120
And first things first, we're going to subscribe to the delegate and bind this to it.

27:22.360 --> 27:30.130
So all the way up at our bind callbacks to dependencies when we have our ability system component right

27:30.130 --> 27:35.020
under our first lambda, we're going to say get aura, ask.

27:37.800 --> 27:39.180
Ability equipped.

27:39.270 --> 27:41.400
And we're going to add you object.

27:42.360 --> 27:50.370
With this as the user object and at you spell menu widget controller on ability equipped.

27:51.750 --> 27:57.720
And now we can flesh out on ability equipped and we're almost done.

27:58.490 --> 28:05.260
So the first thing on ability equipped can do is say, well, we're no longer waiting for equip selection.

28:05.270 --> 28:06.860
That's going to be false.

28:07.780 --> 28:11.920
Now the next thing we need to do is broadcast empty info.

28:11.950 --> 28:15.130
If the previous slot is a valid slot.

28:15.700 --> 28:20.230
So this is only if we're equipping an already equipped spell into a new slot.

28:20.470 --> 28:29.020
So what I'm going to do is make an or a ability info struct called last slot info and it's going to

28:29.020 --> 28:35.350
be just an empty f or a ability info and we're going to take last slot info.

28:36.910 --> 28:42.670
Dot status tag and we'll set it to for gameplay tags.

28:42.760 --> 28:43.810
Get.

28:45.140 --> 28:48.710
Dot abilities status unlocked.

28:49.040 --> 28:51.560
We'll take last slot info.

28:52.480 --> 28:56.410
Dot input tag and set it equal to the previous slot.

28:58.440 --> 29:00.930
And we're going to take its ability tag.

29:00.930 --> 29:07.320
So last slot info, dot ability tag and we'll make this abilities none.

29:12.550 --> 29:17.110
So it's not really occupied with anything substantial.

29:17.140 --> 29:21.370
Now I'm also going to make a const for a gameplay tags.

29:26.210 --> 29:28.970
So we'll use that here.

29:30.890 --> 29:33.080
And so what we're going to say here is.

29:34.010 --> 29:37.310
Broadcast empty info.

29:38.150 --> 29:50.210
If previous slot is a valid slot only if equipping an already equipped spell.

29:51.350 --> 29:53.840
So we'll take ability info delegate.

29:54.110 --> 30:01.220
We'll broadcast last slot info and we'll just pass in abilities.

30:01.250 --> 30:01.970
None.

30:02.900 --> 30:03.650
Oh, sorry.

30:04.700 --> 30:05.960
And that's it.

30:07.630 --> 30:13.870
Now, next, we're going to create another ability info to broadcast, and that's for the current slot.

30:14.230 --> 30:24.070
So we're going to say for ability info info and this will be from our ability info and we're actually

30:24.070 --> 30:30.980
going to find ability info for tag using our ability tag.

30:31.000 --> 30:33.340
So this will be the actual one.

30:33.610 --> 30:36.840
We're going to get the ability status.

30:36.850 --> 30:43.480
So status tag, we're going to set that to the status because that has changed.

30:43.510 --> 30:51.490
We're going to take its input tag that has also changed to the new slot and we're going to take ability

30:51.490 --> 30:56.260
info, delegate and broadcast info.

30:57.910 --> 31:03.160
So clear out the old slot and fill in the new slot.

31:03.900 --> 31:11.790
Now, in addition to this, we're also going to want to stop playing those animations from our equipped

31:11.790 --> 31:12.900
spells row.

31:13.600 --> 31:19.660
So in other words, we want that stop waiting for equip delegate broadcast.

31:20.440 --> 31:22.150
So we'll broadcast that.

31:22.150 --> 31:24.850
And this takes in the ability type.

31:24.880 --> 31:27.250
So we need to get our ability info.

31:27.730 --> 31:34.570
We need to find ability info for tag, pass in the ability tag and get the ability type.

31:35.290 --> 31:38.080
And then we can stop playing those animations.

31:39.130 --> 31:42.510
Okay, so that's a lot.

31:42.520 --> 31:50.650
But we can just quickly come full circle here and see the full cycle of what's going on.

31:51.730 --> 31:54.550
The first thing is equip button gets pressed right.

31:54.580 --> 31:57.090
We save our selected slot.

31:57.100 --> 31:59.830
If it's an equipped ability.

32:00.160 --> 32:08.020
Now we're waiting at this point and when the spell row globe is pressed, we need to tell the aura ability

32:08.020 --> 32:12.190
system component to execute server equip ability.

32:12.220 --> 32:14.410
So we're going to do that here.

32:14.410 --> 32:25.690
We're going to say get aura, ask server, equip ability passing in our ability tag and that's our selected

32:25.690 --> 32:26.950
ability tag.

32:27.790 --> 32:32.590
So selected ability, dot ability as well as the slot tag.

32:33.570 --> 32:38.210
And our server is going to do all kinds of stuff, right?

32:38.220 --> 32:44.040
It's going to first make sure that that ability has it equipped or unlocked status.

32:44.040 --> 32:48.660
If that's true, it's going to clear all abilities.

32:48.660 --> 32:51.690
Really only 1 or 0 will have this slot.

32:51.690 --> 32:56.070
But if any abilities that we have have this slot, we're going to clear that.

32:56.790 --> 33:03.120
We're also going to clear the slot of the ability that we sent up and then take that ability and add

33:03.120 --> 33:06.420
the slot that we're now trying to occupy.

33:06.750 --> 33:12.690
And if it has the unlocked status, we're going to remove that status and add the equipped status and

33:12.690 --> 33:16.200
mark the ability spec dirty and call client equip ability.

33:16.230 --> 33:22.260
Now that's going to just broadcast the ability tag, the status, the slot and the previous slot and

33:22.260 --> 33:27.030
our spell menu widget controller is going to respond to it with an ability equipped.

33:27.060 --> 33:30.690
It's then going to say we're no longer waiting for an equipped selection.

33:30.690 --> 33:34.350
It's going to broadcast info for the previous slot.

33:34.380 --> 33:37.260
Basically an empty gameplay ability.

33:37.290 --> 33:37.830
Abilities.

33:37.860 --> 33:38.340
None.

33:38.340 --> 33:38.940
Right.

33:38.940 --> 33:47.100
And then it's going to broadcast the current slot and then stop those animations on the equip spells

33:47.100 --> 33:47.880
row.

33:48.330 --> 33:52.380
So with all that, we made a lot of changes.

33:52.410 --> 33:58.200
We now just need to compile launch the editor and see what happens.

33:59.500 --> 34:04.540
Okay, I'm going to click open just because I can, but I'm going to come straight in and play test,

34:04.540 --> 34:10.930
click on spells, click on this ability, click on equip and select right mouse button.

34:11.440 --> 34:14.410
Okay, so of course, I forgot something.

34:14.410 --> 34:18.040
Our globes here in the equip spells row.

34:18.070 --> 34:22.420
These need to call our blueprint callable function.

34:22.420 --> 34:24.360
What's that function called?

34:24.370 --> 34:27.550
It is spell row globe pressed.

34:27.580 --> 34:31.870
We need to call that passing in a slot tag and an ability type.

34:32.810 --> 34:33.980
So a couple things.

34:33.980 --> 34:37.910
I kind of jumped the gun here in our equip spells row.

34:38.180 --> 34:45.770
First of all, our globes, they all need to know what their ability type is in addition to their slots.

34:46.190 --> 34:47.270
And you know what?

34:47.270 --> 34:53.550
If I put these images above the box root, then I can still select these globes.

34:53.570 --> 34:53.930
Okay.

34:53.930 --> 34:54.990
That's what I wanted.

34:55.010 --> 34:56.960
So we have these globes, right?

34:56.990 --> 35:01.010
We need them to know what their ability type is.

35:01.040 --> 35:04.550
And I don't think they have an ability type gameplay tag.

35:04.670 --> 35:07.640
So we need to go to the equipped row button.

35:09.760 --> 35:15.910
And the equipped row button needs to know what its ability type is, not just its input tag now.

35:16.240 --> 35:20.440
So we're going to add a new variable called ability type.

35:21.990 --> 35:24.210
It's going to be a gameplay tag, obviously.

35:26.680 --> 35:32.710
We can compile, we can check the I icon and back in equip spell row.

35:32.740 --> 35:39.390
We can set all of these six to have the ability type of offensive.

35:39.400 --> 35:45.910
So abilities type offensive and then these two can be passive abilities type passive.

35:46.000 --> 35:49.360
So now they know what their ability type is.

35:50.150 --> 35:55.040
They need to know because they're going to call spell row globe pressed passing in their slot and their

35:55.040 --> 35:56.050
ability type.

35:56.060 --> 35:58.520
So let's do that in Onclicked.

36:03.690 --> 36:07.140
So for the equipped row button, we need to take that button.

36:07.140 --> 36:13.860
Ring check is variable, come back to the graph and as soon as our widget controller is set.

36:14.680 --> 36:17.100
I'm going to assign the delegate there.

36:17.110 --> 36:21.550
So what I'm going to do is take my button ring.

36:22.970 --> 36:25.310
Assigned to Onclicked.

36:26.740 --> 36:27.820
We'll hook that up.

36:30.170 --> 36:32.780
And we'll get our spell menu Widget Controller.

36:34.430 --> 36:35.630
And call.

36:36.540 --> 36:44.490
Spell row globe pressed and don't know if it's a blueprint callable it's not.

36:44.490 --> 36:47.970
So we'll make that blueprint callable and we'll have to restart.

36:47.970 --> 36:51.000
So closing the editor and restarting.

36:52.530 --> 36:56.880
All right, let's get back into the equipped row.

36:57.120 --> 37:02.550
We'll get our widget controller and call spell row globe pressed.

37:03.370 --> 37:05.260
As soon as we've clicked.

37:05.260 --> 37:07.360
And we need to pass in two things.

37:07.360 --> 37:10.900
The slot tag, that's going to be the input tag here.

37:12.530 --> 37:14.030
And the ability type.

37:14.030 --> 37:15.590
We need to pass that in.

37:16.470 --> 37:20.010
And then that'll start the whole chain.

37:22.730 --> 37:24.170
And we can test that.

37:26.020 --> 37:28.420
So selecting an icon.

37:28.690 --> 37:31.870
Clicking on equip choosing B.

37:33.180 --> 37:34.320
Now, here's the thing.

37:34.320 --> 37:42.930
The reason we're seeing this is because all of these that don't have valid ability tags, their tags

37:42.930 --> 37:43.920
are set to abilities.

37:44.160 --> 37:44.730
None.

37:44.730 --> 37:46.680
And that's what we're broadcasting.

37:46.680 --> 37:50.640
So we don't want there to be a match.

37:50.670 --> 37:58.140
In other words, we don't want those abilities to have their ability tags set to abilities, none.

37:58.170 --> 38:00.630
That's going to result in what we see here.

38:00.720 --> 38:06.480
But to avoid that match, we're going to set their ability tag to literally nothing.

38:06.480 --> 38:12.780
We're going to uncheck that and set them to an unset ability tag.

38:12.780 --> 38:20.490
So just doing that in the offensive spell tree, we should be able to see those tags not change.

38:21.280 --> 38:23.710
We'll do that to the passive spell tree as well.

38:23.710 --> 38:31.030
So we'll go back to the passive spell tree, select these three ability globes and set their ability

38:31.030 --> 38:33.640
tag to nothing.

38:33.850 --> 38:40.160
And that's going to save them from being set to an ugly white image.

38:40.180 --> 38:45.430
Now for the equipped spells row, what we're broadcasting.

38:46.580 --> 38:48.560
In our equip row button.

38:51.000 --> 38:53.130
For our ability info delegate.

38:53.160 --> 38:58.650
We're checking against the input tag and for that empty slot info.

38:58.680 --> 39:01.680
The input tag is the previous slot.

39:01.710 --> 39:04.260
That's why we're only seeing that white on the slot.

39:04.290 --> 39:05.970
That was the previous slot.

39:06.000 --> 39:06.800
Right.

39:06.810 --> 39:12.750
If it starts off as the left mouse button, then we're only seeing that white there on the left mouse

39:12.750 --> 39:13.350
button.

39:13.350 --> 39:17.400
So we're getting a match here when we check the input tag.

39:17.580 --> 39:26.160
But what we should be broadcasting up in this ability info here is an ability info that contains textures

39:26.160 --> 39:29.550
for an empty globe.

39:29.550 --> 39:30.090
Right?

39:30.120 --> 39:36.450
We want the icon and we want the background both to be transparent.

39:37.450 --> 39:44.860
Now what we can do is because we're broadcasting abilities, none is we can check if ability tag is

39:44.860 --> 39:45.940
abilities none.

39:46.240 --> 39:53.290
So we can say matches tag exact abilities dot none.

39:53.290 --> 39:56.340
And if so, we'll clear the globe.

39:56.350 --> 39:57.700
So let's do that.

40:02.540 --> 40:06.020
And if it's not abilities, none will continue.

40:08.680 --> 40:10.420
And here's our clear globe.

40:11.210 --> 40:15.440
Which what it does is sets those two to a transparent brush.

40:15.860 --> 40:17.360
So no problem.

40:27.270 --> 40:29.400
So let's see how that works.

40:32.270 --> 40:33.140
All right.

40:40.070 --> 40:40.540
Cool.

40:40.550 --> 40:42.710
That looks like it's working now.

40:42.710 --> 40:46.960
Everything is working except for our overlay widget controller.

40:46.970 --> 40:51.590
I can right click and I can use this ability on the right mouse button.

40:51.590 --> 40:56.810
I can also assign it to one through four if I choose four, for example.

40:56.840 --> 41:01.190
Now I'm using the four key, so that's great.

41:01.190 --> 41:05.060
But we also have to update our overlay.

41:05.330 --> 41:13.280
So as soon as this has been broadcast, we also need to respond on our overlay the same way we did in

41:13.280 --> 41:14.570
our widget controller.

41:14.570 --> 41:18.110
And that's something that I think we can do in the next video.

41:18.110 --> 41:23.660
For now, I think this is enough and really this is quite a lot.

41:23.660 --> 41:30.620
And before we actually wrap up, what we can do is we can unlock this ability and see if we can equip

41:30.620 --> 41:32.300
it to the right mouse button.

41:32.300 --> 41:33.440
And look, we can.

41:33.440 --> 41:36.650
Oh, and we cleared out the left mouse button.

41:37.130 --> 41:38.720
Only in the HUD, though.

41:40.260 --> 41:43.890
But I can right click and we see electrocute activated.

41:43.890 --> 41:44.490
Cool.

41:45.600 --> 41:48.390
So a couple of things to fix.

41:48.420 --> 41:53.400
Notice that we're clearing out everything in our equipped row.

41:53.430 --> 41:54.630
When we equip something.

41:54.630 --> 41:57.750
So that's not exactly what we want, right?

41:58.380 --> 42:02.010
So we got a couple of things to fix in the next video.

42:02.040 --> 42:03.300
I'll see you then.
