WEBVTT

00:07.020 --> 00:07.470
Okay.

00:07.470 --> 00:08.250
Welcome back.

00:08.250 --> 00:14.790
Now, there's an interesting problem, and you don't know about it until you've unlocked another ability,

00:14.820 --> 00:17.670
spent a point on it and then tried to equip it.

00:17.700 --> 00:20.850
You'll see that it clears out anything else that's there.

00:20.880 --> 00:26.820
Now, that's a pretty easy fix and it all comes down to our equipped row button.

00:27.550 --> 00:31.870
You see if the ability tag is none, then we clear the globe.

00:31.870 --> 00:35.920
But we shouldn't do that unless the input tag matches.

00:35.950 --> 00:37.870
So right here we're checking.

00:37.870 --> 00:43.780
If we match the input tag, we should actually check if we match the input tag first.

00:43.840 --> 00:49.540
Otherwise, we're just going to clear every single one of our globes every time.

00:49.540 --> 00:51.490
So we'll have this branch here.

00:53.450 --> 00:59.090
And we'll hook the false up to the rest of what it's doing and the true up to clear globe.

00:59.090 --> 01:04.640
And that's the true for if it's ability is none so that should fix that.

01:04.640 --> 01:08.480
And after that our spell menu should be working.

01:15.050 --> 01:16.010
Let's level up.

01:17.480 --> 01:18.970
Let's upgrade this ability.

01:18.980 --> 01:20.780
Let's equip it to right mouse button.

01:20.780 --> 01:21.870
And there we go.

01:21.890 --> 01:26.990
Now, this is awesome because now I can right click to electrocute.

01:26.990 --> 01:28.970
I can left click.

01:29.000 --> 01:30.710
Of course, with shift.

01:30.740 --> 01:34.640
Our left mouse button requires the shift unless we have a target.

01:34.640 --> 01:35.210
Right.

01:35.300 --> 01:43.820
But we can now take the electrocute ability, press, equip and click on the left mouse button slot

01:43.820 --> 01:46.490
and push that firebolt ability out.

01:46.490 --> 01:52.760
And now it's our left mouse button that does our electrocute and we can take our firebolt and equip

01:52.760 --> 01:58.250
it to the right mouse button and we can really use any of these that we want.

02:00.720 --> 02:01.890
Doesn't matter.

02:01.980 --> 02:06.900
We now have inputs that can be reassigned via the spell menu.

02:06.930 --> 02:14.220
This is actually a pretty big deal and it's something that I've been requested a lot to cover, and

02:14.220 --> 02:15.720
this is just one way to do it.

02:15.720 --> 02:20.790
It's not really a input remapping, extensive system.

02:20.790 --> 02:23.130
It's just for our spell system.

02:23.130 --> 02:29.340
We now have the ability to remap our spells to different inputs and it looks great.

02:30.490 --> 02:32.020
And we can cancel.

02:35.070 --> 02:36.720
And it's pretty robust.

02:37.080 --> 02:40.470
So now our spell menu is actually pretty much complete.

02:40.470 --> 02:46.890
The only thing is when we add new spells, we need to give them descriptions, but other than that,

02:46.890 --> 02:49.680
the spell menu is pretty much done.

02:49.710 --> 02:53.040
We just need to make sure to update our overlay.

02:53.070 --> 02:59.760
Now that's pretty easy because there's a delegate broadcast by the ability system component and that's

02:59.760 --> 03:06.060
what we respond to, to update this right here so we can do the same thing in the overlay.

03:06.120 --> 03:07.730
So what is that?

03:07.740 --> 03:10.380
Delegate It's on ability equipped.

03:10.380 --> 03:12.930
So this is what we're doing.

03:13.050 --> 03:16.440
We need to do the same thing in the overlay widget controller.

03:16.470 --> 03:21.150
So we're going to have an on ability equipped in that class.

03:21.270 --> 03:28.200
So I'm going to go ahead and just close out of all the other tabs except for spell menu, widget controller,

03:28.350 --> 03:36.640
CP, and I'm going to go into my overlay widget controller and make a callback here to bind to that

03:36.640 --> 03:40.950
same delegate and I'm going to give it the same name on ability equipped.

03:40.960 --> 03:43.780
I can just copy the signature.

03:44.320 --> 03:46.720
And an overlay widget controller.

03:46.750 --> 03:49.600
I'll just make it a protected function.

03:49.720 --> 03:52.660
Void on ability equipped.

03:52.990 --> 03:55.360
And let's generate a definition.

03:58.790 --> 04:03.470
Now we need to bind this so we'll get our ability system component.

04:03.770 --> 04:08.720
We're going to want to cast it to aura, ability, system component.

04:08.720 --> 04:11.660
And the first thing I'll do is I'll call, get or ask.

04:14.670 --> 04:17.580
And get our ability equipped delegate.

04:17.790 --> 04:26.490
We're going to add you object with this comma at you overlay widget controller on ability equipped and

04:26.490 --> 04:27.240
there we go.

04:27.970 --> 04:31.480
Now we just need to handle an ability equipped.

04:32.020 --> 04:38.230
I'm going to take my spell menu, widget controller function, copy the whole thing, and then we'll

04:38.230 --> 04:41.290
paste it over and change what we need.

04:41.320 --> 04:43.420
We don't need this line.

04:43.420 --> 04:45.250
We don't have that boolean here.

04:45.850 --> 04:53.260
We do want gameplay tag, so I'm going to include for gameplay tags.

04:53.530 --> 05:02.140
We do want to broadcast last slot info, so we'll broadcast abilities none for that at the previous

05:02.140 --> 05:02.950
slot.

