WEBVTT

00:07.010 --> 00:07.970
Welcome back everyone.

00:08.090 --> 00:11.930
Now we've just went about saving all of our abilities.

00:11.930 --> 00:13.820
It's now time to load them up.

00:14.270 --> 00:20.300
Now in our character in Possessed By, we're calling load progress and in load Progress.

00:20.300 --> 00:22.430
We're checking if it's our first time loading in.

00:22.430 --> 00:27.620
If not, we load up our player state variables and our attributes.

00:27.620 --> 00:31.850
But it's time to load in our abilities to now.

00:31.850 --> 00:37.130
Giving abilities is a responsibility that I'd like to leave up to the ability system component.

00:37.130 --> 00:43.700
So I like the ability system component to be able to load in abilities from disk by taking in a save

00:43.700 --> 00:45.140
data object.

00:45.140 --> 00:51.260
So I'm going to go to ability system component where we have add character abilities and add character

00:51.260 --> 00:52.730
passive abilities.

00:52.730 --> 00:57.140
I'd now like a function to add character abilities from disk.

00:57.140 --> 01:04.370
So I'm going to call this void Add character abilities from Save Data.

01:04.370 --> 01:09.620
And all I'm going to do is pass in a you load screen save game.

01:09.620 --> 01:12.890
We're going to forward declare that and call this save data.

01:12.890 --> 01:16.580
So let's go ahead and generate this definition.

01:17.120 --> 01:23.480
And all we have to do here is take the save data and loop over it saved abilities array.

01:23.480 --> 01:30.980
So we're going to say for it'll be a const f save data reference called data.

01:32.730 --> 01:37.440
And we'll loop over save data saved abilities.

01:38.580 --> 01:40.230
Now this is an F save data.

01:40.230 --> 01:42.750
It's actually F saved ability right?

01:42.750 --> 01:49.590
This is the struct we added to load screen save game to save all of our data pertaining to our abilities.

01:50.190 --> 01:53.610
So we're looping through those saved ability structs.

01:53.610 --> 01:58.830
And the first thing we should do is find out what that class is for the ability.

01:58.830 --> 02:03.270
So let's make a const t sub class of you gameplay ability.

02:06.050 --> 02:09.500
And we'll call this startup ability class.

02:10.700 --> 02:13.580
And that's going to be our data gameplay ability.

02:13.580 --> 02:14.810
So we have that.

02:15.650 --> 02:19.880
And we need to make an F gameplay ability spec for it.

02:19.880 --> 02:28.400
So we're going to say F gameplay ability spec called startup ability spec.

02:29.550 --> 02:32.520
Now, it's not really a startup ability, is it?

02:32.550 --> 02:34.500
It's actually a loaded ability.

02:34.500 --> 02:38.940
So let's call this loaded ability class and loaded ability spec.

02:40.560 --> 02:44.190
And we're just going to create a new F gameplay ability spec.

02:45.120 --> 02:53.220
Using our loaded ability class, and we need the level we're going to take data ability level.

02:54.330 --> 02:55.920
So we have a spec now.

02:55.950 --> 02:57.030
Now here's the thing.

02:57.030 --> 02:59.940
If it's passive we want to activate it.

02:59.970 --> 03:04.740
If it's not passive we just want to give the ability.

03:04.860 --> 03:09.240
So we're going to say if data dot ability type.

03:09.390 --> 03:15.420
And we'll check this ability type we need to use F or a gameplay tags get.

03:16.270 --> 03:18.610
Dot abilities type.

03:19.000 --> 03:26.470
And we'll first check offensive and we'll have an else case for the rest of them, although they might

03:26.470 --> 03:27.670
not all be passive.

03:27.670 --> 03:31.870
So we'll check data dot ability type.

03:33.100 --> 03:35.530
And we'll see if it's passive.

03:36.830 --> 03:41.330
So equals abilities type passive.

03:41.330 --> 03:43.160
Now we can't just give the ability.

03:43.160 --> 03:46.880
We also need to set its ability status and its ability slot.

03:46.880 --> 03:53.780
So we're going to take our loaded ability spec dot dynamic ability tags and add a tag.

03:54.170 --> 03:57.890
And we're going to add data dot ability slot.

03:57.890 --> 04:03.860
But we're also going to add another tag data dot ability status.

