WEBVTT

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

00:07.800 --> 00:15.750
Now we just cheated and gave this goblin a whole bunch of XP that we can gain when we kill it, and

00:15.750 --> 00:21.060
we saw that when we got a triple level up, we only got one spell point as a reward.

00:21.090 --> 00:22.350
We're going to fix that.

00:22.350 --> 00:27.150
And that also indicates that we probably should have more attribute points.

00:27.150 --> 00:32.700
If we kill this thing, we should probably get three attribute points where we only get one.

00:32.700 --> 00:36.900
So let's go ahead and fix that issue now.

00:36.900 --> 00:38.610
So I'm going to close out of the editor.

00:38.610 --> 00:44.190
And this spell point awarding business is done in our attribute set.

00:44.220 --> 00:44.880
Right.

00:44.880 --> 00:51.570
So we can go into the private ability system folder or an attribute set and search for where we're giving

00:51.570 --> 00:52.560
spell points.

00:52.560 --> 00:57.480
I'm just going to search for spell points and that's in handle incoming XP.

00:57.960 --> 01:04.050
So based on how much XP comes in, that's when we know how many times we've leveled up.

01:04.050 --> 01:05.820
In fact, we have that here.

01:05.850 --> 01:07.050
NUM level ups.

01:07.050 --> 01:09.330
And if it's greater than zero we're leveling up.

01:09.330 --> 01:11.250
But here's the folly.

01:11.340 --> 01:18.540
If I leveled up more than once, it doesn't really matter because I'm calling add to attribute points

01:18.570 --> 01:24.780
passing in our attribute points reward, which we're calculating here from the current level.

01:24.810 --> 01:28.050
So that's not exactly what we want to do.

01:28.080 --> 01:35.070
We want to accumulate our spell points and attribute points for every single level that we just leveled

01:35.070 --> 01:35.490
up.

01:35.490 --> 01:37.530
We want all the credit here.

01:37.560 --> 01:38.100
Right?

01:38.100 --> 01:40.380
Then we can add to player level.

01:40.380 --> 01:43.500
We can add to attribute points, add to spell points.

01:43.500 --> 01:46.680
So we need to do this a little bit differently.

01:46.680 --> 01:48.000
Now add to player level.

01:48.000 --> 01:48.780
That's fine.

01:48.780 --> 01:50.940
We're adding the number of level ups.

01:50.940 --> 01:57.180
But our spell points and attribute points rewards I'm going to move those down below that because those

01:57.180 --> 01:59.370
need to be a little bit different.

02:00.120 --> 02:05.850
So we know the number of level ups I think we should do a for loop this many times.

02:05.850 --> 02:12.510
If we leveled up three times, we should do a for loop with three iterations and find out the attribute

02:12.510 --> 02:16.470
points reward for each level that we've surpassed.

02:16.470 --> 02:18.720
So I'm going to make a for loop here.

02:18.720 --> 02:25.710
And I'm going to say for int 32 I equals zero we'll start off at zero.

02:25.740 --> 02:29.070
We'll have I is less than num level ups.

02:29.860 --> 02:34.900
And plus, plus I or I plus plus whatever is your style.

02:34.900 --> 02:40.150
And we're going to add two spell points reward and attribute points reward.

02:40.150 --> 02:46.170
So I'm actually going to change these to be non-const and start them off at zero.

02:46.180 --> 02:50.650
So attribute points reward is zero, spell points reward is zero.

02:50.650 --> 02:54.580
And we'll go through each level that we've leveled up.

02:54.580 --> 02:59.890
So we can say what's our current level before we've added to it.

03:00.190 --> 03:00.610
Right.

03:00.610 --> 03:03.550
Current level plus I.

03:04.160 --> 03:05.870
The first time it'll be zero.

03:05.870 --> 03:08.810
So we'll get the spell points reward for the current level.

03:08.810 --> 03:14.690
And then when I is one we'll get spell points reward for the current level plus one and so on.

03:14.720 --> 03:16.360
So here's what it can look like.

03:16.370 --> 03:21.530
We can take our spell points reward and say plus equals.

03:21.530 --> 03:23.900
And we can take our AI player interface.

03:23.900 --> 03:28.280
And we can call execute get spell points reward.

03:28.790 --> 03:32.090
And this requires first of all props dot character.

03:32.090 --> 03:32.360
Right.

03:32.360 --> 03:34.100
That's the source character.

03:34.460 --> 03:37.520
And then what level are we evaluating at.

