WEBVTT

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

00:07.840 --> 00:15.040
So now that we have a pretty nice HUD, it's time that we start actually sending information up to it

00:15.040 --> 00:17.410
from the C plus plus side of things.

00:17.410 --> 00:24.970
And I'd like to start with initializing our spell globes with the spells we have equipped.

00:25.120 --> 00:29.020
Now, so far, we just have one offensive spell equipped.

00:29.050 --> 00:36.880
We don't have any passive spells, so we need to start thinking about a way to send data to this widget.

00:37.120 --> 00:43.720
Now, an example of something like this that we can look at is our attribute menu, because our attribute

00:43.720 --> 00:51.550
menu has widgets, each of which are identified with gameplay tags, and we're sending data up to widgets

00:51.580 --> 00:58.780
via the attribute menu widget controller, and we're sending it in a nicely packaged little struct that

00:58.780 --> 01:02.500
contains information about that given attribute.

01:02.530 --> 01:05.560
We're able to do this because we have a data asset.

01:05.560 --> 01:12.590
If we go to blueprints ability system data, we'll see that we have this attribute info and attribute

01:12.590 --> 01:21.620
info has an array and each element in the array is identified by an attribute tag and it contains information,

01:21.650 --> 01:25.610
the attribute name, the attribute description, and so on.

01:25.640 --> 01:28.820
Now we can follow this same pattern for our abilities.

01:28.820 --> 01:32.720
Our abilities can be identified by their ability tag.

01:32.720 --> 01:40.340
They can also have other information that we can send to widgets which can then fill in what they need

01:40.340 --> 01:40.910
to fill in.

01:40.910 --> 01:47.510
In the case of our spell globes, we're going to need an icon and a background that we can fill in here

01:47.510 --> 01:49.610
based on ability information.

01:49.610 --> 01:57.440
So what we're going to need is our own data asset for ability info and just like attribute info, we

01:57.440 --> 02:03.320
can create a struct to store that info for each element in our array that we'll put in there.

02:03.320 --> 02:09.980
Now we can go into our ability system folder into data and take a look at attribute info.

02:10.010 --> 02:19.250
Notice here we have a struct for the data to send up to our widgets and we have a array of those structs.

02:19.250 --> 02:26.270
Now we could use a t array, we could use a map mapping F gameplay tags to structs.

02:26.300 --> 02:30.110
Either one is okay, but we definitely need a data asset.

02:30.110 --> 02:32.810
So that's what we're going to create.

02:33.110 --> 02:36.680
So we can create a new C plus plus class.

02:36.680 --> 02:42.260
And I'm going to put this in ability system data along with our other data assets.

02:42.260 --> 02:49.610
So I'm going to right click Choose New C Plus plus class, click on all classes and search for data

02:49.610 --> 02:57.860
asset Choose Data Asset, click next and we're going to call this ability info.

02:58.010 --> 02:59.990
So it's like attribute info only.

02:59.990 --> 03:01.340
It's for abilities.

03:01.340 --> 03:03.290
We're going to create the class.

03:03.830 --> 03:07.820
And somehow I got Visual Studio opened.

03:07.910 --> 03:11.570
So Visual Studio has opened with my new class.

03:11.570 --> 03:12.080
Interesting.

03:12.080 --> 03:17.300
I'm going to close that and I'm going to go to edit and editor preferences.

03:18.240 --> 03:21.450
And just see if my source code editor has changed.

03:21.960 --> 03:24.180
Looks like it's set to Visual Studio.

03:24.210 --> 03:27.510
I like writer new projects, so I'm going to have to restart.

03:27.540 --> 03:29.190
Not quite sure how that changed.

03:30.420 --> 03:36.360
And now that that's fixed, I'm going to check and I see that my data folder doesn't have my new class

03:36.360 --> 03:36.880
in it.

03:36.900 --> 03:39.760
So what I'm going to do is go ahead and close the editor.

03:39.780 --> 03:48.090
I do see the class here in Writer, so I'm going to force writer to regenerate my temporary files.

03:48.090 --> 03:54.510
Mostly my intermediate folder is what I'm interested in, so I'm going to delete my intermediate folder

03:54.510 --> 04:01.170
and my binaries and right click my new project, open it back up with Jetbrains writer.