04:05.940 --> 04:10.530
And we can give the ability passing in loaded ability spec.

04:10.860 --> 04:17.370
Now we actually want to give this abilities dynamic ability tags, the ability slot and the ability

04:17.370 --> 04:21.360
status regardless of whether it's offensive or passive.

04:21.360 --> 04:26.430
So let's do that outside of the if statement and just give the ability if it's offensive.

04:26.430 --> 04:28.950
But if it's passive we want to activate it.

04:28.950 --> 04:33.960
We're going to say give ability and activate once passing in loaded ability spec.

04:33.960 --> 04:41.220
And now here on our ability system component, we can set be startup abilities given to true.

04:41.220 --> 04:45.420
And we can also broadcast abilities given delegate.

04:49.010 --> 04:51.800
As our abilities have now been given.

04:51.800 --> 04:58.070
So with that, our ability system component now has a function that can give abilities and activate

04:58.070 --> 04:59.630
passive abilities.

04:59.720 --> 05:02.720
So from our character, we can now fulfill this.

05:02.720 --> 05:09.110
To do we need to get a U or a ability system component or ask.

05:10.790 --> 05:12.050
We're going to cast to you.

05:12.050 --> 05:14.810
Ora ability system component.

05:15.680 --> 05:17.630
Our ability system component.

05:18.230 --> 05:19.790
We'll wrap it in an if.

05:21.620 --> 05:25.310
And take or ask and call our new function.

05:25.310 --> 05:28.070
Add character abilities from save data.

05:29.530 --> 05:32.710
What is fueling pass in Save Dayton.

05:34.700 --> 05:38.360
And with that, we're now loading in our abilities.

05:39.080 --> 05:44.030
Now we just need to make sure that all of our abilities either have offensive or passive.

05:44.060 --> 05:47.330
Even our passive abilities that aren't spells.

05:51.220 --> 05:55.240
So let's go ahead and run in debug mode.

05:56.320 --> 05:56.980
Okay.

05:56.980 --> 06:02.470
So what I'm going to do is I'm going to take my load menu and I'm going to remove this slot.

06:02.470 --> 06:03.730
I'm just going to delete it.

06:03.730 --> 06:04.840
We're going to start fresh.

06:04.840 --> 06:08.080
But before we do that I just want to double check a couple things.

06:08.080 --> 06:13.180
For one I'm going to go to blueprints ability system aura abilities.

06:13.180 --> 06:17.560
And we have our passive start up abilities GA listen for event.

06:17.560 --> 06:20.080
And we have our GE event based effect.

06:20.080 --> 06:23.260
That's not an ability but listen for event is.

06:23.440 --> 06:28.600
And we need to make sure that this has a passive ability type.

06:28.600 --> 06:35.080
We can make sure of that in blueprints ability system data and go to ability info and make sure that

06:35.080 --> 06:37.270
it's in here with an ability type.

06:37.270 --> 06:39.100
So let's go through these.

06:39.100 --> 06:46.960
We have Firebolt electrocute, Halo of protection, life siphon, mana siphon, Arcane Shards, and

06:46.960 --> 06:47.770
Fire blast.

06:47.770 --> 06:50.830
So our listen for event is not here.

06:50.830 --> 06:57.040
We can add that now most of these don't matter because it's not going into our spell menu.

06:57.040 --> 06:58.690
It's not going into our overlay.

06:58.690 --> 07:05.500
We're not going to see it visually, and we'll never actually even try to push it into those widgets,

07:05.500 --> 07:12.580
because we're not going to set a slot for it, an input tag, but it can get an ability tag.

07:12.580 --> 07:15.580
Now, we don't have an ability for this.

07:15.580 --> 07:18.460
If we go to passive, it's not here.

07:18.700 --> 07:24.700
So listen for event needs an ability tag, let's go to Project Settings and add a gameplay tag.

07:24.700 --> 07:27.880
We'll get abilities passive.

07:27.880 --> 07:31.990
We'll add one called listen for event.

07:32.530 --> 07:39.490
We'll add this tag to the ability Tags abilities passive listen for event.

07:39.490 --> 07:46.750
Now that this gameplay ability has the tag here in Ability info, we'll give it its ability tag listen

