WEBVTT

00:06.780 --> 00:07.920
Welcome back.

00:08.220 --> 00:13.380
Now, in this video, I'm concerned with starting to make our spell menu functional.

00:13.380 --> 00:17.420
And I'd like to start with the very bottom row down here.

00:17.430 --> 00:20.940
We want to show our equipped abilities.

00:20.940 --> 00:25.680
And right now we know the only equipped ability is the firebolt that we have here.

00:25.680 --> 00:27.150
And the others should be empty.

00:27.150 --> 00:29.010
So we should reflect that here.

00:29.160 --> 00:37.920
Now, in addition, I'd like to add an equip button and that will allow us to select one of our abilities

00:37.920 --> 00:43.710
from our tree and click equip to assign it to one of our rows.

00:43.710 --> 00:50.580
So before we go about making our spell menu functional, let's add one more widget to it.

00:50.580 --> 00:52.110
That's going to be a button.

00:52.110 --> 00:56.820
So we're going to go to our UI folder into spell menu.

00:57.060 --> 01:02.460
We'll open our spell menu widget and we're going to add one more wide button.

01:02.460 --> 01:08.500
And I'd like that to be just beneath passive abilities, which means we may need to change the size

01:08.500 --> 01:09.870
of some of these things.

01:09.880 --> 01:13.090
Let's go ahead and create a little bit extra space.

01:13.090 --> 01:21.460
I'm going to make my offensive spell tree a little smaller, so I'm going to open that widget and just

01:21.460 --> 01:26.920
take my size box root, take my height override and bring it in.

01:26.920 --> 01:29.920
And it looks like 300 might be perfect.

01:29.920 --> 01:34.930
So I'm going to set that as my default box height.

01:35.170 --> 01:38.710
So instead of 350 that that'll be 300.

01:38.740 --> 01:41.110
We'll go ahead and save that.

01:42.470 --> 01:45.140
So already we have a little bit more room.

01:45.170 --> 01:49.550
I'll get my passive spell tree as well and we'll do the same thing.

01:49.550 --> 01:55.730
I'll take the size box root, we'll drag the height override down until we see a good value.

01:55.730 --> 02:04.610
I think 60 is just about right, so we can go ahead and set our box height variable to 60 and save that

02:04.610 --> 02:05.240
as well.

02:05.270 --> 02:12.530
Now our spell menu looks like it has some extra room and I'd like this equip button to be after my passive

02:12.530 --> 02:14.000
abilities spell tree.

02:14.000 --> 02:22.250
So that's going to be just above equipped abilities so we can search for a wide button and drag it in

02:22.250 --> 02:31.160
between those two right here and we can search for properties in its details panel and change the text

02:31.160 --> 02:32.690
to equip.

02:35.140 --> 02:42.700
And we can take the box width for it and set it to a smaller value like 100.

02:42.700 --> 02:50.710
And I do want to make sure that this button is going to make our equipped abilities text Go to the new

02:50.710 --> 02:51.460
line.

02:51.460 --> 02:57.310
If we select that equipped abilities, text and click Force new line, it will be forced to the new

02:57.310 --> 03:05.170
line and then we can take our equip button and we can click fill Empty Space and Choose center, align

03:05.170 --> 03:06.310
horizontally.

03:06.310 --> 03:10.810
And that's going to allow it to be in the middle at the correct size.

03:10.810 --> 03:16.720
Now obviously we're going to need some spacers in between, so let's grab a couple of spacers.

03:17.320 --> 03:21.100
I'm going to take one of them and drag right above the wide button.

03:21.670 --> 03:24.070
I'm going to increase its X size.

03:25.880 --> 03:33.770
I'm going to take my passive tree and click Force New Line and my new spacer is going to be wide in

03:33.770 --> 03:35.630
the X enough to.

03:36.340 --> 03:39.910
Push the equip button down and then we can.

03:40.620 --> 03:44.040
Make it a little taller, let's say 20.

