WEBVTT

00:06.940 --> 00:08.170
Welcome back.

00:08.290 --> 00:15.280
Now, here in GE damage we're hard coding a 25 for our scalable float magnitude.

00:15.520 --> 00:23.080
Now sometimes we'd like to be able to set the magnitude when we're creating the effect spec or perhaps

00:23.080 --> 00:26.200
applying the effect we'd like more control.

00:26.410 --> 00:33.430
For instance, from our gameplay ability, our ability may have a base damage value that we'd like to

00:33.430 --> 00:37.660
set on the gameplay effect that our ability is causing.

00:37.960 --> 00:44.410
Let's see how we're handling setting the effect or effect spec when we're launching a projectile.

00:45.290 --> 00:53.270
So if we go into abilities and or a projectile spell, we'll see that we're creating a gameplay effect

00:53.270 --> 01:00.760
spec with make outgoing spec and we're taking the spec handle and we're setting that on the projectile.

01:00.770 --> 01:06.050
The projectile has a damage effect spec handle variable that we're setting.

01:06.350 --> 01:11.540
So we're setting the damage gameplay effect for the projectile spell.

01:11.810 --> 01:17.750
But as soon as we set that spec handle for our projectile which will apply it later, that spec handle

01:17.750 --> 01:24.260
should carry the information for how much damage to cause and we should be able to set that here from

01:24.260 --> 01:28.490
the ability if our ability wants to have some kind of value.

01:28.490 --> 01:33.650
In other words, the ability itself should determine how much damage to do, not the effect.

01:33.650 --> 01:38.780
And to do that we can use the set by caller option on the gameplay effect.

01:38.780 --> 01:45.930
So currently our damage gameplay effect uses scalable float for its magnitude calculation type.

01:46.020 --> 01:52.500
And we know that this is great because we can use curve tables to scale the magnitude, but we have

01:52.500 --> 01:56.790
a fourth option that we haven't learned about yet called set by caller.

01:57.120 --> 02:03.660
And it says this magnitude will be set explicitly by the code slash blueprint that creates the spec.

02:03.660 --> 02:10.680
So that's what we'd like to do Now, set by caller magnitudes are pairs their key value pairs where

02:10.680 --> 02:12.630
the key is a gameplay tag.

02:12.630 --> 02:17.670
So we need a gameplay tag to identify the set by caller magnitude.

02:17.730 --> 02:25.740
So first we're going to make a gameplay tag for damage and we can do that by going into our gameplay

02:25.740 --> 02:27.750
tags Singleton class.

02:27.750 --> 02:30.630
So it's here in Aura gameplay tags.

02:30.630 --> 02:34.410
We're going to make a gameplay tag simply called damage.

02:34.530 --> 02:43.800
So just under our inputs, I'm going to make a new gameplay tag called Damage and we need to make sure

02:43.800 --> 02:47.190
that we're creating this native gameplay tag.

02:47.670 --> 02:54.840
So opening the CPP file here is where we're creating all of our gameplay tags and just under input tags

02:54.840 --> 02:56.550
we're going to make damage.

02:56.850 --> 03:03.690
So let's go ahead and just copy and paste the last input tag that we declared.

03:03.690 --> 03:12.450
And this one will be the damage tag and its name is simply going to be damage and the input string can

03:12.450 --> 03:14.490
simply be damage.

03:14.700 --> 03:21.450
So now we've got a native gameplay tag called Damage and we can use this and we're going to use that

03:21.450 --> 03:29.310
in our projectile spell as I'd like to get those gameplay tags or a gameplay tags, I'm going to include

03:29.310 --> 03:30.690
that header file here.

03:32.720 --> 03:38.480
So it's aura and public and aura gameplay tags.

03:39.230 --> 03:41.400
So we can get those gameplay tags.

03:41.420 --> 03:48.050
And I'm going to do this right here before we set the projectiles damage effect spec handle, we're

03:48.050 --> 03:54.260
going to say F or a gameplay tags gameplay tags equals F.

03:54.980 --> 03:57.170
Or a gameplay tags get.

03:57.590 --> 04:03.500
So now we have those tags and now we can use a set by caller magnitude.

04:03.590 --> 04:07.700
Now this is done using the ability system Blueprint library.

