WEBVTT

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

00:08.290 --> 00:15.460
Now that we have rich text blocks and we have the capability of setting their styles by formatting the

00:15.460 --> 00:22.120
text used by the rich text block, we can now implement spell descriptions, and I'd like this to be

00:22.120 --> 00:24.700
a quality of the spell class itself.

00:25.300 --> 00:33.370
So what I'm going to do is close out of the editor and I'm going to close all my tabs and go into my

00:33.370 --> 00:35.290
aura gameplay ability.

00:36.000 --> 00:37.470
So in abilities.

00:38.500 --> 00:46.420
We have ora gameplay ability and for each of our ora gameplay abilities I'd like to have a virtual function

00:46.450 --> 00:54.550
that child abilities can override and these are going to return the spell description so they'll be

00:54.550 --> 00:57.100
public, they're going to be virtual.

00:57.100 --> 01:01.720
We plan on overriding them and they'll return an F string.

01:01.900 --> 01:08.170
F strings are just easy to manipulate and we'll call this one get description.

01:09.200 --> 01:13.700
And description will depend on the level, so we'll pass that in as an int 32.

01:13.730 --> 01:17.150
So our description will change based on that level.

01:17.330 --> 01:23.720
Now we also need a string returning function for the next level, so we're going to make a virtual F

01:23.720 --> 01:29.420
string returning function called Get Next Level description.

01:31.260 --> 01:36.270
And this will also take in an int 32 called level.

01:38.580 --> 01:41.040
So we can generate definitions.

01:43.450 --> 01:50.500
And the aura gameplay ability implementation of this is just going to return some default text.

01:50.500 --> 01:55.180
So we'll just say return F string print f.

01:56.390 --> 02:01.100
Text and we'll go ahead and format it with one of our rich text styles.

02:01.100 --> 02:07.520
So I'm going to use default here and what I can do inside of this.

02:09.230 --> 02:15.140
As I can say, percent s with a comma there and a space.

02:15.350 --> 02:20.960
And then after using the default style, I can use the level style.

02:25.060 --> 02:26.860
And percent here.

02:28.210 --> 02:32.910
So this is a print F So what I can do is use string literals here.

02:32.920 --> 02:39.520
If I use an uppercase L with quotes, that's going to make a wide character for me and I can just say

02:39.550 --> 02:46.420
default ability name and just put a whole bunch of text when we want a whole bunch of text and it doesn't

02:46.420 --> 02:49.180
matter what it says, we say Lorem ipsum.

02:50.650 --> 02:56.770
Many times over, so I'm just going to go ahead and paste Lorem ipsum a bunch of times.

02:59.020 --> 03:05.290
And after that, since we also have a percent de I can also put my level in there.

03:05.320 --> 03:06.250
Why not?

03:07.480 --> 03:09.930
So we're just giving some default text here.

03:09.960 --> 03:11.530
Doesn't matter what it says.

03:11.530 --> 03:18.610
And for the next level description, we'll say return F string print f.

03:20.920 --> 03:25.510
Text and we'll just put we'll use the default.

03:27.760 --> 03:31.600
Format here and just say next level.

03:32.910 --> 03:41.520
Just kind of getting practice using these formatting syntax, we'll say level opening the level percent

03:41.520 --> 03:43.440
D closing the level.

03:43.770 --> 03:50.520
We can even have slash N to get a new line here and I can copy the opening and closing for the default

03:50.520 --> 03:51.180
again.

03:53.340 --> 03:57.480
And say causes much more damage.

03:57.780 --> 04:04.470
And then after the text, I just need to replace the percent de with an integer that can be level.

04:05.430 --> 04:11.820
So we can see, you know, what it looks like by using the default format for next level, using the

04:11.820 --> 04:15.560
level format for this percent de, which will be replaced by level.

04:15.570 --> 04:22.350
We can do a new line character inside of our string and then we have the default style here again.

04:22.350 --> 04:29.100
So really just, you know, showing how this stuff works and making sure that it's going to work now

