WEBVTT

00:06.820 --> 00:07.810
Welcome back.

00:07.810 --> 00:13.720
So now that we have attribute points and we're listening to the delegate for when they change, we need

00:13.720 --> 00:17.890
to show those attribute points in our HUD in the attribute menu.

00:17.920 --> 00:24.340
Now, every time we open the attribute menu, it's being constructed another time and it's broadcast

00:24.340 --> 00:25.990
initial values is called.

00:25.990 --> 00:30.680
So we need to broadcast our attribute points, getting them from the player state.

00:30.700 --> 00:36.070
So I'm going to copy this line where we're getting our player state and paste it here in broadcast initial

00:36.070 --> 00:36.910
values.

00:36.910 --> 00:40.620
And I'm going to broadcast my attribute points change delegate.

00:40.630 --> 00:47.770
That way my widgets can pick up on that, but I'm going to broadcast the amount of attribute points

00:47.770 --> 00:53.620
we currently have, and I'm going to get that from our player state by calling get attribute points.

00:53.800 --> 00:58.570
Now that we're broadcasting our initial values here, we should be able to see them.

00:58.570 --> 01:02.410
If we bind to attribute points, change delegate.

01:02.410 --> 01:03.910
So that's our next step.

01:03.910 --> 01:06.440
Let's compile and open unreal.

01:06.860 --> 01:09.910
Okay, so we have the editor open.

01:09.920 --> 01:12.260
I'm going to open up my attribute menu.

01:12.260 --> 01:16.810
And this widget here is where I'd like to show my attribute points.

01:16.820 --> 01:18.880
Now, we have a problem, though.

01:18.890 --> 01:21.530
This is a text value row.

01:21.560 --> 01:26.510
Let's go to text value row and remind ourselves what that has.

01:26.540 --> 01:27.500
It has text.

01:27.500 --> 01:34.730
It has a value, it has a name slot and it's also doing some things here in the event graph, namely

01:34.730 --> 01:37.370
listening for attribute info delegate.

01:37.400 --> 01:40.400
Well, that's not something we need up here.

01:40.430 --> 01:42.800
We don't need to listen to attribute info.

01:42.830 --> 01:48.080
We need to listen to a different broadcast, a broadcast of our attribute points.

01:48.110 --> 01:54.050
I'm going to make a separate attribute row specifically to receive attribute points.

01:54.140 --> 02:04.220
So I'm going to take my text value row and duplicate it and call this one attribute points row.

02:05.250 --> 02:07.560
And this one doesn't need a name slot.

02:07.590 --> 02:09.000
I'm going to delete that.

02:09.090 --> 02:15.270
So it's just going to have text and the text is just going to say attribute points.

02:16.680 --> 02:18.930
And we have our value here.

02:18.960 --> 02:20.790
This framed value.

02:20.820 --> 02:24.780
Let's go into the graph and I don't need any of this stuff.

02:24.810 --> 02:32.700
I'm going to keep event pre construct, but I'm not going to bind anything to attribute info delegate.

02:32.700 --> 02:34.290
So I'm going to delete those.

02:34.500 --> 02:36.150
I don't need an attribute tag.

02:36.150 --> 02:39.630
I'm going to delete that and that's about it.

02:39.660 --> 02:46.500
Now my attribute points row is going to need my event widget controller set.

02:48.720 --> 02:55.200
Because as soon as I have my widget controller set, then I do want to assign an event to the attribute

02:55.200 --> 03:00.330
points delegate on my player state, which I can get from my widget controller.

03:00.330 --> 03:05.790
So as soon as widget controller is set I'm going to get my widget controller.

03:09.610 --> 03:13.210
And cast it to attribute menu widget controller.

03:13.210 --> 03:15.100
I'll cast to the blueprint version.

03:17.420 --> 03:20.660
After casting this, I'm going to promote it to a variable.

03:21.770 --> 03:26.360
Called BP attribute menu widget controller.

03:27.740 --> 03:31.640
And with this I can get my delegate called.

03:31.880 --> 03:35.270
Attribute points changed Delegate.

03:35.420 --> 03:38.090
So I'm going to assign an event to that.

03:38.210 --> 03:44.690
And all we need to do here is take our framed value widget.

03:45.630 --> 03:47.730
So I'm going to bring that in.

03:47.730 --> 03:51.510
And from the framed value widget, I need to set its value.

03:51.540 --> 03:56.460
Now, just to remind myself, I'm going to open up framed value and see what its text block is called.

03:56.460 --> 03:58.440
It's called text block value.

03:59.280 --> 04:03.090
So I'm going to get that text block value.

04:04.040 --> 04:05.930
And call set text on it.

04:07.490 --> 04:09.560
And I'll take that new value.

04:11.080 --> 04:13.450
That we get from our delegate broadcast.

04:13.690 --> 04:17.800
We'll drag that straight in and get a to text from integer node.