07:46.750 --> 07:51.550
for event and we'll set the gameplay ability itself.

07:51.550 --> 07:55.630
Gar listen for event and we don't need a level requirement.

07:55.630 --> 07:56.710
We can leave it at one.

07:56.710 --> 08:03.700
We don't need a background material or an icon, but we want this to have an ability type of passive.

08:04.520 --> 08:07.850
And with that, we should grant that ability.

08:07.850 --> 08:08.990
Let's make sure.

08:08.990 --> 08:11.180
So that's the first thing I wanted to check.

08:11.210 --> 08:16.400
Another thing I want to do is I want to go into blueprints.

08:17.170 --> 08:18.130
Character.

08:18.130 --> 08:18.850
Aura.

08:19.300 --> 08:23.950
BP, aura and go to my start up abilities.

08:24.550 --> 08:27.250
Because I only want to start up with Firebolt.

08:27.250 --> 08:29.050
I want to remove the rest of these.

08:29.050 --> 08:33.340
So I'm going to delete the others and just start with Firebolt.

08:33.340 --> 08:38.560
As far as my other abilities, the only other one is my start up passive ability.

08:38.560 --> 08:39.910
Gar listen for event.

08:39.910 --> 08:45.940
So if we load in and then quit, we should load back up Firebolt and listen for event.

08:45.940 --> 08:47.800
Let's make sure we can do that.

08:48.750 --> 08:50.220
So we're going to press play.

08:50.220 --> 08:56.640
I'm going to create a new slot, give it a name, select it and play.

08:56.670 --> 08:58.470
Now we have Firebolt.

09:00.510 --> 09:04.530
We have no spell points, but there's Firebolt in our spell menu.

09:04.560 --> 09:09.090
We have no attribute points and we have our default attribute values.

09:09.120 --> 09:11.640
Okay, now we can try leveling up.

09:13.070 --> 09:18.500
So I just want to quit and load back up and make sure that we see these eligible spells.

09:18.500 --> 09:21.230
So that won't happen if we don't save.

09:21.230 --> 09:25.280
So I have to hit the checkpoint and load out and come back in.

09:25.280 --> 09:27.260
We see that I'm level four.

09:29.960 --> 09:32.600
And I see that we have some print strings here.

09:32.600 --> 09:39.170
Our passive spells have been activated, so we should actually check the status before we activate our

09:39.170 --> 09:42.710
passive abilities because we don't know which ones are equipped.

09:42.710 --> 09:46.130
But if we open our spell menu, we see them here.

09:47.870 --> 09:49.340
So that's good.

09:49.340 --> 09:57.140
But because I saw each of these become active, that tells me that I should only activate them if they're

09:57.140 --> 09:58.130
actually in this.

09:58.130 --> 10:00.620
So we need to know of their status things of.

10:00.620 --> 10:06.920
But now why can't I ahead and can't I do list what happens that all we save with a different status

10:06.950 --> 10:07.280
a large.

10:07.280 --> 10:11.180
So I'm going to spend a tornado of way to electrocute in.

10:11.180 --> 10:13.310
But I'm going to spend a check in with on arcane.

10:13.850 --> 10:20.060
Equip it so to electrocute it to now unlocked arcane shards is now equipped.

10:20.060 --> 10:25.400
And let's go ahead and just spend a point on Mana Siphon and equip that to.

10:26.580 --> 10:31.320
And with that, I'm going to try saving the game and loading back in.

10:32.020 --> 10:34.150
So we'll hit our second checkpoint.

10:34.820 --> 10:36.020
Load out.

10:36.020 --> 10:37.370
Come back in.

10:38.930 --> 10:45.590
And I see that my abilities, my passive abilities appear to have been activated twice.

10:45.950 --> 10:54.860
My electrocute is unlocked, my arcane shards appears to be equipped, and I can indeed use it.

10:54.860 --> 10:56.000
So that works.

10:56.000 --> 10:58.250
The only thing is my passive abilities.

10:58.250 --> 11:04.970
I didn't see my blue particle effect for this passive ability, so that's something.

11:05.510 --> 11:06.920
That I need to look into.

11:06.920 --> 11:11.510
I'm also seeing that my status doesn't appear to be updated.

11:11.510 --> 11:18.710
Even though we have our abilities showing, only my equipped ability enables my equip button, so the