04:01.890 --> 04:04.830
And with that change, I'm going to go ahead and launch the editor.

04:05.750 --> 04:12.310
Okay, so we're back here in the editor and sure enough, there's my new ability info.

04:12.320 --> 04:19.160
So now that we have that, I'm going to go ahead and close again and this time start looking at my ability

04:19.160 --> 04:20.120
info class.

04:20.120 --> 04:27.610
Now the first thing I need is a struct and that struct is going to hold some information about my abilities.

04:27.620 --> 04:30.100
It doesn't have to be complete yet.

04:30.110 --> 04:33.740
I'm only going to add things to it that I want to use right now.

04:33.860 --> 04:36.380
So first let's create the struct.

04:36.380 --> 04:42.050
We're going to say struct and I'm going to call it aura ability info.

04:43.010 --> 04:52.850
It's going to be marked with use struct and blueprint type and it gets a generated body and we can give

04:52.850 --> 04:54.980
it a couple of fields here.

04:54.980 --> 05:03.200
Now the first thing I want to give it is an gameplay tag and I'm going to call this ability tag and

05:03.200 --> 05:06.840
this will be how we identify each of these abilities.

05:06.870 --> 05:11.490
That means I'm going to need to include gameplay tag container.

05:11.490 --> 05:14.610
So I'm going to go ahead and get that in here.

05:15.990 --> 05:25.800
And I'm going to assign a default value of an empty gameplay tag like so and just like attribute info.

05:25.800 --> 05:31.860
In fact, attribute info has the gameplay tag for the attribute set to edit defaults only.

05:31.890 --> 05:33.540
Blueprint read only.

05:33.600 --> 05:38.310
That's something I'd like to take, so I'm going to use that same exact property.

05:38.880 --> 05:46.410
Now, in addition to the ability tag, I'm going to want a texture 2D for the icon and a material for

05:46.410 --> 05:47.400
the background.

05:47.520 --> 05:47.820
Right?

05:47.820 --> 05:49.650
And that's basically all I need for now.

05:49.650 --> 05:52.170
So first our icon.

05:52.170 --> 05:54.180
It's going to be a T object pointer.

05:54.180 --> 05:59.160
It's going to be of type U texture 2D.

06:01.010 --> 06:05.360
I'm going to call it icon and set it equal to null pointer by default.

06:05.660 --> 06:13.490
And this could be a const you texture 2D if we like, we would put that right there in the angle brackets

06:13.490 --> 06:16.610
and I'm going to give it the same new property.

06:16.880 --> 06:24.890
Now in addition to a new texture 2D, I'd like a material so I can use a T object pointer and a new

06:24.920 --> 06:28.160
material interface is what I can use for this.

06:28.790 --> 06:31.970
That will allow us to set it to a material.

06:31.970 --> 06:37.250
And I'm going to call this background material and set this to a null pointer.

06:37.640 --> 06:43.400
This can also be marked as const, and I'll give this a new property here.

06:45.530 --> 06:49.040
So remember, const means we can't change it at runtime.

06:49.250 --> 06:52.550
That doesn't mean we can't set it in the blueprint.

06:52.730 --> 07:01.280
Now we can identify abilities by their ability tag, but we're also going to want to be able to assign

07:01.280 --> 07:03.320
abilities to input tags.

07:03.320 --> 07:09.650
In fact, we're already doing that with our Firebolt is assigned to the left mouse button input tag.

07:09.650 --> 07:13.700
I think this should be something that we have in here as well.

07:13.700 --> 07:20.270
So when this struct makes it to the widget, the widget can identify itself with the input tag and then

07:20.270 --> 07:24.440
match those up and set its own properties based on that tag.

07:24.440 --> 07:33.560
So I'm going to copy the ability tag and paste it and call this one input tag so an ability can be assigned

07:33.560 --> 07:34.850
an input tag, right?

07:34.850 --> 07:41.510
And now that we have the aura ability info, we can create a public section in the class and make a

07:41.660 --> 07:42.230
array of these.

07:42.230 --> 07:46.940
So t array of aura ability info structs.

07:46.940 --> 07:55.640
And this will be called ability information and this will get also a new property and basically going

