WEBVTT

00:06.850 --> 00:08.110
Welcome back.

00:08.110 --> 00:14.020
Now if I open my attribute menu, I have some buttons next to my primary attributes.

00:14.050 --> 00:20.110
I'd like to be able to upgrade my attributes whenever I have attribute points, but when I don't have

00:20.110 --> 00:23.290
attribute points, I want these buttons to be disabled.

00:23.320 --> 00:29.410
So the first step to that is enabling or disabling them based on my attribute points.

00:30.290 --> 00:32.510
And that's going to be your next quest.

00:32.990 --> 00:37.820
I'd like you to enable the attribute buttons whenever we have attribute points.

00:37.820 --> 00:40.160
So make sure that they're clickable.

00:40.160 --> 00:43.970
And when we don't have attribute points, make sure they're disabled.

00:44.000 --> 00:49.880
Now, there are a couple of different ways that you could go about this, so don't be too worried about

00:49.880 --> 00:52.790
doing it the right way or the wrong way.

00:52.820 --> 00:54.830
Do it the way that makes sense to you.

00:54.830 --> 00:59.840
And then you can watch how I do it and see if you did it the same way or maybe a little different.

00:59.870 --> 01:03.500
Go ahead and pause the video and conquer this quest now.

01:06.760 --> 01:13.780
Okay, so the goal is to disable these buttons whenever we don't have attribute points and enable them

01:13.780 --> 01:14.980
when we do.

01:15.340 --> 01:18.070
Now, there are a couple of ways to go about this.

01:18.100 --> 01:23.570
First of all, I'm going to go into my text value button row widget here and take a look at it.

01:23.590 --> 01:31.090
Now our text value button row has its own widget controller set to the attribute menu widget controller.

01:31.090 --> 01:38.200
So we can definitely know if we have attribute points or not because the attribute menu widget controller

01:38.200 --> 01:40.030
broadcasts a delegate.

01:40.060 --> 01:46.270
If we go to attribute menu widget controller, it's called attribute points changed delegate.

01:46.300 --> 01:53.350
Now it's up to us if we'd like to listen for that in each of our attribute menu button rows, we could

01:53.350 --> 01:59.770
or we could listen for that delegate only once in the attribute menu and then based on the attribute

01:59.770 --> 02:06.040
points value, if it's zero, we could disable all the buttons on these four rows, either one.

02:06.040 --> 02:07.420
I think is okay.

02:07.430 --> 02:10.850
One is not terribly more performant than the other.

02:10.850 --> 02:17.830
If we listen for the delegate and attribute menu, then we'll only have one delegate broadcast received.

02:17.840 --> 02:26.750
If we listen to it in each attribute row, then that's just more delegates being broadcast and overall

02:26.780 --> 02:30.130
more work being done, more operations being done.

02:30.140 --> 02:35.350
So I personally think I'd like to listen to one delegate here in the attribute menu.

02:35.360 --> 02:37.700
So I'm going to do that now.

02:37.700 --> 02:45.290
I need to listen for delegates on the widget controller before broadcasting initial values broadcast

02:45.290 --> 02:51.200
initial values should be the last thing done, So I'd like to put it well below everything else that

02:51.200 --> 02:52.010
we do.

02:52.430 --> 02:59.060
So my attribute menu widget controller should be promoted to a variable at this point, so I'm going

02:59.060 --> 03:00.680
to go ahead and promote it.

03:01.570 --> 03:06.010
And call it attribute menu widget controller.

03:06.010 --> 03:08.770
It's not the blueprint version, but that's okay.

03:10.070 --> 03:17.930
So I'm going to go ahead and just promote it and then set my widget controller with it and then get

03:17.930 --> 03:21.650
rid of these reroute nodes by getting.

03:22.890 --> 03:27.120
My variable I promoted and using that instead.

03:32.300 --> 03:34.130
That makes it easier to break this up.

03:34.130 --> 03:37.460
And I'm going to broadcast initial values very last.

03:39.670 --> 03:42.260
That allows me to bind to my widget controllers.

03:42.280 --> 03:45.940
Delegates here after I've set my widget controller.

03:46.090 --> 03:48.190
So I'm going to add two more pins.

03:48.820 --> 03:53.830
The fourth one will be very last broadcast initial values here.

03:59.020 --> 04:05.530
But after I've set my widget controllers here, I can then bind to a delegate on my widget controller.

04:05.530 --> 04:07.150
So I'm going to take attribute menu.

04:07.150 --> 04:08.320
Widget Controller.

04:09.730 --> 04:16.090
Drag off of it and type attribute points so I can assign attribute points change delegate.

04:16.390 --> 04:25.180
I'll go ahead and rename this event to attribute points changed and this will be my third.