11:18.710 --> 11:23.210
status is something we need to make sure we're loading in.

11:24.520 --> 11:30.580
Now I see that we are giving our ability status, but for our passive abilities, we need to check that

11:30.580 --> 11:34.930
status and only activate if the status is equipped.

11:34.930 --> 11:40.690
But if that's the case, if we're going to do that, then we need to set the status for our nonspell

11:40.690 --> 11:42.370
passive abilities too.

11:42.400 --> 11:47.830
In other words, if we go to add character abilities, actually add character passive abilities is where

11:47.830 --> 11:48.550
we do it.

11:48.550 --> 11:54.100
Then if we give the ability and activate once for a passive ability, we're going to need to set its

11:54.100 --> 11:54.760
status.

11:54.760 --> 11:59.740
So we're going to have to take that ability spec add to its dynamic ability tags.

11:59.740 --> 12:03.010
So add tag for a gameplay tags.

12:05.220 --> 12:09.690
Get dot abilities status.

12:10.480 --> 12:15.640
And because we're activating it, I'm going to give it the status of equipped.

12:17.480 --> 12:22.430
And that way, the first time we give this passive ability, it's going to be equipped.

12:22.430 --> 12:23.390
It's activated.

12:23.390 --> 12:25.700
So we'll consider that equipped.

12:25.700 --> 12:32.600
And when we give character abilities from save data, if it's passive, we're only going to activate

12:32.600 --> 12:36.140
it if that saved status was equipped.

12:36.740 --> 12:38.150
So we're going to check its status.

12:38.150 --> 12:45.260
We're going to say if data dot ability status and we can use matches tag exact.

12:45.260 --> 12:51.470
We don't have to use double equals but matches tag exact F or a.

12:51.470 --> 12:57.830
Gameplay tags get abilities status equipped.

12:57.830 --> 13:05.180
If it's equipped then we'll give an activate and this should say matches tag exact not matches any.

13:05.300 --> 13:09.740
So we'll give an activate if when we saved it it was equipped.

13:09.740 --> 13:12.260
Otherwise we'll just give the ability.

13:14.320 --> 13:15.400
Like this.

13:16.310 --> 13:19.190
So if it's offensive, we just give the ability.

13:19.190 --> 13:25.340
If it's passive, then we check if it was equipped, when we saved it.

13:25.340 --> 13:28.160
If it was, we'll give an activate once.

13:28.160 --> 13:30.530
Otherwise we'll just give ability okay.

13:30.530 --> 13:36.770
So add character abilities from save data will only activate passive abilities if they were equipped

13:36.770 --> 13:38.180
when we saved them.

13:38.180 --> 13:43.670
And if we activate them, we need to make sure that we see the particle systems.

13:43.670 --> 13:49.190
So if we go to ability system passive passive Niagara component, when are we activating?

13:49.190 --> 13:52.040
Well when we get the passive spell tag.

13:52.040 --> 13:54.980
So we should get those tags if we activate.

13:54.980 --> 13:56.540
Let's go ahead and close the editor.

13:56.540 --> 14:02.990
And we'll now see if we're only activating those abilities that were active when we saved them.

14:03.140 --> 14:05.570
We'll go ahead and run and debug mode.

14:05.570 --> 14:08.450
All right we're back up and running.

14:08.450 --> 14:10.430
Let's get Galison for event.

14:10.430 --> 14:14.750
And when we activate it, let's print a string to let us know.

14:17.430 --> 14:22.080
Were, we're going to say my in for an event active in go on her.

14:22.980 --> 14:25.320
And we'll make it a cool color.

14:28.430 --> 14:30.590
Okay, let's press play.

14:30.620 --> 14:32.750
Let's actually go to.

14:33.530 --> 14:38.090
Maps, load menu and press play and I'm going to delete this.

14:38.240 --> 14:39.680
We're going to start a new.

14:43.430 --> 14:44.180
Okay.

14:44.180 --> 14:47.390
So listen for event is activated the first time.

14:47.390 --> 14:50.240
As expected we only have Firebolt.

14:50.240 --> 14:51.800
So let's level up.

14:53.270 --> 14:57.170
And we can save the game and we can leave now.