03:44.220 --> 03:46.500
Now I'm going to copy that spacer.

03:46.770 --> 03:51.000
Click on my wide button Ctrl V and I have one beneath it too.

03:51.390 --> 03:53.460
We can compile, we can save.

03:53.460 --> 03:55.750
And let's see what it looks like.

03:55.770 --> 03:58.650
Now we have an equip button and it looks pretty good.

03:58.680 --> 03:59.580
Now.

04:00.870 --> 04:04.710
I'll go ahead and just make it a little bit wider than 100.

04:04.740 --> 04:05.880
Maybe 120.

04:06.390 --> 04:06.810
Okay.

04:06.810 --> 04:09.780
So that's the first thing I wanted to take care of.

04:09.810 --> 04:13.730
But now we need to make this a functional spell menu.

04:13.740 --> 04:17.910
And we know that our widgets need widget controllers.

04:17.910 --> 04:20.430
So this spell menu needs a widget controller.

04:20.430 --> 04:22.170
We're going to make a spell menu.

04:22.200 --> 04:23.340
Widget controller.

04:24.200 --> 04:30.830
And before we do that, I'm just going to take the width for my description box and just make it a little

04:30.830 --> 04:31.600
wider.

04:31.610 --> 04:35.660
245 looks pretty good and I'm going to do that for both.

04:41.290 --> 04:42.140
That's better.

04:44.870 --> 04:46.160
I like how that looks.

04:46.760 --> 04:50.650
Now let's go ahead and create our spell menu widget controller.

04:50.660 --> 04:57.470
So that's going to be a C plus plus class in Aura public UI, widget controller, and it's going to

04:57.470 --> 05:01.880
be based on our base class for widget controllers or a widget controller.

05:01.880 --> 05:08.900
So I'm going to right click on that, create a C plus plus class based on it and call this spell menu

05:09.470 --> 05:13.040
widget controller and it'll go into widget controller.

05:13.040 --> 05:16.010
Let's create that class and close the editor.

05:17.740 --> 05:18.820
So here we are.

05:18.820 --> 05:23.290
I can go into UI widget controller and here spell menu.

05:23.290 --> 05:26.620
Widget controller and here's the CPP file.

05:26.710 --> 05:27.730
Now spell menu.

05:27.730 --> 05:33.070
Widget controller is an aura widget controller, so it's inheriting some things from aura widget controller

05:33.070 --> 05:34.590
that we can override.

05:34.600 --> 05:40.410
Our two key functions are broadcast initial values and bind callbacks to dependencies.

05:40.420 --> 05:46.390
We're going to override these both, so I'm going to copy both of these functions and come into spell

05:46.420 --> 05:52.870
menu, widget controller, create a public section and override both of these functions.

05:52.870 --> 05:55.510
So we'll mark both of them with override.

05:57.650 --> 06:00.410
And we'll generate definitions for both of them.

06:03.950 --> 06:12.110
Now super is called by default, but or a widget controller if we go into the CPP file, doesn't actually

06:12.110 --> 06:13.070
implement them.

06:13.070 --> 06:18.560
So it doesn't matter if we call super or not, we can go ahead and remove those function calls until

06:18.560 --> 06:21.830
we go and add something to the parent versions that we need.

06:22.160 --> 06:25.850
Now, broadcast initial values needs to do something.

06:25.880 --> 06:30.230
Our spell menu needs to know which abilities are equipped.

06:30.440 --> 06:38.150
In other words, we need to broadcast whichever abilities we have already equipped so that our equipped

06:38.150 --> 06:39.740
spells row can show them.

06:39.740 --> 06:42.440
And our spell tree for that matter, can show them.

06:42.440 --> 06:49.850
And we've already done something similar to this in our overlay widget controller if we open overlay

06:49.850 --> 06:51.440
widget controller dot CP.

06:52.840 --> 06:57.790
We can see what it is doing in bind callbacks to dependencies.

06:58.060 --> 07:05.230
It's getting the aura ability system component, seeing if it's start up abilities have been initialized