07:55.640 --> 07:58.190
to give it the same exact property.

07:58.220 --> 08:01.310
The only difference is we can put a category here.

08:03.910 --> 08:05.830
Ability information.

08:06.940 --> 08:13.450
Now, in addition to this array, I'd like a function that can retrieve the ability information based

08:13.450 --> 08:14.870
on the ability tag.

08:14.890 --> 08:25.240
So I'm going to have a function that returns an array ability info struct called find ability info for

08:25.240 --> 08:33.580
tag and this can take in a const f gameplay tag by reference and I'm going to call it ability tag and

08:33.580 --> 08:36.820
we can use b log not found a boolean.

08:38.520 --> 08:40.590
But I'm going to set it to false by default.

08:40.590 --> 08:45.450
So if we want to be warned, if we can't find one, we'll have that.

08:45.480 --> 08:49.950
Now Findability info for tag can get a definition.

08:51.330 --> 08:58.080
And here in the definition, we're going to simply find the ability info, right?

08:58.110 --> 09:03.240
We can do that by looping through our ability information.

09:03.240 --> 09:11.970
So I'm going to use a const F or ability info reference called info for each of these in ability information.

09:12.120 --> 09:21.780
We're going to see if the info dot ability tag matches the ability tag passed in and if so, we'll return

09:21.780 --> 09:23.040
info now.

09:23.040 --> 09:28.920
Otherwise we'll return an empty f ora ability info struct.

09:28.920 --> 09:37.080
And if we do reach beneath this for loop, if we never return from it we can log if our boolean b log

09:37.080 --> 09:38.670
not found is true.

09:38.880 --> 09:45.240
So if b log not found we're going to use a log and we can log an error.

09:45.240 --> 09:52.210
Now, so far we've been using log temp an awful lot and I think that by this point what I'd like to

09:52.210 --> 09:54.400
have my own log category.

09:54.400 --> 09:59.140
So rather than using log temp, it'd be nice if we had a log ora.

09:59.170 --> 10:03.520
So our project is now serious enough, I think, to have one of those.

10:03.790 --> 10:14.860
So what I can do is I can right click on Ora go to add and choose file and I'm going to have a Ora log

10:14.860 --> 10:23.290
channels dot H, I'm going to click okay and I'm going to go ahead and create another file.

10:24.190 --> 10:28.090
Called aura log channels Dhcp.

10:29.350 --> 10:36.580
So I'm just creating them right here at the project level where Aurora exists and in Aurora Log channels.

10:36.850 --> 10:37.530
H.

10:37.570 --> 10:42.900
I'd like to define or declare a log category.

10:42.910 --> 10:45.910
Now, in order to do that, we have to include a couple headers.

10:45.910 --> 10:47.230
We need core minimal.

10:48.400 --> 10:58.210
So I'm going to include that and we need to include logging slash log macros because I'm going to use

10:58.210 --> 10:59.110
a log macro.

10:59.140 --> 11:07.060
I'm going to use declare log category extern and I can choose what my category name will be.

11:07.060 --> 11:08.530
I'm going to call it log ora.

11:08.560 --> 11:12.760
The default verbosity can be log and compile time.

11:12.760 --> 11:15.090
Verbosity is going to be all.

11:15.100 --> 11:18.490
So with this we're declaring a log.

11:18.490 --> 11:21.040
We need to define it in our log channels.

11:21.250 --> 11:31.150
CP And the first thing we can do is include the header file or a log channels, and then we can use

11:31.150 --> 11:36.520
define log category and we have to define it log ora.

11:36.760 --> 11:45.550
So with this, we now have our own log category that we can use and here in ability info dot CP when

11:45.550 --> 11:52.540
we use log now we can use log ora if we include Ora log channels.

11:52.540 --> 11:57.070
So as soon as I press comma space there's ora log channels.

11:57.070 --> 12:05.620
Thank you writer and I can log an error here and the error is going to say we're going to use text here.

12:05.620 --> 12:10.120
We're going to say, can't find info for ability tag.

12:10.120 --> 12:12.610
We're going to go ahead and say what that tag is.

12:12.610 --> 12:16.570
So we'll use percent s for a string on ability info.

