WEBVTT

00:00.640 --> 00:02.590
Welcome to your next quest.

00:02.950 --> 00:06.790
I'd like you to show the spell points in our spell menu.

00:06.820 --> 00:10.300
We already have spell points and we're already updating them.

00:10.300 --> 00:14.340
It's just up to us to show them in the menu.

00:14.350 --> 00:17.200
And I'd like you to make sure they update when leveling up.

00:17.200 --> 00:19.960
So that's another important aspect of it.

00:20.080 --> 00:22.810
So pause the video and conquer your quest.

00:26.030 --> 00:26.600
Okay.

00:26.600 --> 00:34.040
So what I want is to show my spell points, which means I need them to start off at the correct value

00:34.040 --> 00:36.860
and update every time they change.

00:37.130 --> 00:42.980
So I'm going to go back into C plus plus into my spell menu widget controller.

00:42.980 --> 00:46.520
And here is where I need to do something.

00:47.350 --> 00:49.600
Now for broadcast initial values.

00:49.600 --> 00:56.620
I'm going to need to get the spell points from my player state as that's where they are.

00:56.650 --> 01:04.780
Now I can get or a player state this get aura PS and associated similar functions are very convenient

01:04.780 --> 01:05.380
here.

01:05.920 --> 01:15.430
So get RFPs can allow me to get my spell points and of course or a player state now exists in the spell

01:15.460 --> 01:17.890
menu Widget controller CBP file.

01:18.280 --> 01:20.500
Now what do I do with the spell points?

01:20.500 --> 01:27.130
Well, I'm going to need a delegate I can broadcast my spell points with, so I'm just going to comment

01:27.130 --> 01:35.410
that out and set it aside for a second and take a look at what I've got in my parent class in UI widget

01:35.410 --> 01:37.990
controller or a widget controller.

01:38.170 --> 01:38.710
Why?

01:38.740 --> 01:46.990
Because I have a really nice delegate for broadcasting these integer stats on player stat change signature.

01:46.990 --> 01:50.320
I'm going to put one of those in my spell menu widget Controller.

01:50.320 --> 01:56.620
So in spell menu widget controller, I'm going to go into the header file and just stick one of these

01:56.620 --> 02:06.490
in here on player stat change signature and I'm going to call it spell points changed.

02:06.490 --> 02:11.920
I'm going to make it a new property with Blueprint assignable.

02:12.490 --> 02:19.870
That way we can assign it in blueprint and I'm going to broadcast it right in broadcast initial values.

02:19.870 --> 02:26.260
I'm going to say spell points, change broadcast and pass in the spell points that I get from Aura.

02:26.270 --> 02:29.080
PS the Aura player state.

02:30.040 --> 02:33.580
So broadcasting the initial values was quite easy.

02:33.610 --> 02:40.360
Let's see if it's just as easy to bind a callback or a lambda for when it changes.

02:40.450 --> 02:44.260
Now I'm going to just go ahead and close other tabs.

02:44.290 --> 02:49.840
All but this one and go into my player folder, into aura player controller.

02:49.870 --> 02:52.570
No, not player controller or a player state.

02:52.570 --> 02:56.890
And it looks like we have some delegates broadcast here too.

02:56.920 --> 02:59.200
We have on spell points change delegate.

02:59.230 --> 03:05.950
Let's see if we're actually broadcasting those here in Aura Player State dot CP And it looks like we

03:05.950 --> 03:11.060
are broadcasting these thanks to having already taken care of this stuff.

03:11.080 --> 03:15.510
We have add to spell points and then we're broadcasting the delegate.

03:15.520 --> 03:20.860
I don't think there's even a setter for spell points, so we're pretty sure that on spell points change

03:20.860 --> 03:25.840
delegate is broadcast, so spell menu widget controller can bind to it.

03:26.820 --> 03:31.620
So I'm going to call get Ora plays for Player State.

03:31.650 --> 03:34.920
I'm going to get that spell points change delegate.

03:34.920 --> 03:36.600
It's called on spell points change.

03:36.600 --> 03:42.420
Delegate And I'm going to add a lambda, so let's add a lambda to it.

03:44.440 --> 03:47.290
And what do I need to broadcast?

03:47.290 --> 03:49.270
I just need to broadcast my spell.

03:49.270 --> 03:50.920
Points change delegate.

03:51.820 --> 03:56.410
So basically the same thing I did up there for broadcast initial values.

03:56.770 --> 04:01.030
Now we need to capture this if we're going to broadcast that delegate.

04:01.240 --> 04:04.990
And with that, we now have our lambda bound.

04:05.020 --> 04:08.320
Now we just need to test it out and see if it works.

04:09.930 --> 04:10.330
Okay.

04:10.330 --> 04:12.020
It looks like I was a little hasty here.

04:12.030 --> 04:13.650
Hopefully you weren't this hasty.

04:13.680 --> 04:18.460
We got this error tuple invoke no matching overloaded function found.

04:18.480 --> 04:26.010
Well, that's because we're binding a lambda to a delegate not designed for a lambda or function with

04:26.010 --> 04:31.830
this signature because spell points change delegate is supposed to broadcast an int, which means I

04:31.830 --> 04:34.500
didn't need to call get spell points in here.

04:34.500 --> 04:37.020
I can just receive the int in my lambda.

04:37.050 --> 04:43.980
It takes an int 32 called spell points and I can just use that right here.

04:44.960 --> 04:48.500
So easy mistake to make, but that should fix it.

04:49.930 --> 04:51.520
So back here in the editor.

04:51.700 --> 04:58.130
My spell menu now needs to handle the broadcast of that delegate for spell points.

04:58.150 --> 05:01.930
So here in spell menu, I can open up spell menu.

05:01.930 --> 05:05.060
And right here, this is my framed value.