04:29.130 --> 04:32.760
or a gameplay ability can also return a locked description.

04:32.760 --> 04:40.770
So I'm going to have a virtual F string returning function called Get Locked description.

04:41.430 --> 04:44.370
This will also take in an INT 32 called level.

04:44.370 --> 04:49.110
And it's just going to say, you know, ability locked until level, right?

04:49.110 --> 04:54.280
So we'll say return f string, we'll print f.

04:56.610 --> 05:02.160
With text and the text will just be using the default style for now.

05:02.820 --> 05:15.030
And it's going to say ability or we'll say spell locked until level and we'll use percent D And so this

05:15.030 --> 05:18.270
function will take in the level requirement.

05:20.050 --> 05:24.490
So we'll use that to replace percent D here.

05:24.490 --> 05:29.530
So the locked description will just be for a locked spell.

05:30.280 --> 05:32.590
Okay, so we have these functions.

05:32.590 --> 05:39.520
We're going to override them in child ability classes, but for now we just have something to call on

05:39.520 --> 05:42.820
the ability in order to get a description.

05:42.820 --> 05:49.630
But our ability system component is going to need a function that can return a description based on

05:49.630 --> 05:50.980
an ability tag.

05:51.400 --> 05:55.090
So I'm going to open the ability system component class.

05:58.360 --> 06:00.490
Or a ability system component.

06:00.580 --> 06:07.690
So I'd like a function that can get the description and the next level description based on an abilities

06:07.720 --> 06:08.810
ability tag.

06:08.830 --> 06:12.280
So the function can be public.

06:13.060 --> 06:15.400
And I'd like it to return a bool.

06:15.790 --> 06:24.130
That way, if we fail to get a proper description, we'll just return false and this will be get descriptions.

06:25.800 --> 06:30.510
By ability tag and notice I said descriptions plural.

06:30.540 --> 06:34.860
Because we have a description and we have a description for the next level.

06:34.980 --> 06:42.660
So this will take a const gameplay tag by reference called ability tag and it'll also take in an F string

06:42.660 --> 06:45.540
by non-const reference that it can fill in.

06:45.540 --> 06:49.320
And this will be description, we'll call it out description.

06:49.860 --> 06:52.500
And we'll also have another one for the next level.

06:52.500 --> 06:54.570
Description passed in by reference.

06:54.570 --> 06:57.540
We'll call it out Next level Description.

06:59.620 --> 07:02.830
So this function is going to fill in out description and out.

07:02.860 --> 07:04.420
Next level Description.

07:04.420 --> 07:05.920
So how are we going to do that?

07:05.920 --> 07:08.590
Well, let's create the function definition.

07:08.590 --> 07:16.360
And what we need to do is, first of all, check to see if our ability tag is valid, if it has a valid

07:16.360 --> 07:21.460
ability spec, if it's in our activatable abilities, and we'll do that with an If check, we'll say

07:21.460 --> 07:29.830
if we'll make a const f gameplay ability spec that's a pointer, we'll call it spec, I'll call it ability

07:29.830 --> 07:30.310
spec.

07:30.310 --> 07:31.660
I won't be that lazy.

07:33.650 --> 07:38.660
And we're going to call get spec from ability tag passing an ability tag.

07:43.040 --> 07:49.310
So we won't get into the if statement if this is not even a valid ability tag.

07:49.460 --> 07:58.190
Now, if that's the case, I would like to just use a string that says that the ability is locked,

07:58.190 --> 08:00.560
but we do know the ability tag.

08:00.560 --> 08:10.100
So we could get ability info our data asset and take a look at its ability level requirement so we could

08:10.100 --> 08:14.480
get our ability info with you ability info.

08:15.560 --> 08:18.110
We'll call this ability info.

08:20.480 --> 08:30.320
And we can use you or ability system library get ability info passing in a world context object.

08:30.320 --> 08:38.000
I always like to use get avatar actor and with our ability info we can get the level requirement and

08:38.000 --> 08:45.230
that way we can get the locked ability description from our gameplay ability and then we can set our