03:37.550 --> 03:40.940
We're evaluating at current level plus AI.

03:41.390 --> 03:44.900
So we'll do this num level ups times.

03:45.080 --> 03:48.830
So we get the reward for the current level before we leveled up.

03:48.830 --> 03:50.900
And then the next one and the next one.

03:50.900 --> 03:53.300
However many times we have leveled up.

03:53.300 --> 03:56.540
And we'll do the same thing for attribute points reward as well.

03:56.540 --> 03:59.570
We'll take attribute points reward plus equals.

03:59.600 --> 04:03.140
We'll say AI player interface execute.

04:03.140 --> 04:09.320
And this time we're going to get attribute points reward using props dot source character.

04:09.320 --> 04:12.980
And we're going to use current level plus AI.

04:14.710 --> 04:19.750
So now we have the right number of spell points and attribute points.

04:19.750 --> 04:22.810
And we're going to add to those down here.

04:23.720 --> 04:24.590
All right.

04:24.590 --> 04:26.840
So that fixes that problem.

04:26.840 --> 04:27.950
At least it should.

04:27.980 --> 04:29.270
We need to test it though.

04:29.270 --> 04:31.430
Let's go ahead and compile and launch.

04:31.520 --> 04:35.210
And then we'll see any other issues we have if there are any.

04:37.210 --> 04:39.130
Okay, so we're back in the editor.

04:39.130 --> 04:41.160
Let's try a multiple level up.

04:41.170 --> 04:42.520
I'm going to press play.

04:43.090 --> 04:45.010
I'm in multiplayer here.

04:45.010 --> 04:46.330
I have zero spell points.

04:46.330 --> 04:49.120
I'm at level one going to kill this thing.

04:49.210 --> 04:52.930
I'm now at level four, so I've leveled up three times.

04:52.960 --> 04:53.500
Look at that.

04:53.500 --> 04:55.150
I have three spell points.

04:55.300 --> 04:57.160
I even have three attribute points.

04:57.160 --> 05:00.340
I can spend those and I can spend my spell points.

05:00.340 --> 05:04.720
I can buy this one, I can buy this one, and I can buy that one.

05:04.720 --> 05:06.880
And we can go ahead and equip them.

05:06.880 --> 05:09.730
And it looks like it's working in the HUD.

05:09.760 --> 05:15.910
But since we're in multiplayer, why don't we just see what happens in multiplayer?

05:15.910 --> 05:17.860
So I'm going to go ahead and level up.

05:21.230 --> 05:25.640
And I have spell points, I'm going to spend a point and equip it.

05:25.820 --> 05:27.830
Oh, what's going on here?

05:27.860 --> 05:29.030
There's an issue.

05:29.030 --> 05:32.240
So when I close it and open it though it's there.

05:32.240 --> 05:33.800
So something isn't working.

05:33.800 --> 05:38.470
Something is, but something is kind of amiss.

05:38.480 --> 05:41.600
So we need to find out what's going on there.

05:41.990 --> 05:50.030
Now whenever we click on one of these buttons in our equipped abilities row, we're calling a blueprint

05:50.030 --> 05:51.320
callable function.

05:51.320 --> 06:00.560
And that blueprint callable function, if we go to our UI widget controller, spell menu, widget controller

06:00.560 --> 06:02.210
and search for globe.

06:03.330 --> 06:12.270
We have spell row globe pressed and this is calling Server Equip ability and server equip ability is

06:12.270 --> 06:15.270
on the ask our ability system component.

06:15.270 --> 06:17.220
And it's a server RPC.

06:17.220 --> 06:19.560
So it's executed on the server.

06:19.560 --> 06:25.230
So I'm going to close spell menu Widget controller and go back to Aura Ability System component in the

06:25.230 --> 06:30.840
cpp file and look for Server Equip ability.

06:30.840 --> 06:36.450
Now here in Server Equip Ability we're gathering some information here.

06:36.480 --> 06:39.210
We're clearing abilities with this slot.

06:39.240 --> 06:41.670
We're clearing the slot of this ability.

06:41.670 --> 06:45.840
We're changing ability tags marking the ability spec dirty.

06:45.840 --> 06:52.710
But really the only reason our spell menu catches wind of all these changes is with client equip ability.

06:52.740 --> 07:00.510
Client seems to imply a client RPC, but when I see the definition of client equip ability, I don't

