WEBVTT

00:06.880 --> 00:08.020
Welcome back.

00:08.050 --> 00:15.520
Now we're hard coding 50in our set by color magnitude for the damage effect spec handle we're setting

00:15.520 --> 00:21.400
on our projectile now or a projectile spell is going to control the damage.

00:21.400 --> 00:24.910
And rather than hard coding this, we can have a variable.

00:25.030 --> 00:28.810
But we know that abilities have the concept of level.

00:28.810 --> 00:34.900
So if the ability level increases, maybe we'd like our damage to increase as well.

00:35.050 --> 00:43.060
And we've seen a good way to handle increasing values based on level we could use curve tables.

00:43.330 --> 00:48.730
Well, we've also seen that when we select a curve table in a gameplay effect.

00:48.730 --> 00:52.090
For example, let's just pull up an example of this.

00:52.090 --> 01:00.430
We'll go to Actor Potion, GE Potion, Heal, and here we're using a scalable float magnitude where

01:00.430 --> 01:07.550
we've selected a curve table Choosing a curve from that table, we can enter a value and the scalable

01:07.550 --> 01:15.320
float magnitude will be scaled by the value in that curve based on a level we can do something like

01:15.320 --> 01:17.480
this in our gameplay ability.

01:17.510 --> 01:24.800
This scalable float magnitude property here is an F scalable float, and when you have a member variable

01:24.800 --> 01:32.750
of this type, you get these properties, you get the ability to have a magnitude, you get a dropdown

01:32.750 --> 01:39.170
to select a curve table and you get another dropdown to select the curve from that table as well as

01:39.170 --> 01:44.150
a preview slider that allows you to see the magnitude scaled at various levels.

01:44.150 --> 01:50.150
I'd like to have one of these handy properties in my gameplay ability class, so that's what I'm going

01:50.150 --> 01:50.750
to do.

01:50.750 --> 01:57.260
I'm going to go ahead and close the editor saving all, and this is something I think we can have common

01:57.260 --> 01:59.390
to all of our gameplay abilities now.

01:59.390 --> 01:59.780
Yes.

01:59.780 --> 02:07.280
Or a gameplay ability could be used for something other than a damage causing spell and we may have

02:07.280 --> 02:11.090
or a gameplay abilities that don't use the damage property.

02:11.090 --> 02:18.380
And if you really wanted to you could subclass or a gameplay ability and make an aura damage ability

02:18.410 --> 02:19.520
for example.

02:19.520 --> 02:22.760
And then all of our damage abilities can inherit from that.

02:22.760 --> 02:28.760
But I'm just going to give the damage property to aura gameplay ability and then in any abilities that

02:28.760 --> 02:35.420
don't use damage, I just won't use that property as the amount of memory that it takes up will be negligible.

02:35.420 --> 02:42.320
So we're going to go to our public folder into ability system abilities and open my base aura gameplay

02:42.320 --> 02:43.460
ability class.

02:43.460 --> 02:50.720
And I'd like to have a property here for our damage for the ability that can be a scalable float and

02:50.720 --> 02:54.470
we can create curve tables and set those per ability.

02:54.620 --> 02:56.390
So that's what I'm going to do here.

02:56.420 --> 03:05.360
Now to do that, we create an F scalable float variable and I'm just going to call this damage now.

03:05.360 --> 03:07.760
I want to set this from our ability blueprint.

03:07.760 --> 03:10.130
So we're going to make it edit defaults only.

03:10.130 --> 03:16.100
I'd like to make it blueprint read only as well in case we want to use it in the ability blueprint.

03:16.100 --> 03:24.350
And I'm going to set its category to damage now that we have an F scalable float property that's edit

03:24.350 --> 03:25.280
defaults only.

03:25.280 --> 03:28.340
Let's see how this is exposed to the details panel.

03:28.340 --> 03:32.240
We'll see what it looks like so we can go ahead and launch the editor.

03:33.650 --> 03:38.120
And from here in the editor, I'll go ahead and open up those gameplay effects.

03:38.120 --> 03:40.040
I think I'm done with Potion Heal.

03:40.220 --> 03:43.910
I'll keep damage open for a while while we're still dealing with damage.