05:05.080 --> 05:13.210
I'm going to rename it now to framed value underscore spell points and make it a variable.

05:13.240 --> 05:21.610
So now that it's a variable, we'll come back here into our event graph and we need to do something

05:21.610 --> 05:23.620
for our spell points.

05:23.620 --> 05:31.660
And before broadcasting initial values, we need to get our BP spell menu widget controller and we need

05:31.660 --> 05:36.940
to assign on spell points change or just spell points changed.

05:36.940 --> 05:37.690
It's called.

05:38.650 --> 05:43.260
And I'm going to do this before broadcasting initial values.

05:43.270 --> 05:49.960
So we'll add a pen and I'm going to hold control and click this wire and move it to that one.

05:49.960 --> 05:51.160
Isn't that amazing?

05:51.160 --> 05:54.400
And I'll go ahead and stick this one in.

05:54.400 --> 06:00.220
And when spell points change, we need to update our frame value.

06:00.250 --> 06:00.910
Spell points.

06:00.910 --> 06:02.050
So we're going to get that.

06:02.840 --> 06:05.420
And from framed value spell points.

06:06.210 --> 06:10.590
I'm just going to type text and we're going to get text block value.

06:10.620 --> 06:12.870
We're going to call, set, text on it.

06:14.820 --> 06:18.360
And we're going to pass in the new value to this.

06:19.100 --> 06:21.470
And get a two text integer here.

06:21.500 --> 06:23.510
Let's just see if that works.

06:24.050 --> 06:26.760
And we have one spell point.

06:26.780 --> 06:28.820
I think we started off at one.

06:29.630 --> 06:37.790
I'm going to go to the player stage or a player state and see what Yes, we started it off at one spell

06:37.790 --> 06:38.900
point strangely.

06:38.900 --> 06:39.860
That's cool.

06:39.860 --> 06:43.910
And I'm going to level up and see if I get another one.

06:46.940 --> 06:47.480
All right.

06:47.480 --> 06:47.990
Leveled up.

06:47.990 --> 06:50.780
And we have to I'm going to level up again.

07:02.020 --> 07:02.920
There we go.

07:02.920 --> 07:03.850
And I have three.

07:03.850 --> 07:06.650
So it's working as expected.

07:06.670 --> 07:08.950
I didn't expect to start off at one.

07:08.950 --> 07:10.960
I don't know why I started it off at one.

07:10.990 --> 07:14.770
Maybe I said why at the time, but that's okay.

07:15.160 --> 07:17.320
Maybe it'll be easier to test.

07:17.320 --> 07:23.050
The next mechanics will be implementing if we start off with a spell point so that we can spend points

07:23.050 --> 07:23.860
right away.

07:23.860 --> 07:27.400
But either way, our spell points are working.

07:28.000 --> 07:33.700
I'm actually going to relaunch the editor and make sure it works in multiplayer as well.

07:33.700 --> 07:35.230
We'll test it on the client.

07:36.600 --> 07:36.990
Okay.

07:36.990 --> 07:39.570
So setting number of players to two.

07:42.440 --> 07:44.150
Checking it out on the client.

07:44.150 --> 07:46.550
We start off with one spell point.

07:49.730 --> 07:50.780
Let's level up.

07:54.340 --> 07:56.080
We have to spell points.

07:56.080 --> 08:04.540
And then another thing I'd like to really quickly check again is if we level up with those menus open.

08:05.020 --> 08:14.950
So I'm going to go back to my overlay WB overlay and disconnect the call to set input mode only.

08:14.950 --> 08:16.630
And I'm going to level up.

08:16.660 --> 08:20.320
We'll just try the client first with the spell menu open.

08:22.100 --> 08:23.480
We went up to two.

08:28.200 --> 08:29.690
We went up to three.

08:29.700 --> 08:34.560
That looks good and we can try on the server.

08:34.830 --> 08:37.980
I have no reason to think it wouldn't work, but let's try.

08:40.740 --> 08:41.700
We went up to too.

08:41.700 --> 08:42.390
Perfect.

08:42.420 --> 08:43.050
Okay.

08:43.380 --> 08:48.000
I have the feeling I'm going to be doing this many times for testing, but that's okay.

08:48.030 --> 08:54.420
So our spell menu has now taken care of updating spell points when they change.

08:54.570 --> 08:55.470
Excellent.

08:55.500 --> 08:59.100
I'm going to collapse this to a function called.

09:01.800 --> 09:05.820
Spell points changed.

09:06.690 --> 09:07.170
Okay.

09:07.170 --> 09:12.030
And I'll go ahead and comment this on spell points changed.

09:12.840 --> 09:19.560
And now we have spell points in our spell menu that look correct.

09:21.380 --> 09:23.540
I'm going to set this back to one player.

09:24.660 --> 09:25.290
Perfect.

09:25.290 --> 09:31.440
That looks a lot better with the one that 99 or whatever it was looked really awkward and weird.

09:32.090 --> 09:38.360
So this is great because now, as soon as we become eligible for one of our abilities, it's going to

09:38.360 --> 09:42.650
look like this and we should be able to spend a point on it.

09:42.650 --> 09:47.000
That means I'm going to want to click on it and select it and show it selected.

09:47.000 --> 09:52.040
And then if I can click Spend point, it should upgrade it.

09:52.040 --> 09:56.870
If it's eligible, I want it to become unlocked and show its color.

09:56.870 --> 10:02.840
And then after that, I'd like to be able to select it and click, equip and choose a slot to equip

10:02.840 --> 10:03.830
it to.

10:04.160 --> 10:07.130
So lots of really cool things coming up.

10:07.160 --> 10:08.180
Excellent job.

10:08.180 --> 10:10.520
I'll see you in the next video.