07:05.230 --> 07:08.200
and calling on initialized startup abilities.

07:08.350 --> 07:14.500
In this function it double checks to make sure the ability system components startup abilities have

07:14.500 --> 07:15.160
been given.

07:15.160 --> 07:16.800
If not, it returns.

07:16.810 --> 07:19.390
And then it does this business.

07:19.420 --> 07:26.020
It creates a delegate and binds a lambda to it and then calls for each ability on the ability system

07:26.020 --> 07:31.660
component, passing that delegate in the ability system component then goes and loops through all of

07:31.660 --> 07:35.440
its activatable abilities executing this delegate.

07:35.440 --> 07:38.710
And what the delegate does is in this lambda here.

07:38.740 --> 07:47.080
So it finds the ability info for this abilities tag, it gets the input tag for that ability from its

07:47.080 --> 07:52.300
ability spec and then broadcasts its ability info delegate.

07:52.950 --> 07:59.850
So we want to do basically this same thing, except as we'll see later on, we're going to want to change

07:59.850 --> 08:00.900
it a little bit.

08:00.930 --> 08:06.390
We'll be needing to broadcast more information about our abilities to our spell menu.

08:06.900 --> 08:10.380
Now we have a couple to dos that it looks like we've already done them.

08:10.500 --> 08:15.900
Get information about all given abilities, look up their ability info and broadcast it to widgets.

08:15.930 --> 08:17.160
We've done that.

08:17.190 --> 08:19.020
That to do can be removed.

08:19.050 --> 08:24.450
This to do says need to find a way to figure out the ability tag for a given ability spec.

08:24.480 --> 08:25.470
Well we've done that.

08:25.470 --> 08:30.090
It's called get ability tag from spec so that to do is done as well.

08:30.330 --> 08:36.120
Now, because this is something we need to do in our spell menu widget controller as well, rather than

08:36.120 --> 08:43.110
just copying ourselves with a duplicate function, we can move this function into aura widget controller,

08:43.110 --> 08:49.110
which is the parent class to both of these, and then both of these classes can enjoy inheriting from

08:49.110 --> 08:49.440
it.

08:49.470 --> 08:52.080
Now that means we'll be taking our ability info.

08:52.080 --> 08:59.040
Delegate a member variable of overlay widget controller and moving it into aura widget controller.

08:59.040 --> 09:03.870
Which means all widget controllers will have an ability info delegate member variable.

09:03.900 --> 09:10.720
If I go into overlay widget controllers, we can see that we've declared the ability info signature

09:10.720 --> 09:16.260
here and we have the ability info delegate right here as a member variable.

09:16.270 --> 09:23.950
So what we can do is instead move this ability info signature delegate declaration into aura widget

09:23.950 --> 09:30.760
controller, and then all widget controllers will not only have this type defined, but they can also

09:30.760 --> 09:37.000
inherit an ability info delegate member variable so all widget controllers will have one.

09:37.210 --> 09:38.920
So I'd like to do that.

09:38.950 --> 09:42.460
So to keep things organized, I'm going to rearrange my tabs here.

09:42.610 --> 09:49.720
I'm going to move my Aura widget controller all the way to the left, both the H and CPP files.

09:50.470 --> 09:56.140
And I'm going to move my overlay widget controller here into the middle and my new spell menu, widget

09:56.140 --> 09:58.030
controller all the way to the right.

09:58.780 --> 10:05.880
Now the overlay widget controller is defining the delegate F ability info signature inside of its H

10:05.920 --> 10:10.530
file and then it has that ability info delegate member variable.

10:10.540 --> 10:16.540
We're going to move this declare dynamic multicast, delegate one param from overlay widget controller

10:16.540 --> 10:18.370
into or a widget controller.

10:18.370 --> 10:26.680
So I'm just going to cut it with control X and bring it in and paste it right here and or a widget controller.

10:26.680 --> 10:30.400
And now a widget controller has this type defined here.