03:43.910 --> 03:51.290
But I do want to go into blueprints, ability system, gameplay abilities, fire Firebolt and open our

03:51.290 --> 03:59.270
gameplay ability Firebolt As we've now added a new scalable float to this and it should be in the damage

03:59.270 --> 03:59.840
category.

03:59.840 --> 04:00.770
Here it is.

04:00.770 --> 04:02.630
So here's damage, right?

04:02.630 --> 04:07.220
And if we enter a value here, it'll be scaled by the curve table.

04:07.250 --> 04:13.310
Now if we wanted, we could enter a base value like ten and then create a curve table to scale it.

04:13.340 --> 04:20.090
What I usually like to do is set this magnitude value to one and then create a curve table that has

04:20.090 --> 04:22.670
those values that I'd like for each level.

04:22.670 --> 04:24.830
So that's just a personal preference.

04:24.830 --> 04:30.980
But now we can create a damage curve table specific to the firebolt ability and we can create different

04:30.980 --> 04:33.050
curve tables for different abilities.

04:33.050 --> 04:37.470
If we like their damage to scale differently when their level increases.

04:37.710 --> 04:44.370
So all that's left now is to create that curve table and that is going to be your quest.

04:44.550 --> 04:52.320
I'd like you to create a damage curve table, and you can call this CT damage if you like, but create

04:52.320 --> 04:57.060
a curve table and you're of course, going to need to add a curve to it.

04:57.090 --> 05:00.120
Now choose the interpolation type that you like.

05:00.120 --> 05:05.310
And in fact, I'd like you to choose the method that you like to store the data.

05:05.340 --> 05:10.620
You can create a CSV, a Json, or just make the curve table in the editor.

05:10.620 --> 05:13.410
So choose whichever method you like.

05:13.410 --> 05:20.430
Create the damage curve table and scale the damage for firebolt how you see fit.

05:20.430 --> 05:23.820
So pause the video and conquer this quest now.

05:26.810 --> 05:30.770
Okay, so we need a curve table that we can set for our damage.

05:30.800 --> 05:35.420
Now, just for the practice, I think I'll go ahead and make a Json file for this.

05:35.450 --> 05:40.700
Now, whenever you don't remember the exact syntax, you can always go back and look at something that

05:40.700 --> 05:43.130
you've already made to get an example.

05:43.160 --> 05:47.270
Here's our primary attributes Warrior Json file.

05:47.300 --> 05:53.630
And if I want, I can use this as a sort of example of the syntax for a Json file.

05:53.660 --> 05:59.000
Now, really, each of these corresponds to a different curve with a different name, right?

05:59.000 --> 06:03.320
So I only need one so I can delete all but one of these.

06:03.320 --> 06:07.410
And for the name I can assign any name I like.

06:07.430 --> 06:10.130
I'm going to call this Firebolt.

06:10.400 --> 06:19.160
And in fact, I can make this abilities dot firebolt and I can even use this curve table for damage

06:19.160 --> 06:23.150
for non ability type gameplay effects as well if I want to do that.

06:23.300 --> 06:32.550
Now I need to specify values and for level one, let's just say our firebolt can do five damage.

06:32.610 --> 06:41.130
For level five, we can make it ten for level ten, let's make it oh 16 I'm going to change this from

06:41.130 --> 06:43.050
14.9 to 15.

06:43.050 --> 06:47.520
Sometimes we get those inaccuracies when exporting into a Json file.

06:47.550 --> 06:51.810
For level 15, we'll make this 27.

06:51.990 --> 06:56.670
For level 20, we'll make this 41.

06:56.790 --> 07:02.640
And for level 40, why don't we make it something like 80?

07:02.820 --> 07:03.900
Now let's go higher.

07:03.900 --> 07:06.350
We'll do 120 for level 40.

07:06.360 --> 07:10.320
And now we have the makings for a curve table.

07:10.320 --> 07:12.300
Let's go ahead and save this.

07:12.300 --> 07:15.210
And I'll save this as CT damage.

07:16.420 --> 07:20.050
Save and now we have a Json file.

07:20.170 --> 07:26.470
Now I can make a curve table out of this, so I'm going to go to blueprints ability system data and

07:26.470 --> 07:29.740
we'll make our curve table here for damage.