04:07.700 --> 04:12.710
So we're going to say you ability system, blueprint library.

04:13.070 --> 04:19.190
And the function we're interested in is called assign tag set by caller magnitude.

04:19.370 --> 04:26.540
Now assign tags set by caller magnitude is going to require a gameplay effect spec handle.

04:26.540 --> 04:27.500
And we have one.

04:27.500 --> 04:32.360
It's called spec handle, so we're going to pass that in next.

04:32.360 --> 04:36.020
It requires a gameplay tag and it's called data tag.

04:36.020 --> 04:43.670
So this is how we identify that magnitude value because you can assign multiple set by caller magnitudes

04:43.670 --> 04:45.530
to a gameplay effect spec.

04:45.530 --> 04:50.060
We're going to set a key value pair where the key is the damage tag.

04:50.060 --> 04:57.510
So we're going to use gameplay tags, dot damage and the magnitude is whatever we decide here.

04:57.540 --> 05:01.560
Our aura projectile spell could have its own damage variable.

05:01.710 --> 05:05.460
But to see how this works, I'm just going to hardcode a value.

05:05.460 --> 05:11.610
Let's use 50 and that's all we have to do to set the set by caller magnitude.

05:11.610 --> 05:18.030
So now this spec handle is carrying along a pair, a key value pair.

05:18.030 --> 05:23.640
The key is the damage gameplay tag and the value is the magnitude 50.

05:23.670 --> 05:30.360
Now we just need to be able to access that key value pair from within our gameplay effect when applying

05:30.360 --> 05:31.350
a modifier.

05:31.350 --> 05:32.700
So let's do that.

05:32.730 --> 05:33.120
Now.

05:33.120 --> 05:34.350
I still have the editor open.

05:34.350 --> 05:39.930
I'm going to go ahead and close it so that I can do a fresh compile and launch and we'll go back into

05:39.930 --> 05:41.250
our gameplay effect.

05:43.540 --> 05:50.980
So I'm going to go ahead and open damage and scroll down and now we're going to change our magnitude

05:50.980 --> 05:52.350
calculation type.

05:52.360 --> 05:56.740
We're going to change it from scalable float to set by caller.

05:56.890 --> 06:02.980
Now, once we do this, we have a set by caller magnitude dropdown which we can expand.

06:03.070 --> 06:08.860
Now, because we can have multiple set by caller magnitudes on a given gameplay effect spec, we need

06:08.860 --> 06:14.320
to choose which one and they're identified by the key the gameplay tag key.

06:14.350 --> 06:19.090
So for the data tag we have to select the tag that we want.

06:19.120 --> 06:26.290
We're going to select damage and as soon as we select damage now this modifier will do 50 damage.

06:26.290 --> 06:26.560
Why?

06:26.590 --> 06:34.660
Because that's the value we associated with this key when we called assign tag set by caller magnitude.

06:34.660 --> 06:37.470
So we should see 50 damage being done.

06:37.480 --> 06:42.700
Let's go ahead and test this out and see if we do more damage than last time.

06:42.700 --> 06:44.150
And in fact, we do.

06:44.180 --> 06:46.520
It looks like we're doing 50 damage.

06:47.130 --> 06:47.820
Great.

06:48.210 --> 06:53.160
So that's how we can use the set by caller magnitude calculation type.

06:53.280 --> 06:58.230
Now, yes, we're moving one hard coded value into another class.

06:58.230 --> 07:05.910
Right now we're hard coding 50, but at least now our gameplay ability has control over how much damage

07:05.910 --> 07:07.920
is done by our projectile.

07:07.920 --> 07:13.740
It's not just set in the gameplay effect itself, it's now something we control from code and we're

07:13.740 --> 07:16.380
going to control that from the gameplay ability.

07:16.380 --> 07:24.930
And I think gameplay abilities can have a base damage property that we can set based on our gameplay

07:24.930 --> 07:26.220
abilities level.

07:26.340 --> 07:33.570
So we're going to handle adding a member variable to the aura gameplay ability class to handle damage

07:33.570 --> 07:34.950
and we'll do that next.

07:34.980 --> 07:37.200
So great job and I'll see you soon.