10:30.670 --> 10:36.040
Now overlay widget controller also has, as I mentioned, ability info delegate.

10:36.070 --> 10:40.720
We're going to go ahead and cut that as well and move that into our widget controller.

10:40.720 --> 10:45.280
So this will now be an inherited variable and this can go in the public section.

10:45.430 --> 10:51.160
So now overlay widget controller is just using the inherited ability info delegate.

10:51.250 --> 10:58.610
But on top of that, I'd like to move all of this stuff into or a widget controller.

10:58.610 --> 11:04.220
Now that means or a widget controller is going to depend on the ability system component.

11:04.220 --> 11:09.590
And if you didn't want that, if you wanted the aura widget controller base class to not depend on aura

11:09.590 --> 11:15.260
ability system component, then you could just repeat yourself and have copies of this function into

11:15.260 --> 11:16.550
child classes.

11:16.550 --> 11:22.790
But aura ability, system component and aura attribute set are base classes for the whole project.

11:22.790 --> 11:28.760
In other words, just about every ability system component in this project, actually every single one

11:28.790 --> 11:31.850
is derived from our aura ability system component.

11:31.850 --> 11:33.920
So it's kind of generic.

11:33.920 --> 11:40.580
We can treat it almost like the engine class ability system component and a sense that it's a base class

11:40.580 --> 11:42.380
that's super generic.

11:42.380 --> 11:48.740
So we won't be really restricting aura widget controller by making it dependent on aura ability system

11:48.740 --> 11:49.430
component.

11:49.430 --> 11:54.020
And of course this dependency is one way, so it's still a good coding design.

11:54.020 --> 11:59.300
So what I'm going to do is go into Aura widget controller and I'd still like all widget controllers

11:59.300 --> 12:05.750
to have the four key variables and these be the engine classes, player controller, player, state

12:05.780 --> 12:08.600
ability, system component and attribute set.

12:08.600 --> 12:15.200
But in addition to that, I'd like to have four more specific variables aura player controller or a

12:15.200 --> 12:19.790
player state or a ability system component and aura attribute set.

12:19.790 --> 12:27.260
And then we can create getters that will cast these values to those specific classes and store them

12:27.260 --> 12:28.160
in that way.

12:28.160 --> 12:34.940
We'll only ever cast once and every subsequent time after that that we need those classes, we can retrieve

12:34.940 --> 12:35.450
them.

12:35.450 --> 12:41.450
So what I'm going to do is copy these four key variables in aura widget controller and paste them just

12:41.450 --> 12:42.320
beneath.

12:42.350 --> 12:48.050
The only difference now is that we're going to change their types.

12:48.080 --> 12:56.090
The A player controller will now be aura player controller and its type will be a aura player controller.

12:56.120 --> 12:58.820
Now we're going to forward declare that type.

12:58.820 --> 13:05.420
So we're going to go up to our forward declarations here and we're going to forward declare aura player

13:05.420 --> 13:10.850
controller and we can forward declare the others to a or a player state.

13:11.740 --> 13:19.300
We can forward declare you or ability system component and we can forward declare you or a attribute

13:19.300 --> 13:19.990
set.

13:21.300 --> 13:28.020
And we can have the four key variables that are more specific here and they'll be lazily casted.

13:28.020 --> 13:31.800
In other words, the first time we need them, we'll get that cast.

13:31.800 --> 13:33.840
If we never need them, we'll never cast.

13:33.870 --> 13:36.060
So we have a player controller.

13:36.090 --> 13:41.520
The next will be an A or a player state called or a player state.

13:41.550 --> 13:48.080
Next we'll have you or a ability system component called or a ability system component and you or a

13:48.090 --> 13:51.090
attribute set called or a attribute set.

13:51.090 --> 13:57.750
And now that we have these four key variables, I'd like to make public functions that can retrieve

13:57.750 --> 13:58.260
them.

13:58.260 --> 14:02.340
And these functions are going to be used to cast.