14:57.170 --> 14:58.430
We can come back in.

14:59.700 --> 15:02.160
So we're not getting listened for event.

15:02.730 --> 15:09.360
So I'm going to come back in here and make sure that we add dynamic ability tags before activating once.

15:09.360 --> 15:10.680
I'm going to rerun now.

15:12.380 --> 15:12.920
Okay.

15:12.920 --> 15:19.340
So ability system aura abilities I'm going to go into passive startup open listen for event.

15:19.340 --> 15:22.310
Make sure I have that listen for event activated.

15:22.310 --> 15:30.860
And let's go into Maps Load menu I'm going to clear this out.

15:32.330 --> 15:34.400
And make a new one.

15:36.920 --> 15:40.670
Listen for event is activated, nothing else was activated.

15:41.030 --> 15:47.450
And if I save without doing anything, just save the game and close and come back.

15:47.450 --> 15:49.130
We see that we're level one.

15:49.130 --> 15:53.210
Listen for event was activated as expected.

15:53.270 --> 15:55.040
Now if I level up.

15:57.930 --> 15:59.370
I'm now level four.

16:00.880 --> 16:03.100
And we have some abilities.

16:03.100 --> 16:07.030
I'm going to spend a point on a passive ability and equip it.

16:07.060 --> 16:10.480
I'll spend a point on electrocute, but not equip it.

16:10.480 --> 16:15.310
I'll spend a point on arcane shards and equip that to the right mouse button.

16:15.700 --> 16:17.410
So we have some changes.

16:17.410 --> 16:19.810
Let's go and save the game again.

16:20.650 --> 16:22.300
Second checkpoint here.

16:22.300 --> 16:23.320
We can close.

16:23.320 --> 16:24.250
We can play.

16:24.250 --> 16:24.580
Where?

16:24.610 --> 16:25.480
Level four.

16:26.370 --> 16:28.380
We'll load and we're at the right spot.

16:28.380 --> 16:32.640
And now it looks like I got my listen for event activated twice.

16:32.640 --> 16:36.780
So now I'm expecting to see strength go up to 12 when I click this once.

16:36.780 --> 16:39.540
Sure enough that's true.

16:39.540 --> 16:43.590
So that's a problem I can activate with my right mouse button.

16:43.590 --> 16:47.610
This ability I can select these.

16:47.610 --> 16:49.860
Their statuses appear to be correct.

16:49.860 --> 16:59.040
This Manage Rain ability is correct here, but I don't seem to recall seeing any message showing that

16:59.040 --> 16:59.970
it's been activated.

16:59.970 --> 17:06.750
So I don't think it was activated, which means I don't think we gave it an equipped status when equipping

17:06.750 --> 17:08.010
this passive ability.

17:08.010 --> 17:09.780
So a couple things here.

17:10.470 --> 17:18.210
So the first problem that we're activating our passive ability listen for events is because we're adding

17:18.210 --> 17:22.440
it every single time we save we need to add unique.

17:22.440 --> 17:29.460
So if saved ability being added to our save data saved abilities this whole thing needs to be prevented.

17:29.460 --> 17:33.000
If this saved ability is already in that array.

17:33.000 --> 17:34.800
So we can try add unique.

17:34.800 --> 17:36.360
But there's a problem.

17:36.360 --> 17:44.520
You see, add unique isn't going to work unless f saved ability overloads the equals operator, the

17:44.520 --> 17:45.390
double equals.

17:45.390 --> 17:52.080
And because we created this f saved ability, that operator doesn't exist for this type and add unique

17:52.080 --> 17:58.770
needs to be able to compare to see if any of the elements in the array are the saved ability we're trying

17:58.770 --> 17:59.490
to pass in.

17:59.490 --> 18:05.010
So if we go ahead and try to compile this, then we get an error and it's complaining.

18:05.010 --> 18:12.330
Specifically, there is no binary equals double equals operator found which takes a left hand operand

18:12.330 --> 18:16.110
of type F saved ability or there is no acceptable conversion.

18:16.110 --> 18:22.020
So add unique needs to be able to compare to saved abilities to know if they're equal or not.

18:22.200 --> 18:28.860
Now that's because really, there's no way to know unless we decide how that operator should behave.

18:29.010 --> 18:34.320
Now, I think two saved abilities should be equal if their ability tags are equal.

