WEBVTT

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

00:07.960 --> 00:15.040
So now we need a data asset and this is going to store all the data for all of the associated character

00:15.040 --> 00:16.090
classes.

00:16.330 --> 00:19.050
So let's make that C plus plus class.

00:19.060 --> 00:25.660
We'll go into Aura public ability system, and we'll stick it right here in data with our other data

00:25.660 --> 00:26.440
asset.

00:26.530 --> 00:34.000
So let's right click new C plus plus class, choose all classes and we're going to search for data asset.

00:35.370 --> 00:36.930
Select data asset.

00:36.960 --> 00:43.110
Click next and this can be called character class info.

00:43.230 --> 00:46.800
Let's create the class and close the editor.

00:47.460 --> 00:50.370
Okay, so we have our character class info.

00:50.490 --> 00:54.270
Here's the CPP and here's the H file.

00:54.480 --> 01:01.470
So now that we have this, we need a way to store data for each character class and we also need an

01:01.470 --> 01:04.890
enum to categorize character classes.

01:05.190 --> 01:07.780
So let's go ahead and create an enum.

01:07.800 --> 01:18.750
I'd like to make an enum class or a scoped enum called A Character Class, and we'll use Uint8 for this

01:18.780 --> 01:19.530
enum.

01:19.830 --> 01:27.660
And I'd like this to be a blueprint type, so that means it needs a U enum with blueprint type and we

01:27.660 --> 01:31.290
can add constants for each character class.

01:31.410 --> 01:34.320
So I'd like an elementalist class.

01:35.990 --> 01:39.540
Basically a sorcerer or wizard type class.

01:39.560 --> 01:43.730
We're going to have a warrior class and we're going to have a Ranger class.

01:44.120 --> 01:48.650
And writer thinks I made a typo, but nope, this is the word that I wanted.

01:48.800 --> 01:53.330
So now we have a way to distinguish between different character classes.

01:53.510 --> 02:00.530
Now I'm also going to want a struct with all the information for each class, so I'm going to make a

02:00.530 --> 02:05.750
new type of struct and this will be for the character class default info.

02:05.750 --> 02:07.400
So that's what I'm going to call it.

02:07.430 --> 02:11.720
F character class default info.

02:12.800 --> 02:14.690
Now this will be a use struct.

02:16.560 --> 02:22.620
And I'm also going to make this a blueprint type struct, and it's going to need the generated body

02:22.620 --> 02:28.390
macro and we can add all the different data associated with a given class.

02:28.410 --> 02:35.160
Now in this struct we're obviously going to need a gameplay effect to apply our primary attributes.

02:35.310 --> 02:41.910
So we're going to have a subclass of capable of storing a new gameplay effect.

02:43.200 --> 02:48.330
Class and I'll go ahead and add the forward declaration for gameplay effect there.

02:48.540 --> 02:53.040
And this will be our primary attributes gameplay effect.

02:53.370 --> 02:59.160
Now this should be a new property so we can set it from our data asset blueprint.

02:59.190 --> 03:08.430
We can make it edit defaults only and we'll stick it in a category of class defaults.

03:10.640 --> 03:13.490
So now we can set the primary attributes here.

03:13.520 --> 03:19.880
Now we could have secondary and vital attribute gameplay effects per class, or we can share the same

03:19.880 --> 03:23.990
secondary and primary attributes gameplay effect among all classes.

03:23.990 --> 03:25.490
That's really up to us.

03:25.970 --> 03:29.120
I'd like to share those, so I'm going to add them down here.

03:29.120 --> 03:35.210
I'm going to make a public section and paste the primary attributes, but this is going to actually

03:35.210 --> 03:41.240
be secondary attributes and this will be our common class defaults.

03:41.240 --> 03:47.930
So we'll go ahead and set the category to common class defaults and we'll have one for secondary and

03:47.930 --> 03:50.870
we'll also have one for vital attributes as well.

03:52.310 --> 03:54.140
So vital attributes.

03:54.910 --> 03:58.660
Okay, so we have a struct and we can set the primary attributes.

03:58.690 --> 04:00.790
Gameplay effect per class.

04:01.090 --> 04:08.920
Now our data asset needs a way to store these structs one for each one of our classes so we can use

04:08.920 --> 04:09.910
a t array.

04:09.940 --> 04:11.920
Or we could use a map.

04:11.950 --> 04:19.270
A map is nice because we could map the enum to the struct, so why don't we do that here in the public

04:19.270 --> 04:19.960
section?

04:19.960 --> 04:29.110
We'll make a t map that maps from the enum character class to the struct character class default info

04:29.380 --> 04:33.160
and we'll call this character class information.

04:33.820 --> 04:41.560
Now I'd like to be able to retrieve the information for any given enum constant, so we'll make a function

04:41.560 --> 04:49.630
to look up the info so this can return an F character class default info and we'll call it get class

04:49.630 --> 05:00.860
default info and it'll take an E character class called character class so we can go ahead and generate

05:00.860 --> 05:01.910
the definition.

05:02.240 --> 05:04.490
And this is going to be simple.

05:04.490 --> 05:10.580
We're going to simply return and we'll perform a lookup in character class information.

05:10.580 --> 05:16.940
We can just use find checked, find checked is nice because it'll perform an assertion and we'll have

05:16.940 --> 05:17.630
an assert.

05:17.630 --> 05:21.830
If we can't find the enum and we're going to pass in character class.

05:22.340 --> 05:29.330
So this function will simply return the information given a character class enum constant.

05:29.960 --> 05:30.560
Okay.

05:30.560 --> 05:36.350
And of course, we're going to want to fill in this map in the editor, so we'll give this a new property

05:36.350 --> 05:44.270
with edit defaults only as well, and we'll just give it the category of class defaults.

05:44.930 --> 05:51.380
We'll make it character class defaults and we can compile, launch and make this data asset.

05:54.250 --> 05:54.700
Okay.

05:54.700 --> 06:01.030
So back in the editor, let's go to blueprints, ability system and data and we'll make this data asset

06:01.030 --> 06:08.350
here so we can go to miscellaneous data asset and we can choose our character class info.

06:08.680 --> 06:17.110
Let's select that and we'll call this a character class info and we can open it up.

06:17.290 --> 06:24.340
And here we have our character class information map and our secondary attributes and our vital attributes

06:24.580 --> 06:26.140
so we can go ahead and click.

06:26.140 --> 06:31.000
Plus we have the Elementalist, which is the default value we can't click.

06:31.000 --> 06:35.830
Plus again, as we'll get this warning, I'll click it again.

06:35.830 --> 06:38.080
It says Cannot add new key to the map.

06:38.080 --> 06:41.380
Well, a key with the default value exists.

06:41.380 --> 06:48.250
So if we want to add all three, we have to change this from elementalist to ranger or warrior and add

06:48.250 --> 06:49.090
another one.

06:49.090 --> 06:51.460
Change this to something else.

06:51.460 --> 06:55.730
So we have Ranger, we have warrior and then finally Elementalist.

06:55.730 --> 07:02.090
And then we can expand these and see that we have the primary attributes gameplay effect to subclass

07:02.090 --> 07:02.600
of.

07:02.600 --> 07:07.370
And then we have secondary and vital which will be shared among all classes.

07:07.400 --> 07:14.060
Unless of course you place those in our class information struct, in which case you could set a different

07:14.060 --> 07:15.320
one for each class.

07:15.350 --> 07:21.530
So now that we have a data asset we can fill these in with gameplay effects and we're going to create

07:21.530 --> 07:25.040
some gameplay effects to fill in in the next video.

07:25.040 --> 07:27.380
So great job and I'll see you soon.