07:29.830 --> 07:33.070
I'm going to right click, I'm going to import.

07:33.250 --> 07:35.610
We could have just clicked on import there.

07:35.620 --> 07:42.370
I'm going to import CT damage dot Json and choose import as curve table.

07:42.610 --> 07:46.300
And for the curve interpolation type I'm going to choose cubic.

07:46.300 --> 07:52.330
We'll get a chance to see what constant looks like in time, but I'm going to choose cubic hit apply.

07:52.450 --> 08:00.100
And now we have CT damage and if I go to abilities dot Firebolt, here's what the damage trend looks

08:00.100 --> 08:00.730
like.

08:00.730 --> 08:01.750
So that looks good.

08:01.750 --> 08:07.690
I'm going to take this handle though, and kind of angle it down like that so that we don't have a fall

08:07.720 --> 08:08.380
off.

08:08.530 --> 08:14.320
I'd like it to just kind of approach like that and I can even take this value and bring it down.

08:14.320 --> 08:17.990
And that way I have a more smooth curve, a smoother trend.

08:17.990 --> 08:19.490
I'm going to go ahead and save that.

08:19.490 --> 08:21.470
And now we have CT damage.

08:21.470 --> 08:28.790
So now that we have a curve table with a firebolt curve, we can assign this in our gameplay ability.

08:28.820 --> 08:33.620
Firebolt So here's my damage f scalable float.

08:33.650 --> 08:39.590
I'm going to set its magnitude to one and open the dropdown and choose CT damage.

08:39.590 --> 08:44.060
And for the curve I'm going to select abilities dot Firebolt.

08:44.150 --> 08:51.320
So now that we have this damage property, we can use this when we're creating our damage effect spec

08:51.320 --> 08:54.110
in our firebolt ability.

08:54.110 --> 08:55.910
So I'm going to save all.

08:55.910 --> 09:03.200
I'm going to close the editor and back here in writer, I'm going to go to my Aura projectile spell

09:03.230 --> 09:09.860
back where I'm creating my gameplay ability and setting our set by color magnitude.

09:09.860 --> 09:15.290
I no longer want to set this to 50, but I want to query my damage.

09:15.290 --> 09:22.640
Scalable float at the level of our gameplay ability and gameplay abilities have a built in concept of

09:22.640 --> 09:22.970
level.

09:22.970 --> 09:26.390
We can always get the ability with get ability level.

09:26.390 --> 09:32.270
This is a built in function and this returns an int 32 for the level.

09:32.270 --> 09:40.160
So how do we get the evaluated value of our damage which we placed in or a gameplay ability this scalable

09:40.160 --> 09:40.880
float?

09:40.910 --> 09:43.880
How do we evaluate that at the ability level?

09:44.210 --> 09:46.070
Well, we have several options.

09:46.070 --> 09:49.250
We have a few functions to choose from.

09:49.250 --> 09:57.710
If we want that ability level as an integer, we can take our damage and use as integer.

09:57.740 --> 09:59.810
We can even use as bool.

09:59.810 --> 10:08.390
And these functions as integer, for example, require a level so we can pass in a level and an optional

10:08.390 --> 10:09.830
context string.

10:09.830 --> 10:14.810
And this returns us an integer, a evaluated on the curve at that level.

10:14.810 --> 10:16.490
That's if we want an integer.

10:16.490 --> 10:18.440
We don't have to take an integer.

10:18.440 --> 10:26.090
We can simply evaluate, we can evaluate at current level, which gets the value and possible curve.

10:26.090 --> 10:30.680
So we'd have to pass in an F real curve pointer by reference.

10:30.710 --> 10:36.560
A pointer by reference might seem a little strange, but it's just passing in a pointer and the function

10:36.560 --> 10:38.060
will change that pointer.

10:38.090 --> 10:44.750
We can also get value at level, which requires a level and returns the scaled value at the given level.

10:44.750 --> 10:48.890
So we're going to call get value at level and just pass in the ability level.

10:48.890 --> 10:51.320
So we're going to call get ability level.

10:51.320 --> 10:58.400
We know this returns an INT 32 and the function requires a float, that's fine, it'll just perform

10:58.400 --> 11:00.110
an implicit conversion.

11:00.110 --> 11:07.520
So this is going to return a float that's scaled by our ability level and we can pass this in as the