18:34.320 --> 18:42.120
And we can define this double equals operator for the f saved ability by overloading that operator for

18:42.120 --> 18:42.510
it.

18:42.510 --> 18:45.180
We can do that here in load screen save game.

18:45.180 --> 18:47.730
Now I'm going to do it outside of the struct.

18:47.730 --> 18:51.540
But if we do this here we have to make this an inline.

18:51.540 --> 18:58.440
And to overload the operator we say the return type which we're going to have bool be the return type.

18:58.440 --> 19:02.250
We say operator with the operator we want to overload.

19:02.250 --> 19:06.270
That's the double equals followed by any operands.

19:06.270 --> 19:11.160
Now operands are what goes on the left side and what goes on the right hand side.

19:11.160 --> 19:17.400
So we're going to say const f saved ability reference.

19:17.850 --> 19:19.950
This will be what goes on the left.

19:19.950 --> 19:26.280
And we'll have const f saved ability reference right.

19:26.910 --> 19:29.640
So we have what goes on the left and what goes on the right.

19:29.640 --> 19:37.980
And we're going to return left dot ability tag dot matches tag exact.

19:38.620 --> 19:40.660
Write that ability tag.

19:42.610 --> 19:44.530
That's how are gay this operator.

19:44.530 --> 19:45.820
No one's defined.

19:45.850 --> 19:52.180
Okay, now that this is sorted here, that's the character we can do add unique if is fully so and compile

19:52.180 --> 19:52.450
this.

19:52.450 --> 19:53.470
I don't know that.

19:53.470 --> 19:56.800
Should he fix so errors in the monitor.

19:56.800 --> 19:58.960
So that's going to fix that problem.

19:58.960 --> 20:04.210
We should only ever save one match per match tag.

20:04.210 --> 20:06.340
And let's show my successful a porter.

20:06.520 --> 20:13.540
Now that I'm problem that we're into Wom weren't seeing so massive spells get activated.

20:13.540 --> 20:21.250
Now what happens our ability system component when we equip an ability well let's see if we're actually

20:21.250 --> 20:22.420
setting the status.

20:22.420 --> 20:25.600
We're checking the status if it's equipped or unlocked.

20:25.600 --> 20:27.340
And then we continue.

20:27.460 --> 20:31.810
But I don't think we actually set our status to equipped.

20:31.810 --> 20:34.360
We're calling client equip ability.

20:34.360 --> 20:38.470
So we handle activation and deactivation for passive abilities.

20:38.470 --> 20:41.590
And right here we see that ability doesn't yet have a slot.

20:41.590 --> 20:44.920
That means it's going to be active when it wasn't before.

20:44.920 --> 20:48.100
So here we're actually calling try activate ability.

20:48.100 --> 20:51.790
This is where we should set its ability status to equipped.

20:52.560 --> 20:57.480
And that way when we save the ability, it'll have that status when we load it back up.

20:57.600 --> 21:07.050
So whether or not it's passive or offensive, if we equip the ability here for the first time, it doesn't

21:07.050 --> 21:15.150
have any slot, then I'm going to take the ability spec, take its dynamic ability tags, add a tag,

21:15.150 --> 21:16.530
gameplay tags.

21:17.530 --> 21:18.250
Abilities.

21:18.250 --> 21:19.600
Status equipped.

21:20.990 --> 21:25.700
Now, I think we should clear out its status tag that it had before.

21:25.730 --> 21:28.130
If we're going to do this just to be safe.

21:29.000 --> 21:35.900
So before we do this, let's take ability spec dynamic ability tags and remove tag.

21:36.420 --> 21:39.120
And we'll remove its status.

21:39.270 --> 21:44.940
Now we can always get the status with git status from spec passing in ability spec.

21:46.660 --> 21:49.150
And we have to dereference that pointer.

21:51.350 --> 21:59.330
So this way we're sure to remove whatever its status was and set its status to equipped as we're actually

21:59.330 --> 22:01.040
activating it right now.

22:01.280 --> 22:03.500
Now back to our A character.

22:03.500 --> 22:11.330
Before we actually start adding to our save data save abilities, it's possible that we might have removed

22:11.330 --> 22:17.210
some abilities, or if we've changed the abilities, we won't add them if they already exist in here.