14:02.370 --> 14:06.780
If these variables are null now, they'll just be protected.

14:06.870 --> 14:15.930
So we'll have a function returning an A or a player controller pointer and we'll call it get or a PC.

14:17.100 --> 14:25.180
We'll have one that returns a player state that does the same thing A or a player state get or a PS,

14:26.230 --> 14:29.320
We'll have one that returns the ability system component.

14:30.260 --> 14:35.840
Called get or ask, and we'll have one that returns the attribute set.

14:36.170 --> 14:38.990
Called get or as.

14:39.940 --> 14:42.970
And these functions can all be defined.

14:45.650 --> 14:50.690
And what they'll do is cast if their corresponding pointers are null.

14:50.720 --> 14:52.400
Otherwise they'll return them.

14:52.400 --> 15:00.080
So we'll say in Git or APC if Ora player controller is null.

15:02.590 --> 15:10.030
Then we'll say or a player controller equals cast to a or a player controller.

15:11.650 --> 15:12.970
Player controller.

15:14.100 --> 15:15.690
And then we'll return it.

15:15.870 --> 15:18.480
Return or a player controller.

15:18.630 --> 15:25.410
So in other words, if a player controller has not yet been cast successfully, then we'll cast it and

15:25.410 --> 15:26.210
return it.

15:26.220 --> 15:30.780
But if it's not a null pointer, we'll just return it without the cast.

15:30.810 --> 15:35.370
Now, as soon as I use this type I got or a player controller auto included for me.

15:35.370 --> 15:36.780
So don't forget that part.

15:37.110 --> 15:43.030
Now for get or a PC, this is for the player controller we're going to copy these lines for get or PS

15:43.140 --> 15:43.860
only.

15:43.860 --> 15:48.420
The difference will be this is or a player state that we're setting.

15:48.660 --> 15:53.250
So we'll say or a player state equals a cast to a or a player.

15:53.250 --> 15:55.110
State player.

15:55.110 --> 15:55.890
State.

15:58.000 --> 16:00.820
And will return or a player state from this.

16:01.210 --> 16:06.760
We'll do the same thing for the ASC and the A's so I can quickly time lapse the rest of these.

16:28.000 --> 16:34.780
Okay, so we have these four getters that we can use to always access the aura versions of our four

16:34.810 --> 16:36.070
key variables.

16:36.310 --> 16:42.340
Now that I've added these member variables to Aura widget controller, I need to just try to compile

16:42.340 --> 16:49.420
and see if we get any errors for using any identifiers that have these names in child classes.

16:49.420 --> 16:52.780
And it looks like we are, we're using them.

16:52.780 --> 16:56.350
It looks like an overlay widget controller so we can go to that.

16:57.970 --> 17:00.310
Here in broadcast initial values.

17:00.340 --> 17:03.220
We're casting two aura attributes set.

17:03.250 --> 17:08.440
We're using cast checked also, but really we don't need to use a cast at all.

17:08.470 --> 17:12.760
All we have to do is call get aura as

17:15.670 --> 17:16.450
an aura.

17:16.450 --> 17:22.750
Attribute set is actually now a member variable that will be set when we call get aura As So we don't

17:22.750 --> 17:25.750
even need this local variable here.

17:25.750 --> 17:32.830
Instead we'll just replace aura attribute set with get aura as and that's going to satisfy it.

17:32.860 --> 17:39.480
We're also using Aura player State as a local variable here in bind callbacks to dependencies.

17:39.490 --> 17:43.270
Once again, we don't need cast checked here.

17:43.270 --> 17:50.350
We can just use aura player state so we can remove the local variable and use get aura player state

17:50.350 --> 17:51.700
which is PS.

17:55.870 --> 17:58.330
In place of a player state here.

17:59.080 --> 18:06.580
Here we're getting or attribute set we don't need to use or attribute set we can use, get or raise

18:06.580 --> 18:07.530
instead.

18:07.540 --> 18:11.800
So right here where we're using it, we're going to call get auras.