05:03.100 --> 05:09.610
And we also want to get ability info for the current tag and broadcast it at its current slot.

05:09.610 --> 05:14.950
And then we don't need to broadcast this other delegate that was specific to the widget controller for

05:14.950 --> 05:15.950
the spell menu.

05:15.970 --> 05:18.280
So these are the only things we need to do.

05:18.310 --> 05:20.830
This can also be a const function.

05:23.560 --> 05:29.740
So we'll make it const and let's just make sure we're handling this properly in the editor.

05:29.740 --> 05:31.460
So I'm going to close the editor.

05:31.480 --> 05:39.580
Save, selected and relaunch and just see how things work now that we're calling on Ability Equipped.

05:41.230 --> 05:41.740
All right.

05:41.740 --> 05:43.090
We're back in the editor.

05:44.020 --> 05:45.310
Let's press play.

05:45.520 --> 05:48.400
Let's change our spell situation.

05:48.400 --> 05:52.000
And so we got that same white square problem.

05:52.000 --> 05:55.040
Now that we know how to fix it, we can fix it pretty easily.

05:55.060 --> 05:59.290
We have to go to our overlay though, and actually it's not even the overlay.

05:59.290 --> 06:06.090
It's in UI overlay, sub widget health, mana spells, and it's in each of these.

06:06.100 --> 06:08.750
So these are spell globes.

06:09.550 --> 06:10.420
Spell globes.

06:10.420 --> 06:12.730
Let's open that widget class.

06:12.730 --> 06:19.150
So UI spell globes and it's actually the spell globe class.

06:19.360 --> 06:21.370
Let's see what we're doing here.

06:21.370 --> 06:25.870
We're receiving ability info and right here we can check.

06:25.900 --> 06:32.410
If we match the input tag, then we can also check with another branch.

06:33.580 --> 06:37.480
Right here and only false will continue.

06:37.480 --> 06:38.600
And what are we checking?

06:38.620 --> 06:40.900
We're checking the ability tag.

06:41.080 --> 06:44.800
We're seeing if it matches tag exact abilities.

06:44.830 --> 06:45.490
None.

06:46.300 --> 06:49.180
If it does match tag exact abilities?

06:49.210 --> 06:49.850
None.

06:49.870 --> 06:51.880
Then we want to clear the globe.

06:51.910 --> 06:53.740
Let's call Clear Globe.

06:54.660 --> 06:56.850
And just looking at Clear Globe, Yes.

06:56.850 --> 06:59.570
Sets it to a transparent background.

06:59.580 --> 07:01.140
So with that.

07:02.200 --> 07:03.940
We should have things working.

07:04.240 --> 07:05.830
And we do.

07:05.830 --> 07:07.920
And we'll go ahead and level up.

07:07.930 --> 07:09.430
I have to right click now.

07:11.350 --> 07:12.760
Boom leveled up.

07:12.760 --> 07:16.080
Let's upgrade that ability and equip it to.

07:16.510 --> 07:17.470
Uh oh.

07:22.820 --> 07:25.580
Something happened that I didn't quite see.

07:25.610 --> 07:27.200
Let's see what happens.

07:28.340 --> 07:29.870
How can I repro what just happened?

07:29.900 --> 07:37.940
I think I have to put this there and then upgrade inability by Oh, I see a couple of problems.

07:38.240 --> 07:38.690
Okay.

07:38.690 --> 07:47.600
So as soon as I switch to the right mouse button and I fired off, I saw that my cooldown is actually

07:47.630 --> 07:49.900
what's messing things up.

07:49.910 --> 07:53.320
So it appears to be related to the cooldown.

07:53.330 --> 07:55.910
And if we go back to our spell globe.

07:56.790 --> 07:58.560
We'll see that.

07:59.030 --> 08:05.150
We're listening for a cooldown change for the cooldown tag, which once this spell globe has been cleared

08:05.150 --> 08:09.050
out, we should clear out its cooldown tag as well.

08:09.710 --> 08:13.280
So let's go back to receive ability info.

08:14.890 --> 08:23.260
And here, if the ability is matching the input tag for the slot and its abilities, none.

08:23.260 --> 08:30.130
We should set the cooldown tag to an empty tag and that should make sure that it no longer listens to

08:30.160 --> 08:31.720
that old cooldown.

08:31.750 --> 08:41.170
So what I did to repro the issue was equip firebolt to right mouse button and then level up.

08:43.330 --> 08:51.490
Then upgrade, electrocute and equip it to left mouse button and then fire the right mouse button ability.

08:51.490 --> 08:53.830
And we did see that before.

08:53.830 --> 09:00.340
The reason that it put the white texture on the left mouse button slot was because it was still listening

09:00.370 --> 09:01.810
to the same cooldown tag.

09:01.810 --> 09:03.400
So now we've fixed that.

09:05.370 --> 09:06.210
Okay.

09:06.540 --> 09:10.320
And now we can equip things as we see fit.

09:11.030 --> 09:13.100
We can unselect things.

09:17.830 --> 09:19.120
Things look great.

09:19.360 --> 09:27.040
So one last polishing touch that I think I'd like to do is as soon as we've assigned an ability to a

09:27.040 --> 09:31.390
slot, I'd like to deselect what I previously had selected.

09:31.390 --> 09:34.750
I don't want to have to go up there and click it and unselect it.

09:34.810 --> 09:39.880
And also I'd like to play a sound when we equip something.

09:40.030 --> 09:43.480
I think that's also something we could do.

09:43.660 --> 09:48.820
So a couple of polishing last steps and we'll do those in the next video.

09:48.850 --> 09:51.640
Excellent job and I'll see you soon.