22:17.210 --> 22:24.620
So we want to make sure to clear out this array first before we go and call all these lambdas.

22:24.620 --> 22:30.200
So I'm going to take save data saved abilities and call empty on it.

22:30.200 --> 22:32.360
That way we'll empty it completely.

22:32.360 --> 22:37.010
And then we'll go through and fill it in as we're saving okay.

22:37.010 --> 22:43.160
So the last thing we're going to make sure we take into account is we're going to go into passive Niagara

22:43.160 --> 22:50.210
component, as here is where we're activating and deactivating those passive Niagara components for

22:50.210 --> 22:51.380
our passive abilities.

22:51.380 --> 22:59.720
Now we're binding on passive activate to activate passive effect on the ability system component.

22:59.720 --> 23:07.310
But if these delegates are broadcast first then when our passive Niagara component is constructed,

23:07.310 --> 23:10.040
it will have missed the delegate broadcast.

23:10.040 --> 23:17.210
So what we need to do is as soon as we have our ability system component here, we have to check the

23:17.210 --> 23:22.310
ability status of this passive spell tag for this component.

23:22.310 --> 23:31.130
So after binding to activate passive effect we can check we can make a const bool called be startup

23:31.130 --> 23:41.210
abilities activated and check the or ask for be startup abilities given.

23:41.750 --> 23:48.380
We can call it the same thing, be startup abilities given, and if startup abilities have already been

23:48.380 --> 23:48.740
given.

23:48.740 --> 23:55.850
So if be startup ability is given, then we can check the status of the ability with our passive spell

23:55.850 --> 23:56.360
tag.

23:56.360 --> 23:59.930
If it's equipped, we need to activate this component.

23:59.930 --> 24:02.750
So we're going to say if.

24:03.510 --> 24:09.810
Or as get status from ability tag using our passive spell tag.

24:10.410 --> 24:22.140
If that is equal to and we need to compare this to F or a, gameplay tags get dot abilities status equipped.

24:22.260 --> 24:27.660
If it is equipped, we can just call activate and be done with it.

24:27.660 --> 24:29.790
And we can take these lines of code here.

24:30.000 --> 24:37.020
And we can do the same thing in our lambda that we bound to get on as a registered delegate, just in

24:37.020 --> 24:39.630
case we missed it up here.

24:39.630 --> 24:40.950
We'll have it down here.

24:40.950 --> 24:44.880
So checking start up abilities given and checking the status.

24:44.880 --> 24:49.680
If the status is equipped, we can go ahead and activate.

24:49.680 --> 24:52.170
And of course this is repeat code.

24:52.170 --> 24:57.840
So we could easily make this a function activate if equipped for example.

24:57.840 --> 25:02.760
So we can make a void activate if equipped.

25:07.430 --> 25:09.890
And I'm going to move this.

25:11.060 --> 25:12.830
I don't want it in line.

25:12.830 --> 25:14.570
I want it in the cpp file.

25:14.600 --> 25:16.010
I'm going to put it right here.

25:17.340 --> 25:18.840
Activate if equipped.

25:18.840 --> 25:25.290
And what we're going to do is we're going to check the status and activate.

25:26.040 --> 25:27.960
Now we need or ask.

25:27.990 --> 25:29.430
We can just pass that in.

25:31.490 --> 25:39.170
You or uh ability system component will forward declare here or ASC.

25:43.670 --> 25:46.820
We'll add on a lot around frame input.

25:46.820 --> 25:53.510
And now the function can take and we can call this option run here taking in or ask.

25:53.510 --> 25:54.050
Right.

25:54.260 --> 25:57.530
And when you got all the same function what from right here.

25:59.520 --> 26:01.080
Activate if equipped.

26:02.040 --> 26:06.150
Okay, so with that we can compile and test this out.

26:06.780 --> 26:07.350
Okay.

26:07.350 --> 26:09.570
So I'm going to go back to the load menu.

26:09.570 --> 26:14.040
And I'm going to delete both slots and make a new slot.

26:15.300 --> 26:17.250
I'll select it and play.

26:17.280 --> 26:18.600
We're starting fresh.

26:18.600 --> 26:20.220
I'm going to go ahead and level up.