18:12.010 --> 18:15.850
So we're using it here, here and here as well.

18:15.850 --> 18:20.800
Now here we're casting ability system component to aura as well.

18:20.800 --> 18:23.530
Instead, we can just call get aura ASC.

18:23.920 --> 18:30.610
Now if we call get Aura ASC right here in the If statement that will set our aura ability system component

18:30.610 --> 18:35.590
and then each subsequent time we call it we will not cast again, we will just retrieve it.

18:35.590 --> 18:38.650
So we'll just replace all uses of it there.

18:38.680 --> 18:45.670
Now in on initialize startup abilities, the whole reason for all this, we're using our aura ability

18:45.670 --> 18:48.070
system component right here.

18:48.340 --> 18:50.590
I'd like to replace it with Aura ASC.

18:51.340 --> 18:53.930
In fact we can use control H here.

18:54.620 --> 19:01.340
And search for aura ability system component and replace with jet aura ask.

19:02.690 --> 19:05.690
Now, if I click replace here, it'll replace it.

19:05.720 --> 19:11.390
I can click the up arrow to go up to other uses, but I have to be careful here because we don't want

19:11.390 --> 19:13.160
to replace it everywhere.

19:13.190 --> 19:19.130
On initialized startup abilities takes an input parameter called aura ability system component.

19:19.160 --> 19:21.250
We don't want to replace it there.

19:21.260 --> 19:25.160
We want to actually change the name of this input parameter.

19:25.190 --> 19:32.480
Now, usually adding in to the input parameter is a nice way to just make sure that it's not the same

19:32.480 --> 19:33.710
name as anything else.

19:33.740 --> 19:39.740
We need to change it in overlay widget controllers as well, so we'll replace it with in there.

19:39.740 --> 19:47.900
But we can also replace aura ability system component by just highlighting here control H searching

19:47.900 --> 19:54.620
for aura ability system component and we can skip all instances that we don't want to change.

19:54.620 --> 19:56.450
So we want to change this one.

19:56.450 --> 19:58.970
Replace for the capture list.

19:58.970 --> 20:01.820
We're going to keep aura ability system component.

20:01.820 --> 20:02.760
There.

20:02.760 --> 20:08.370
In fact, we don't really need to capture it anymore because we're capturing this.

20:08.370 --> 20:11.550
And that's where aura ability, system component exists.

20:11.820 --> 20:19.260
So what we can do instead is remove this from the capture list now and just use the member variable

20:19.260 --> 20:21.840
aura ability system component in the lambda.

20:21.870 --> 20:23.040
That's fine.

20:23.340 --> 20:24.120
Okay.

20:24.300 --> 20:32.970
Now here in on XP changed if we replace aura player state right here with get aura ps, then we get

20:32.970 --> 20:39.810
red squiggles saying that we can't convert this argument from type const overlay widget controller to

20:39.810 --> 20:44.370
type aura widget controller function is missing const qualifier.

20:44.400 --> 20:48.180
Now that's because on xp changed is a const function.

20:48.180 --> 20:53.790
So if we're going to be calling get aura here we have to remove const from on XP changed.

20:53.790 --> 20:56.910
So we're just going to remove const from on XP changed.

20:57.950 --> 21:00.530
As it can no longer be a const function.

21:00.530 --> 21:03.710
And now we don't need this or a player state.

21:03.740 --> 21:05.960
We can use get or ops here.

21:06.380 --> 21:11.630
And by the way, the first time we call git or Ops in any of these functions, we're pretty safe to

21:11.630 --> 21:15.140
access or a player state after that in the function.

21:15.380 --> 21:17.570
So that's another thing to be aware of.

21:17.720 --> 21:20.630
I'm going to compile, see if there's anything else we missed.

21:20.870 --> 21:26.220
And we're using or a player state in attribute menu widget controller.

21:26.270 --> 21:32.750
So what we can do here is instead of casting again, we can use Git or a PS.

21:34.680 --> 21:37.350
And we don't need or a player state here.