08:45.230 --> 08:48.590
f string to a locked description.

08:48.590 --> 08:54.950
And I suppose we could just make that locked description here and it doesn't really matter that we have

08:54.950 --> 09:01.400
a get locked description on the ability class because we can set that string to a locked description,

09:01.400 --> 09:08.120
which means if we're going to want to call that get locked description function on or a gameplay ability,

09:08.150 --> 09:12.140
we should just make it static and don't plan on overwriting it.

09:12.140 --> 09:17.570
So I'm going to take virtual off, but I'm going to make it a static function and the static function

09:17.570 --> 09:21.480
will say spell locked until this level, right?

09:21.480 --> 09:26.670
So it's going to be a static function, which means we can call it straight on the Or gameplay ability

09:26.670 --> 09:27.330
class.

09:27.330 --> 09:31.170
So that's what I'm going to do is I'm going to set the description out.

09:31.170 --> 09:32.130
Description.

09:33.800 --> 09:37.910
Equal to you or a gameplay ability.

09:38.150 --> 09:45.080
Double colon get locked Description because it's a static function and we'll pass in the level requirement

09:45.080 --> 09:46.340
from ability info.

09:46.340 --> 09:48.590
So we'll say ability info.

09:49.190 --> 09:56.690
Find ability info for tag passing an ability tag and from that ability info we'll get the level requirement

09:56.690 --> 09:57.770
and pass that in.

09:57.770 --> 10:05.180
And now our out description will just have the locked description and next level description can be

10:05.180 --> 10:05.620
empty.

10:05.630 --> 10:11.120
So we'll say out next level description equals the empty string F string.

10:11.300 --> 10:12.680
That's what we'll do.

10:12.830 --> 10:17.330
And we'll say that in this case we'll return false.

10:19.490 --> 10:28.220
Meaning that we did not find an ability in our activatable abilities and get spec from ability tag.

10:28.220 --> 10:31.250
We'll just say that we have a locked ability.

10:31.250 --> 10:37.550
We'll consider this to be locked and I'll make ability info const and in the case that we do find a

10:37.550 --> 10:45.440
valid ability spec, then we know that it's not a locked ability and we can set the description by getting

10:45.440 --> 10:48.680
our gameplay ability from the ability spec.

10:48.710 --> 10:50.150
So we'll do this.

10:50.150 --> 10:55.580
We'll say you are a gameplay ability or ability, we'll call it that.

10:57.650 --> 11:00.860
Equals a cast to you or a gameplay ability.

11:02.950 --> 11:08.260
And we're going to take our ability spec and get the ability from this ability spec.

11:08.260 --> 11:13.390
So we're going to get the actual ability, the Ue or a gameplay ability.

11:13.660 --> 11:20.110
If we successfully cast to it, then we're going to call those non-static functions on our ability.

11:20.110 --> 11:28.240
We're going to take out description and set it equal to or ability get description and we're going to

11:28.240 --> 11:29.590
pass in the level.

11:29.590 --> 11:36.430
We can get that from the ability spec, so ability, spec level and for our next level description,

11:36.430 --> 11:44.560
we'll set it equal to aura ability, get next level description passing in ability spec level.

11:45.600 --> 11:48.360
Plus, you guessed it, plus one.

11:48.780 --> 11:49.410
All right.

11:49.410 --> 11:51.300
And then we can return.

11:51.300 --> 11:51.930
True.

11:53.090 --> 11:56.600
So this way we'll know the difference between these two outcomes.

11:56.600 --> 12:03.470
But the important thing is that we have a git descriptions by ability tag function that we can use to

12:03.470 --> 12:05.330
get the descriptions.

12:05.330 --> 12:13.280
Whenever a ability changes, either changes its status, changes its level and what have you.

12:13.840 --> 12:20.020
So because we have this function, we can call this function from our spell menu widget controller.

12:20.830 --> 12:27.700
So I'm just going to quickly go to my private folder to UI widget controller, spell menu, widget controller,