26:22.890 --> 26:28.890
Make sure that we get one and only one point per attribute point spent.

26:28.890 --> 26:30.120
And we do.

26:30.720 --> 26:35.970
I'm going to leave it at one attribute points 11 strength 18 intelligence.

26:36.570 --> 26:39.420
For spells I'm going to equip.

26:40.260 --> 26:42.480
Let's equip a couple of passives.

26:42.480 --> 26:49.230
I'll spend a point and equip Halo of Protection and Life siphon, and I'll go ahead and spend a point

26:49.230 --> 26:51.060
on electrocute.

26:51.330 --> 26:54.930
Okay, I'm going to save and exit and come back.

26:54.930 --> 26:56.820
And there we go.

26:56.850 --> 26:59.160
Our passive abilities have been activated.

26:59.160 --> 27:01.170
We get the particle systems.

27:01.170 --> 27:02.490
I have one point left.

27:02.490 --> 27:04.740
11 strength, 18 intelligence.

27:04.740 --> 27:07.620
My spells are in the same state.

27:07.620 --> 27:14.070
I have electrocute unlocked and these two passives are assigned.

27:14.070 --> 27:16.140
Everything has loaded properly.

27:16.200 --> 27:16.890
Excellent.

27:16.890 --> 27:24.510
And just to make sure that listen for events is only activated once, I'm expecting to increase one

27:24.510 --> 27:27.390
of these attributes only by one when I spend a point.

27:27.390 --> 27:28.680
Let's try vigor.

27:28.680 --> 27:30.030
It's at nine.

27:30.150 --> 27:31.350
Now it's at ten.

27:32.340 --> 27:32.940
Perfect.

27:32.940 --> 27:35.910
Everything is working as expected.

27:36.330 --> 27:41.160
Now those changes I just made are not going to take place unless I save again.

27:41.160 --> 27:43.110
So I have to reach that other checkpoint.

27:43.860 --> 27:50.610
Now, the last thing I'd like to polish is if we load into this level, say we want to play test it

27:50.610 --> 27:52.770
without actually loading anything.

27:52.770 --> 28:00.120
Well, if we press play and run up to one of these, well, we get an exception because we have saved

28:00.120 --> 28:04.560
World State, which is calling save actors on a save object.

28:04.560 --> 28:06.690
But we don't have a save object.

28:06.690 --> 28:11.460
So what we could do here is just place an is valid check.

28:11.460 --> 28:15.780
Here we can say if not is valid save object.

28:17.170 --> 28:18.100
Return.

28:18.100 --> 28:24.760
So with that, at least we should be able to load in straight into the level and play test it.

28:24.790 --> 28:31.360
We don't have to actually save the world state as we don't have a valid save object in that case.

28:31.750 --> 28:36.010
So with that we can just load right in, come over here and overlap.

28:36.010 --> 28:42.100
And even though it's not functional, other than showing the glow, at least we don't get a crash when

28:42.100 --> 28:43.660
we're trying to play test.

28:43.660 --> 28:45.430
So that's one issue.

28:45.430 --> 28:48.070
And with that that's polished up.

28:48.070 --> 28:52.420
And one last thing that, at least in my case, has happened.

28:52.420 --> 28:56.050
And this is more a side effect of writer's autocomplete.

28:56.170 --> 29:01.960
If I go into aura ability types right here, aura ability types dot h.

29:01.960 --> 29:06.970
Notice that there's this mysterious include of std bool dot h.

29:07.000 --> 29:09.790
That's not something that I wanted.

29:09.790 --> 29:10.930
That was an autocomplete.

29:10.930 --> 29:18.610
And in fact, if I bring it back real quick, notice that this is actually searching for a folder on

29:18.610 --> 29:19.360
my machine.

29:19.360 --> 29:25.840
So if you had pulled this project from GitHub, you wouldn't have been able to build without removing

29:25.840 --> 29:26.110
that.

29:26.110 --> 29:30.610
So something to be aware of with autocomplete features in writer.

29:30.610 --> 29:33.670
So other than that we've fixed those issues.

29:33.670 --> 29:37.600
We now have the ability to save world state and load up our abilities.

29:37.600 --> 29:38.980
Things are looking great.

29:38.980 --> 29:41.470
Excellent job and I'll see you in the next video.