21:37.920 --> 21:39.630
In addition, we're casting.

21:39.660 --> 21:45.960
As for the aura attribute set, instead we can call get aura as here.

21:49.270 --> 21:51.240
So get auras.

21:51.430 --> 21:54.490
Now, we don't need this cast checked.

21:54.820 --> 21:57.520
We can still check attribute info if we like.

21:58.000 --> 21:58.930
Okay.

21:59.320 --> 22:06.640
Control shift B again and we have one more in attribute menu player controller and broadcast initial

22:06.640 --> 22:07.450
values.

22:07.480 --> 22:08.830
We don't have to cast here.

22:08.830 --> 22:13.900
We can call get aura ps and with that.

22:15.200 --> 22:17.450
We should be good to go.

22:17.480 --> 22:19.970
One last compile and it's successful.

22:20.450 --> 22:27.260
Okay, so what we just did by doing all that was eliminated repetitious casting.

22:27.290 --> 22:32.670
Now, those casts will only be performed once and never if they never need to be.

22:32.690 --> 22:41.330
And because of that, we now have easy ways to access those four key variables here which are cast to

22:41.330 --> 22:42.800
the Or versions.

22:42.860 --> 22:45.260
So I can close attribute menu widget controller.

22:45.260 --> 22:46.310
We're done with that.

22:46.310 --> 22:53.320
And what I'm interested in now is a function that does what our on initialized startup abilities does,

22:53.330 --> 23:01.940
namely it creates a delegate, it binds a lambda to that delegate and calls the asks for each ability

23:01.940 --> 23:03.230
with that delegate.

23:03.410 --> 23:12.230
So really what this function does is it forces a broadcast for all abilities broadcasting their ability

23:12.230 --> 23:19.440
info with the ability info delegate and really it doesn't even need to take in the aura ability system

23:19.440 --> 23:20.040
component.

23:20.040 --> 23:22.080
It can get it with get or ask.

23:22.740 --> 23:30.450
So this could be a function on or a widget controller called simply something like broadcast ability

23:30.450 --> 23:32.670
info or something like that.

23:33.500 --> 23:39.590
So here on Aura widget controllers, I'm going to add a function for that.

23:39.770 --> 23:44.480
It'll be void called broadcast ability info.

23:45.480 --> 23:47.670
And broadcast ability info.

23:48.610 --> 23:53.560
Is going to do basically what on initialized startup abilities does.

23:53.590 --> 23:56.050
In fact, I'm going to copy the lines in it.

23:56.720 --> 23:59.840
Come back to Aura widget controller and paste them in here.

23:59.900 --> 24:02.570
Now it's trying to usability info.

24:02.840 --> 24:10.880
Now if ability info is a data asset member variable on overlay widget controller and it turns out we

24:10.880 --> 24:16.550
need it in multiple widget controllers, why don't we just move that to Aura widget controller as well?

24:16.790 --> 24:18.170
I'm going to go ahead and do that.

24:18.170 --> 24:24.290
I'm going to cut it and paste it in Aura widget controller in the protected section, and now it's inherited

24:24.290 --> 24:27.410
by all widget controllers and we can use it here.

24:27.680 --> 24:35.030
That means we have an incomplete type that we need to not only forward declare here in aura widget controller

24:35.030 --> 24:36.530
you ability info.

24:36.560 --> 24:38.510
We'll make sure to do that.

24:41.520 --> 24:47.700
But we'll also include it in or a widget controller and we can steal that include from here in overlay

24:47.700 --> 24:49.870
widget controller right here.

24:49.890 --> 24:55.500
Ability info will paste it right up in or a widget controller as well.

24:56.460 --> 25:01.020
Now or a widget controller has this broadcast ability info function.

25:01.170 --> 25:03.000
This is nice and handy.

25:03.000 --> 25:08.830
We can use it in overlay widget controller instead of on initialize startup abilities.

25:08.850 --> 25:11.070
So let's find where we're calling that.