12:17.890 --> 12:23.540
And we'll say the name of the ability info this class that we're in.

12:23.560 --> 12:26.680
So first we need that ability tag string.

12:26.680 --> 12:31.780
So we're going to use star ability tag dot to string.

12:33.870 --> 12:36.660
And then we want the name of the class we're in.

12:36.660 --> 12:41.130
I'm going to use get name safe passing in this.

12:42.260 --> 12:42.860
Like.

12:42.860 --> 12:49.670
So there's my semi colon and we're now using our own log, so this is kind of cool.

12:49.670 --> 12:56.180
We can even go into our other data assets here in ability system data.

12:56.180 --> 12:59.870
We can take a look at attribute info where we're using log temp.

12:59.870 --> 13:02.630
Instead of that, we can use log aura.

13:02.720 --> 13:05.090
Now functionally it's basically the same.

13:05.090 --> 13:09.790
The difference is it's not going to have log temp and the log, it's going to be log aura.

13:09.800 --> 13:14.300
Now we're suppressing this log, but it's kind of cool that we have this now.

13:14.480 --> 13:23.090
Okay, so now we have a data asset and this data asset needs to be accessible somewhere and I'd like

13:23.090 --> 13:28.970
to use it in my overlay widget controller as the overlay widget controller is going to be performing

13:28.970 --> 13:31.430
lookups and broadcasting information.

13:31.430 --> 13:38.090
So I'm going to go into UI, into widget controller, but I do want this to be my public folder.

13:38.090 --> 13:46.020
So public UI, widget controller, I'm going to go into overlay widget controller and add a variable

13:46.020 --> 13:47.850
for our new data asset.

13:47.910 --> 13:54.480
So here in overlay widget controller, I'm going to go down into our protected section where we have

13:54.480 --> 13:56.580
our message widget data table.

13:56.580 --> 14:01.800
I'm going to place a new object pointer for my data asset.

14:04.300 --> 14:07.270
So it's going to be you ability info.

14:08.680 --> 14:11.700
We're going to forward declare ability info.

14:11.710 --> 14:21.100
So I'm going to put that up here class you ability info and right back down to it I'm going to call

14:21.100 --> 14:22.600
this ability info.

14:24.050 --> 14:27.470
And we have to set this from the blueprint.

14:27.470 --> 14:30.750
So I'm going to copy the property for the data table.

14:30.770 --> 14:34.310
We can even keep it in the same category widget data.

14:34.640 --> 14:39.260
In fact, both of these could just be in data, but that's fine.

14:39.260 --> 14:40.510
I'm going to leave it as is.

14:40.520 --> 14:42.450
And now we have ability info.

14:42.470 --> 14:49.730
So with that we can create a blueprint based on our ability info, data asset and set this ability info

14:49.730 --> 14:51.730
on our overlay widget controller.

14:51.740 --> 14:56.720
So let's go ahead and compile launch the editor and we'll do that.

14:57.200 --> 14:59.720
Okay, so we can create our new blueprint.

15:00.080 --> 15:07.550
So I'm going to go to Blueprints Ability system data and make our new data asset here by right clicking,

15:07.550 --> 15:13.850
going to miscellaneous and choosing data asset and I can get my new ability info.

15:13.880 --> 15:18.740
There it is all the way up at the top and I'll call this data ability info.

15:19.810 --> 15:28.480
Now we can set this on our widget controller in blueprints, UI, widget controller and BP overlay widget

15:28.480 --> 15:29.320
controller.

15:29.350 --> 15:31.360
There's our new ability info.

15:31.390 --> 15:34.180
I'm going to set it to the ability info.

15:34.210 --> 15:40.420
I'm also going to browse to it and open it up and here's our ability information I can click plus to

15:40.420 --> 15:41.680
add an element to it.

15:41.680 --> 15:43.540
And here are the fields.

15:43.720 --> 15:49.590
Now we can set this, but we don't actually have an ability for our firebolt do we?

15:49.600 --> 15:55.480
So we need to set that and then we can set the input tag, the icon background material and all that

15:55.480 --> 15:56.350
good stuff.

15:56.350 --> 16:00.070
So I'm going to go ahead and close editor preferences.

16:00.580 --> 16:06.550
I'm done with my overlay widget controller, but I'm going to keep ability info open and just go and