07:00.510 --> 07:07.350
see an underscore implementation here, which seems to suggest that this is not actually an RPC.

07:07.830 --> 07:12.630
Let's go back and search in the header file for client equip ability.

07:12.630 --> 07:19.920
And sure enough, it's not even a client RPC, so that would help if it were actually an RPC.

07:20.250 --> 07:24.360
And then our client could catch wind of it.

07:24.360 --> 07:27.810
So we're going to add a new function with client reliable.

07:29.320 --> 07:34.020
As these equip spell functions are extremely important.

07:34.030 --> 07:40.390
And with that, we can go back and make sure client equip ability has implementation.

07:41.960 --> 07:44.020
And now it's a proper RPC.

07:44.360 --> 07:48.620
It should be executed on the client when it's called from the server.

07:48.620 --> 07:50.810
So with that we can restart.

07:50.810 --> 07:53.780
So I'm going to make sure that I don't have any unsaved changes.

07:53.780 --> 07:55.010
It looks like I don't.

07:55.010 --> 08:03.260
And from writer I can just hit the rerun which is going to close out of the editor and compile and launch

08:03.290 --> 08:04.400
again for me.

08:04.400 --> 08:06.830
So rerun is a nice little feature.

08:07.100 --> 08:11.960
So again, I mentioned this in a previous video, but rerun is a nice little feature.

08:13.670 --> 08:19.190
Okay, so we're back and I'm going to press play first thing and open up my client window and level

08:19.190 --> 08:19.580
up.

08:22.740 --> 08:23.180
Okay.

08:23.190 --> 08:23.940
Leveled up.

08:25.060 --> 08:28.780
And let's see what happens if I spend a point.

08:28.810 --> 08:29.830
Hit equip.

08:30.070 --> 08:32.620
Select a passive slot.

08:32.650 --> 08:33.710
There we go.

08:33.730 --> 08:34.870
It's in there.

08:34.870 --> 08:36.580
It's looking right.

08:36.580 --> 08:40.180
And we can do the same thing for another ability.

08:40.180 --> 08:42.780
We can even take the ability and push out the other one.

08:42.790 --> 08:45.970
We can buy this ability and we can equip it there.

08:46.090 --> 08:47.740
Our HUD is working.

08:47.740 --> 08:52.290
So as far as the HUD for our passive abilities, things are working right.

08:52.300 --> 08:53.530
This is looking good.

08:53.650 --> 08:55.180
Now here's the problem.

08:55.210 --> 09:00.880
Our passive abilities are not abilities that we're going to activate with our input.

09:00.910 --> 09:01.900
Left mouse button.

09:01.900 --> 09:02.950
Right mouse button.

09:02.950 --> 09:03.520
One key.

09:03.520 --> 09:04.240
Two key.

09:04.270 --> 09:06.670
Those are for offensive abilities.

09:06.700 --> 09:13.600
Our passive abilities, at least the way that I've designed this game project, are going to be activated

09:13.600 --> 09:18.940
when we equip them right down here in our equipped abilities row.

09:18.970 --> 09:21.610
That's how I'd like my passive abilities to work.

09:21.610 --> 09:27.430
That's how most passive abilities work in RPG games, so you don't click while you're running around

09:27.430 --> 09:31.270
in the world with a certain button and say, activate my passive ability.

09:31.300 --> 09:33.740
No, that would be an offensive ability.

09:33.760 --> 09:39.940
Passive abilities are different passive abilities you select in the menu once they're selected.

09:39.940 --> 09:43.810
Once they're equipped, they become active and they stay active.

09:43.840 --> 09:45.910
Now, when do they stop becoming active?

09:45.910 --> 09:48.910
When you push them out of the row.

09:48.940 --> 09:51.700
In this case, it's a column of two abilities.

09:51.700 --> 09:54.370
So say I have the red and the blue here.

09:54.370 --> 09:56.920
They're active and I decide I want the yellow.

09:56.920 --> 10:00.430
So I'm going to click equip and select the red.

10:00.460 --> 10:02.530
Now the red should be deactivated.

10:02.530 --> 10:04.390
We should end that ability.

10:04.390 --> 10:10.120
And the yellow ability Halo of protection it's called should be activated at that point.

10:10.150 --> 10:12.010
That's the behavior that I'd like.

10:12.010 --> 10:15.360
And that's what we're going to implement in the videos to come.

10:15.370 --> 10:16.810
So we'll do that next.

10:17.400 --> 10:18.300
I'll see you soon.