12:28.090 --> 12:32.500
and I'm going to look at wherever we're broadcasting spell globe selected delegate.

12:32.530 --> 12:32.860
Why?

12:32.890 --> 12:38.950
Because we're broadcasting these two booleans whenever we've selected a spell globe.

12:38.950 --> 12:44.320
But now when we select a spell globe, we should also get those descriptions and push those up to our

12:44.320 --> 12:48.190
widgets as well so we can set those rich text blocks.

12:48.190 --> 12:49.960
That would be ideal.

12:50.580 --> 12:52.620
So we're going to get the spell menu.

12:52.620 --> 12:56.970
Widget controllers delegate that broadcast to Booleans.

12:57.410 --> 13:01.270
We're also going to broadcast two F strings as well.

13:01.290 --> 13:04.770
So I'm going to add an F string comma.

13:04.770 --> 13:13.410
We'll call this description string and we'll add another F string comma, and we'll call this next level

13:13.410 --> 13:16.260
description string.

13:17.250 --> 13:24.530
And now that spell globe selected signature requires two F strings in addition to two booleans.

13:24.540 --> 13:31.410
We need to pass in strings, so we'll go back to spell menu widget controller Everywhere we're broadcasting

13:31.410 --> 13:35.970
spell globe selected delegate and make sure we pass two strings in.

13:36.150 --> 13:38.370
I'm going to go up to the top and search for it.

13:38.370 --> 13:45.690
So I find the first instance of it, and that's going to be when ability status change has been broadcast.

13:45.720 --> 13:50.680
Now we have the ability tag and our ability system component.

13:50.680 --> 13:58.030
It has the function get descriptions by ability tag that takes a tag and two out parameters for descriptions.

13:58.500 --> 14:05.460
So what we can do is just like we made two booleans and set them with this function, we can make two

14:05.490 --> 14:09.040
F strings and set them with that ability system component function.

14:09.060 --> 14:11.730
So we're going to make an F string called description.

14:12.660 --> 14:15.840
And F string called Next Level Description.

14:18.710 --> 14:20.690
We're going to get RISC.

14:23.170 --> 14:30.640
And we're going to call get descriptions by ability tag and pass in the ability tag and pass in description

14:30.640 --> 14:33.040
and pass in next level description.

14:34.240 --> 14:42.220
And then when we broadcast the delegate, we can pass in description and we can pass in next level description.

14:43.470 --> 14:51.000
And of course we get the red squiggles because you guessed it, this can now be changed to four params

14:51.000 --> 14:51.930
instead of two.

14:53.130 --> 14:54.630
And that's going to fix that.

14:54.810 --> 14:56.970
So now we need to call.

14:57.960 --> 15:03.180
This with two strings every time we broadcast this delegate.

15:03.180 --> 15:05.060
So we're going to find it down here.

15:05.070 --> 15:10.230
When spell points change, we're going to replace this line with these.

15:10.230 --> 15:14.580
For now, we're going to get a string called description and F string.

15:14.580 --> 15:16.140
Next level description.

15:16.140 --> 15:19.410
We're going to call get descriptions by ability tag.

15:19.410 --> 15:21.630
This has to be our selected ability.

15:21.900 --> 15:27.060
So we're going to pass in selected ability, dot ability, and then we'll broadcast.

15:27.060 --> 15:29.250
And I believe that's the only Nope.

15:29.250 --> 15:33.150
There's another place where we're broadcasting that's in Spell Globe selected.

15:33.150 --> 15:42.000
So we also need to do this here to description next level description passing in ability tag.

15:42.000 --> 15:46.830
And then we broadcast those strings up with those booleans.

15:47.100 --> 15:52.230
Now that we've done this, we can handle those two strings in our spell menu.

15:52.230 --> 15:54.210
So let's go back into the editor.

15:54.210 --> 15:55.770
We'll compile and launch.

15:56.530 --> 16:01.150
And we'll get our spell menu open and in the spell menu.

16:02.160 --> 16:05.670
Right here on Spell Globe selected.