04:26.030 --> 04:27.440
PIN in the sequence.

04:28.820 --> 04:34.070
Now I can do whatever I want based on the attribute points value.

04:35.260 --> 04:38.980
Now I'm going to make a function that takes in this value.

04:39.830 --> 04:41.210
So new function.

04:41.210 --> 04:44.810
I'm going to call this set buttons enabled.

04:45.440 --> 04:52.700
This will set the buttons to be enabled or disabled based on the integer passed in for attribute points.

04:52.700 --> 04:56.810
So this will be an int and it's going to be called attribute points.

04:58.010 --> 05:04.160
And in the event graph I'm going to call this function set buttons enabled and pass in that information.

05:06.350 --> 05:12.530
Now set buttons enabled is going to check the value of attribute points and see if it's greater than

05:12.530 --> 05:13.310
zero.

05:14.010 --> 05:15.540
We'll have a branch here.

05:15.540 --> 05:18.630
If it is greater than zero, we can enable all the buttons.

05:18.630 --> 05:21.930
And if it's not greater than zero, we can disable them.

05:22.080 --> 05:26.730
Now the buttons all belong to our rows for the primary attributes.

05:26.730 --> 05:27.990
So I'm going to get those.

05:27.990 --> 05:29.970
We have row intelligence.

05:30.750 --> 05:31.860
Row strength.

05:31.860 --> 05:33.180
I'll put that above it.

05:33.210 --> 05:35.070
Row resilience and row.

05:35.070 --> 05:35.820
Vigor.

05:37.010 --> 05:40.250
Each of these are text value button rows.

05:40.280 --> 05:42.620
Each text value button row.

05:42.770 --> 05:49.400
If we go and look at it, has this button I'm going to go ahead and check is variable.

05:49.400 --> 05:50.870
So now it's a variable.

05:50.870 --> 05:58.220
And in the attribute menu, I'm going to drag off and type button and get WB button.

05:58.430 --> 06:02.300
Now WB button is a widget itself, right?

06:02.330 --> 06:09.590
We can remind ourselves by going to blueprints UI button and we have a WB button and this button widget

06:09.620 --> 06:13.220
has its own button inside of it called button.

06:13.220 --> 06:18.890
So it's a little bit confusing, but to make this a little bit less confusing, we can take our text

06:18.890 --> 06:25.220
value button row and add a function on this widget to disable or enable its own button.

06:25.220 --> 06:30.560
So I'm going to add a function on it called set button enabled.

06:31.550 --> 06:38.520
And this is going to handle getting our WB button, getting its button widget.

06:38.520 --> 06:44.760
So get button on here and then calling set is enabled on it.

06:46.860 --> 06:49.470
And set button enabled can take a boolean.

06:49.500 --> 06:52.020
This just makes it a little bit less confusing.

06:52.770 --> 06:57.780
The boolean will be called enabled and it'll call set button enabled here.

06:58.850 --> 07:04.670
So now that text value button row has this function, our attribute menu doesn't have to access the

07:04.700 --> 07:05.360
button.

07:05.360 --> 07:10.250
It can just call the text value button row function set button enabled.

07:11.360 --> 07:16.280
Now, if attribute points is greater than zero, we should enable the button.

07:16.460 --> 07:23.420
So I'm going to go ahead and plug in all of these nodes to the same function call as that's a neat little

07:23.420 --> 07:24.500
trick we can do.

07:26.410 --> 07:33.790
And this results in the same thing as if we had duplicated the set button enabled function node.

07:34.590 --> 07:41.250
Now I'm going to duplicate these and paste them, but uncheck enabled and will disable the buttons in

07:41.250 --> 07:42.180
this case.

07:42.330 --> 07:45.540
If attribute points is not greater than zero.

07:45.660 --> 07:51.570
So now we have set buttons enabled which we're calling in response to attribute points changing.

07:51.870 --> 07:55.590
So all we have to do now is test it out.

07:56.480 --> 07:58.580
Now we see that our buttons are disabled.

07:58.580 --> 08:07.010
And if I level up now that I have one attribute point, my buttons are enabled and every time attribute

08:07.010 --> 08:14.810
points changes, then our attribute menu will listen and update these buttons based on the value of

08:14.810 --> 08:15.980
attribute points.

08:16.010 --> 08:23.000
So we're one step closer to implementing a working attribute menu where we can spend attribute points

08:23.000 --> 08:25.370
on our different attributes.

08:25.370 --> 08:31.220
And once we get everything working, we can fix it up cosmetically and make it look just tiptop.

08:31.730 --> 08:32.660
Excellent job.

08:32.660 --> 08:33.740
I'll see you soon.