11:07.520 --> 11:08.360
magnitude.

11:08.360 --> 11:15.290
I'm going to go ahead and make a const float called scaled Damage and set it equal to this.

11:15.440 --> 11:20.810
And I'd like to go ahead and use an on screen debug message to print this.

11:20.810 --> 11:29.690
So I'm going to use G engine add on screen debug message with a key of negative one time to display

11:29.690 --> 11:34.520
can be three point f f color can be red.

11:35.360 --> 11:41.990
And for the string we're going to make an f string print f formatted string.

11:43.610 --> 11:54.260
That's going to say firebolt damage percent f and we're going to pass in scaled damage.

11:55.930 --> 11:58.930
So this way at least we'll get to see how much damage we're doing.

11:58.930 --> 12:04.870
And we can always change what we're passing in for the level to see that value scaled differently.

12:04.870 --> 12:11.710
Now, we're not going to cover how to set the abilities level just yet, but we will be able to level

12:11.710 --> 12:14.260
up abilities later on in the course.

12:14.500 --> 12:22.780
For now, we can just use our scaled damage, which by the way, we want to change from 50 here in assign

12:22.780 --> 12:26.470
tags set by color magnitude now to scaled damage.

12:26.470 --> 12:29.800
So now damage will be scaled based on ability level.

12:30.010 --> 12:32.230
Let's go ahead and launch.

12:33.040 --> 12:33.760
Okay.

12:33.760 --> 12:37.690
I'll go ahead and open up our asset editors here.

12:37.840 --> 12:42.790
But really, I'd like to cause damage and see what we get printed out to the screen.

12:43.380 --> 12:44.460
Here we go.

12:44.460 --> 12:46.500
And we saw that damage.

12:46.500 --> 12:51.450
And of course, we saw it immediately as soon as we launched the fireball, because we're printing this

12:51.450 --> 12:55.650
message immediately right here in Spawn Projectile.

12:55.650 --> 12:56.940
We're not printing the message.

12:56.940 --> 13:02.430
When the projectile hits, we're printing the message right away when we create the gameplay effect

13:02.430 --> 13:03.030
spec.

13:03.970 --> 13:10.780
And we're seeing that that value is five, which makes sense because if we look at CT damage at level

13:10.780 --> 13:12.970
one, the value is five.

13:13.000 --> 13:15.670
But what if our level was, say, 20?

13:15.700 --> 13:18.820
Well, we should see a value of about 41.

13:18.820 --> 13:19.540
Right.

13:19.570 --> 13:21.850
So we can test that out.

13:21.880 --> 13:23.560
Let's go ahead and close the editor.

13:23.560 --> 13:26.320
I'm going to save all and for scale damage.

13:26.320 --> 13:32.170
Instead of passing in get ability level, we can pass in 20 is what I think I said.

13:32.380 --> 13:36.280
So let's see if we get a different scaled value here.

13:37.830 --> 13:38.280
Okay.

13:38.280 --> 13:44.670
So with an ability level of 20, I'm going to launch the fireball and we have 41.

13:44.670 --> 13:50.100
And as it appears, we're doing a lot more damage based on that health bar there.

13:50.340 --> 13:53.350
So it looks like things are working.

13:53.370 --> 13:54.860
This is looking great.

13:54.870 --> 14:02.040
I'm going to go ahead and change this back from 20 to get ability level A Control Z should do it and

14:02.040 --> 14:03.570
do a quick compile.

14:03.570 --> 14:08.040
And it looks like everything's working all right now.

14:08.040 --> 14:13.110
We don't really need this onscreen debug message, so I'm going to go ahead and remove it for now.

14:13.320 --> 14:20.550
And just to appease Rider, I'm going to go ahead and just make gameplay tags a const variable.

14:20.550 --> 14:28.680
And with that we now have damage assigned based on the ability level thanks to a scalable float that

14:28.680 --> 14:30.900
we added to our gameplay ability.

14:30.900 --> 14:38.260
And now we have a damage curve table set to scale the damage for Firebolt and we can use that same curve

14:38.290 --> 14:43.000
table for any other type of damage, which is great.

14:43.540 --> 14:46.540
So excellent job and I'll see you in the next video.