16:06.550 --> 16:09.820
make that native gameplay tag for our ability.

16:09.970 --> 16:16.480
It's going to be in aura gameplay tags, dot h and just under attack and summon.

16:16.480 --> 16:25.010
I'm going to make a new ability tag for my Firebolt I'm going to call this abilities underscore fire,

16:25.160 --> 16:30.470
underscore firebolt and I'll have a category of fire spells.

16:30.650 --> 16:38.330
So let's go ahead and create that and it's going to be right here in abilities so I can copy and paste

16:38.330 --> 16:48.410
and change abilities, summon to abilities fire Firebolt and call this abilities dot fire dot Firebolt

16:48.410 --> 16:53.620
And this will just be Firebolt ability tag and that's it.

16:53.630 --> 17:01.220
Now I can compile and launch and I should have my firebolt ability tag and I can use that now.

17:02.020 --> 17:08.200
Okay, so getting my data asset back open now I can set my ability tag to abilities.

17:08.230 --> 17:10.030
Fire Firebolt.

17:10.360 --> 17:12.190
Now input tag.

17:12.190 --> 17:15.250
I could just go in here and set it to the left mouse button.

17:15.250 --> 17:15.730
Right?

17:15.730 --> 17:21.190
But this is actually something that should be set from code.

17:21.370 --> 17:26.050
I actually don't think it needs to be exposed here to the data asset blueprint.

17:26.050 --> 17:28.690
I think it should be set in code.

17:28.720 --> 17:33.520
It should be looked up from the ability itself because this can change.

17:33.520 --> 17:40.600
So just like our current value of an attribute, we did not expose that to our data asset attribute

17:40.600 --> 17:41.230
info.

17:41.260 --> 17:46.090
I'm actually going to UN, expose input tag and get that out of here.

17:46.090 --> 17:51.190
But icon we can set I'm going to set it to firebolt that texture.

17:51.860 --> 17:55.910
And we can browse to it and remind ourselves, here's what it looks like.

17:56.580 --> 18:02.370
And for the background material, I'm going to look up fire skill BG.

18:02.640 --> 18:04.450
That material instance.

18:04.470 --> 18:11.730
So now we have the data for this data asset and the last thing I can do is expose input tag.

18:11.730 --> 18:18.570
So I'm going to save all close the editor, go back to ability info H and for the input tag I'm going

18:18.570 --> 18:24.560
to remove edit defaults only, but we can still access it from the event graph with blueprint read only.

18:24.570 --> 18:33.840
And with that now we have our data asset and our widget controller has that ability info variable that

18:33.840 --> 18:34.680
we've set.

18:34.680 --> 18:39.930
So it now has the ability to look up data based on an ability tag.

18:39.930 --> 18:47.580
So we're one step closer to broadcasting this information, one of these structs up to our overlay widget

18:47.580 --> 18:54.060
and in fact we can just broadcast it not specifically to the overlay widget, but just broadcast it.

18:54.060 --> 18:57.880
And any of our globe's can be listening for that broadcast.

18:57.880 --> 19:04.120
And the left mouse button one is going to update itself with the background and the icon there.

19:04.150 --> 19:09.340
So we need to code all that and that's going to be in the videos to come.

19:09.340 --> 19:14.920
Now, attempting to compile, I see that F log category log ora.

19:14.920 --> 19:17.560
We have a struct type redefinition.

19:17.560 --> 19:23.170
Now this is indicative of including this header file more than once.

19:23.170 --> 19:27.600
And so our log category is being defined more than once.

19:27.610 --> 19:28.300
Now.

19:28.300 --> 19:35.770
We can easily fix that by going back to our ora log channels H and making sure that we have a pragma

19:35.770 --> 19:36.610
once here.

19:36.640 --> 19:45.820
Pragma once is something that we kind of always take for granted, but it makes sure that we never include

19:45.820 --> 19:51.640
a header file more than once if it's already been included, or if something in here is defined, it's

19:51.640 --> 19:53.590
never going to be redefined.

19:53.590 --> 19:58.000
So adding a pragma once will save us there.

19:58.240 --> 20:01.060
Excellent job and I'll see you in the next video.