04:18.100 --> 04:23.050
And now we have something that will update based on attribute points.

04:23.110 --> 04:28.240
And I just need to replace the widget in our attribute menu.

04:28.270 --> 04:32.480
This text value row with my new attribute points row.

04:32.500 --> 04:35.350
So it needs to go right here between two spacers.

04:35.350 --> 04:42.550
First, I'm going to delete this one and then find attribute points row and drag that right there where

04:42.550 --> 04:44.440
the old one was.

04:44.470 --> 04:45.670
There it is.

04:45.700 --> 04:50.530
Now compiling my attribute points row and my attribute menu.

04:50.560 --> 04:52.090
Here's my attribute points.

04:52.090 --> 04:57.490
Row and I can check is variable because I need to set its widget controller.

04:57.880 --> 05:04.540
Now here in the attribute menu, the attribute menu sets its own widget controller by getting it with

05:04.540 --> 05:08.050
our blueprint function library to get it from the HUD.

05:08.200 --> 05:11.990
Then it calls its own broadcast initial values.

05:12.080 --> 05:20.000
Now, when it calls broadcast initial values, it well broadcasts those initial values and any other

05:20.000 --> 05:27.920
widgets who are bound to those delegates must bind to them before that broadcast happens.

05:28.100 --> 05:32.510
So we can take our new attribute points row and set its widget controller.

05:32.510 --> 05:36.410
But we have to do so before broadcasting initial values.

05:37.060 --> 05:39.880
So we're going to call set widget controller on it.

05:45.490 --> 05:48.920
And we're going to pass in the widget controller.

05:48.940 --> 05:50.680
We can just use this one.

05:50.680 --> 05:53.350
I'm going to make a root node and hook it in.

05:56.100 --> 06:02.010
And now that we're setting the widget controller on attribute points row, when it's widget controller

06:02.010 --> 06:06.420
is set, it will receive the delegate and update itself.

06:06.510 --> 06:09.540
Let's see if we get that initial value of zero.

06:09.570 --> 06:10.360
There it is.

06:10.380 --> 06:12.480
We have zero attribute points.

06:13.280 --> 06:14.210
Excellent.

06:14.330 --> 06:19.900
So now that we're showing our attribute points, it's time to make our attribute points functional.

06:19.910 --> 06:25.760
And for one, we should be getting attribute points awarded to us when we level up.

06:25.790 --> 06:28.130
As it stands, we're not because.

06:28.130 --> 06:29.960
Well, let's find out why.

06:29.990 --> 06:37.450
First of all, if we go to our attribute set, I'm going to go to aura attribute set upkeep.

06:38.150 --> 06:46.360
When our incoming exp changes and if we level up, we call these interface functions at the player level.

06:46.370 --> 06:49.160
Add two attribute points and add to spell points.

06:49.160 --> 06:53.870
Add to player level works, but add to attribute points and spell points doesn't.

06:53.900 --> 06:54.380
Why?

06:54.410 --> 06:59.630
Because when we implemented these in aura character, those functions were empty.

06:59.990 --> 07:00.770
Here they are.

07:00.770 --> 07:01.860
We have to dos.

07:01.880 --> 07:07.910
Well, we could actually take care of those two dos right now because now our player state has functions

07:07.910 --> 07:08.810
to add.

07:08.840 --> 07:15.090
Let's go ahead and get that taken care of here in Add to attribute points, we're going to take Aura

07:15.090 --> 07:19.350
player state and call add to attribute points.

07:19.870 --> 07:22.590
Passing in an attribute points.

07:22.600 --> 07:27.970
We'll do the same thing for add to spell points, even though we're not going to use that just yet.

07:28.000 --> 07:30.070
We'll go ahead and take care of it now.

07:30.070 --> 07:37.510
So we'll take our player state add to spell points, passing in in spell points.

07:38.200 --> 07:44.170
So now that we've done that, actually we should be able to see our attribute points go up when we level

07:44.170 --> 07:44.650
up.

07:45.470 --> 07:47.600
So we can actually test that out.

07:49.860 --> 07:52.500
So with a fresh compile and relaunch.

07:53.770 --> 07:56.530
I can just take a look at my attribute points.

07:56.530 --> 07:57.280
It's zero.

07:57.310 --> 07:58.450
I can level up.

08:00.130 --> 08:02.380
And now my attribute points is one.

08:02.410 --> 08:05.530
Let's try leveling up with the attribute points menu open.

08:05.530 --> 08:07.030
And there it goes to two.

08:07.700 --> 08:08.810
So it's working.

08:09.140 --> 08:12.320
So every time we level up, we get an attribute point.

08:12.350 --> 08:19.010
My next goal is to be able to spend those points on our primary attributes with these plus buttons.

08:19.010 --> 08:21.620
So we'll handle that in the videos to come.

08:21.710 --> 08:24.350
Excellent job and I'll see you soon.