25:11.760 --> 25:13.360
We're calling it right here.

25:13.380 --> 25:17.190
Now, instead, we can call broadcast.

25:18.460 --> 25:19.690
Ability info.

25:20.200 --> 25:26.290
And now this function is inherited so we can call it in spell menu widget controller as well.

25:26.290 --> 25:31.930
And overlay widget controller no longer needs on initialize startup abilities.

25:32.080 --> 25:33.850
Now of course ability is given.

25:33.850 --> 25:38.470
Delegate is binding on initialized startup abilities to it.

25:39.050 --> 25:41.330
And abilities given delegate.

25:41.360 --> 25:48.920
If we go and just peek at it in our ability system component or ability system component class, it's

25:48.920 --> 25:54.410
an ability is given which requires a you or a ability system component pointer.

25:54.440 --> 25:57.940
We could change this to no longer take an input parameter.

25:57.950 --> 26:05.930
We can just go ahead and remove that input from it, change it from one param to a delegate that doesn't

26:05.960 --> 26:16.880
take parameters and make sure that when we broadcast it in the CPP file abilities given delegate when

26:16.880 --> 26:19.610
we broadcast it, we don't pass this in.

26:22.150 --> 26:28.630
So we can remove that in both cases where we're using it and then overlay widget controller doesn't

26:28.630 --> 26:31.630
need to bind on initialized startup abilities.

26:31.660 --> 26:37.630
Now it can bind the inherited broadcast ability info function.

26:38.310 --> 26:44.640
So here in overlay widget controller, we can replace this with broadcast ability info instead and then

26:44.640 --> 26:49.050
we can remove that function altogether as it's now redundant.

26:49.080 --> 26:56.760
We can take on initialize startup abilities, cut it completely out both here in the CPP file and in

26:56.760 --> 26:57.840
the header file.

26:59.070 --> 27:04.650
Now we have to compile to make sure that we haven't broken things elsewhere in the code just in case

27:04.650 --> 27:06.990
anything else is listening to that.

27:06.990 --> 27:09.180
Delegate abilities given delegate.

27:09.180 --> 27:11.700
But it looks like that was the only thing.

27:11.880 --> 27:18.630
So now we've just rearranged our code a great deal, but now or a widget controller has the ability

27:18.630 --> 27:26.880
to broadcast ability info and overlay widget controller is just using broadcast ability info here.

27:27.900 --> 27:34.920
Now for that reason, this is kind of nice because spell menu widget controller can make use of broadcast

27:34.950 --> 27:37.840
ability info and we'll do that soon.

27:37.860 --> 27:42.720
We can do it as soon as we broadcast initial values, for example.

27:42.840 --> 27:49.740
But we do need to make sure that a spell menu widget controller actually gets constructed and has its

27:49.770 --> 27:56.160
key values set and we need a way to access the spell menu widget controller easily.

27:56.160 --> 28:00.540
So or a ability system library comes to mind.

28:00.540 --> 28:05.580
So we're going to need to do all that and we'll do that in the next video where we actually construct

28:05.580 --> 28:11.310
a spell menu, widget controller, and then we'll make use of broadcast ability info before we do all

28:11.310 --> 28:11.850
that.

28:11.880 --> 28:17.550
Since we made lots of changes, I just want to make sure everything still works, especially with the

28:17.550 --> 28:18.180
overlay.

28:18.210 --> 28:24.240
We want to make sure our overlay widget controller is broadcasting the abilities that we have equipped

28:24.270 --> 28:27.360
and that we can see them in the overlay at least.

28:29.020 --> 28:32.530
So all we need to do here is press play and there's our ability.

28:32.530 --> 28:38.080
And we can also check in multiplayer, make sure the client sees its equipped ability as well.

28:38.080 --> 28:38.620
And it does.

28:38.620 --> 28:39.970
So things are working.

28:39.970 --> 28:43.630
So excellent job and we'll continue in the next video.

28:43.660 --> 28:44.770
I'll see you soon.