16:05.670 --> 16:08.220
We now have two strings that we're receiving.

16:08.340 --> 16:09.870
I'm going to make some room.

16:12.050 --> 16:13.520
And move this out.

16:15.180 --> 16:22.290
And I'm going to take these two strings and set the values for my rich text blocks, which I have here

16:22.320 --> 16:25.200
called Rich Text description and Rich Text.

16:25.230 --> 16:26.750
Next level Description.

16:26.760 --> 16:29.040
So I'm going to get those out here.

16:29.070 --> 16:30.690
Rich Text Description.

16:30.960 --> 16:33.270
And where's the other one?

16:33.270 --> 16:35.130
I might not have made it a variable.

16:35.160 --> 16:36.030
I did not.

16:36.030 --> 16:38.310
So now it's a variable and there it is.

16:39.820 --> 16:43.870
Now for rich text description and next level description.

16:43.870 --> 16:46.500
We just need to call, set, text on them.

16:46.570 --> 16:50.080
So for rich text description, we're going to call, set, text.

16:51.120 --> 16:56.580
The function and we're going to get our description string and hook it straight in.

16:56.580 --> 17:02.370
It's going to be converted from a string to a text, and we're going to do the same thing for next level

17:02.370 --> 17:03.390
Description.

17:05.840 --> 17:10.040
We'll get our next level description string right there.

17:11.860 --> 17:14.320
So now we're setting our descriptions.

17:15.210 --> 17:17.730
So we can compile and save that.

17:18.000 --> 17:23.670
And we should just see some default messages from the aura gameplay ability.

17:24.590 --> 17:32.450
And we do we see default ability name and then Lorem ipsum now it goes off the screen it doesn't wrap

17:32.450 --> 17:32.900
around.

17:32.900 --> 17:36.200
So that's something we can set on our text block.

17:36.680 --> 17:40.820
So I'm going to take this text block and search for wrap.

17:42.360 --> 17:44.330
And auto wrap text.

17:44.340 --> 17:47.550
I'm going to do the same thing for the other one, auto wrap text.

17:47.760 --> 17:48.930
So now.

17:49.620 --> 17:50.550
Saving all.

17:52.240 --> 17:53.590
I can select.

17:53.590 --> 17:55.570
And now we see that it wraps.

17:55.570 --> 18:03.100
And because I typed Lorem ipsum so much, we have our scroll bar because it's got enough text to scroll

18:03.100 --> 18:07.390
and at the very end I said the level, which is one really, really cool.

18:07.390 --> 18:11.130
And then here next level to causes much more damage.

18:11.140 --> 18:12.070
Cool.

18:13.040 --> 18:18.590
And if we level up and upgrade that other ability to eligible.

18:20.510 --> 18:21.590
Like so.

18:22.560 --> 18:26.820
Well, we still see the same thing, so it's not going to do much.

18:26.820 --> 18:33.390
But if we click on all these other ones, they're going to say spell locked until level one because

18:33.390 --> 18:37.860
they don't actually have ability tags set for them.

18:37.860 --> 18:44.610
But what we can do is we can test out that second ability before we upgrade it to eligible.

18:44.610 --> 18:47.220
If I click on it, it says spell locked until level two.

18:47.250 --> 18:53.670
So we know that part works so we can actually see the level requirement when we click on it.

18:53.670 --> 19:00.390
As long as it has a valid ability tag corresponding to an ability in our ability info data asset that

19:00.390 --> 19:04.620
has a level requirement because that's where we're getting our level requirement from.

19:04.980 --> 19:05.790
All right.

19:05.790 --> 19:11.910
So we now have spell descriptions, but we just have a default description on our ability class.

19:11.940 --> 19:15.360
We need to fill this in for our firebolt ability.

19:15.360 --> 19:21.120
So it actually shows some really cool info for the Firebolt and we can also do it for our electrocute

19:21.120 --> 19:22.390
ability as well.

19:22.390 --> 19:23.800
And we'll do that next.

19:23.800 --> 19:26.260
So great job and I'll see you soon.
