WEBVTT

00:04.190 --> 00:06.050
Welcome to your next quest.

00:06.050 --> 00:12.530
In this quest, you're going to implement cost and cooldown for Arcane Shards, so make sure that you

00:12.530 --> 00:18.320
take all the steps into account and then playtest to make sure that your cooldown is reflected in the

00:18.320 --> 00:19.400
HUD as well.

00:19.430 --> 00:21.860
So pause the video and do this now.

00:25.600 --> 00:27.760
Okay, so cost and cooldown.

00:27.760 --> 00:29.890
We need to do a couple things.

00:29.890 --> 00:37.990
For one, I'm going to open up my CT cost because I have curves for both Firebolt and Lightning Electrocute.

00:37.990 --> 00:42.820
Now at this point I'm getting a bit tired of using constant values.

00:42.820 --> 00:44.260
I'd rather use a curve.

00:44.260 --> 00:52.120
So what I'm going to do is just make a new CT cost, and it's going to be a curve table with a different

00:52.120 --> 00:53.170
interpolation type.

00:53.170 --> 00:58.690
So I'm going to go to miscellaneous, create a curve table and it's going to be cubic.

00:58.690 --> 01:00.220
We'll go ahead and create it.

01:00.220 --> 01:04.030
And I'm going to call this CT underscore spell cost.

01:04.890 --> 01:06.270
And I'm going to create curves.

01:06.270 --> 01:08.400
Now taking a look at Firebolt.

01:08.400 --> 01:11.910
We start at 2.5 and at ten we're about 35.

01:12.330 --> 01:19.230
So in spell cost I'm going to rename the curve to Firebolt and add a point.

01:20.000 --> 01:25.550
And this first key is going to have at level one a cost of 2.5.

01:27.110 --> 01:29.660
And we'll go ahead and add another key.

01:30.470 --> 01:32.840
And this is going to be at level 40.

01:33.380 --> 01:37.280
Now I'm going to try a value of say 25.

01:38.130 --> 01:41.130
And see what my curve value is at level two.

01:41.160 --> 01:42.660
It's at 1.5.

01:43.050 --> 01:46.380
And over here I see at level two it was about three.

01:46.410 --> 01:52.530
So I can increase that point here at level 40 to about 40.

01:52.800 --> 01:55.890
And now at two the cost is two.

01:55.920 --> 02:03.060
And if I increase it again to about 50 now at level two my cost is about 3.5.

02:03.090 --> 02:05.760
So we're just about there.

02:05.760 --> 02:09.900
And I can even tweak the shape by making it auto.

02:09.900 --> 02:15.870
Now at level two it's about 2.5 and I can make it increase a little bit faster.

02:17.010 --> 02:21.060
And now at level two, it's about 3.13.06.

02:21.060 --> 02:24.780
So the curve lets me adjust things a little bit easier.

02:24.780 --> 02:26.730
So I kind of like the curve better.

02:26.820 --> 02:30.090
I'm going to also add a curve for electrocute.

02:31.310 --> 02:32.690
Call this electrocute.

02:33.110 --> 02:34.790
We'll add two points.

02:37.490 --> 02:43.820
The first one starts at level one and its mana cost will be one and at level 40.

02:44.600 --> 02:46.820
Let's see what our CT cost has.

02:46.820 --> 02:49.340
It had a mana cost of seven at level ten?

02:49.340 --> 02:53.000
So at level 40 I'm going to go up to about 28.

02:54.260 --> 02:57.530
And at level ten the value is about seven.

02:57.530 --> 02:57.980
Perfect.

02:57.980 --> 03:02.990
So I'm going to go ahead and make this auto and make it a little less snaky.

03:02.990 --> 03:06.380
So almost more linear there and I'll save that.

03:06.380 --> 03:11.930
And finally I can add a curve for arcane shards.

03:12.460 --> 03:14.200
And we'll add two points.

03:16.410 --> 03:19.080
First will be at level one.

03:19.080 --> 03:22.110
What's our mana cost going to be for arcane shards?

03:22.110 --> 03:23.880
Well that depends.

03:23.880 --> 03:30.180
We can set it off at a higher value because this is a little bit more powerful of a spell.

03:30.180 --> 03:36.750
I'm going to set it with a mana cost of ten, and at level 40 we'll have a mana cost of, let's say

03:36.750 --> 03:37.770
85.

03:39.230 --> 03:40.970
So it looks like this.

03:40.970 --> 03:44.390
I'm going to make it a auto curve.

03:44.390 --> 03:50.330
And just like the others, I'm going to straighten it out just a bit and save that.

03:50.330 --> 03:54.830
And now we have CT spellcast instead of CT cost.

03:54.830 --> 03:57.320
And I'm going to use this in all of my spells.

03:57.320 --> 04:01.940
So going back to electrocute I can take a look at my cost gameplay effect class.

04:01.940 --> 04:09.980
I can browse to it and open it and scroll down and change my CT cost to CT spell cost.

04:10.220 --> 04:12.140
And I still have to select a curve.

04:12.140 --> 04:14.930
It's going to be electrocute for the electrocute spell.

04:14.930 --> 04:24.020
I'm going to save that and then I'll go into my abilities fire, open Firebolt and get my GE cost Firebolt

04:24.020 --> 04:26.150
and change its cost as well.

04:26.150 --> 04:31.670
So changing it from CT cost to CT spell cost, choosing Firebolt.

04:31.670 --> 04:33.020
And we're done there.

04:33.020 --> 04:35.990
And I'm going to go over to arcane.

04:35.990 --> 04:40.220
And I don't have an arcane gameplay cost okay.

04:40.220 --> 04:42.170
So I'm ready to make that.

04:42.170 --> 04:49.280
Before we do that though, I'm going to browse to CT cost, close it down and go ahead and just delete

04:49.280 --> 04:50.000
CT cost.

04:50.000 --> 04:51.380
We're not using it anymore.

04:51.380 --> 04:54.260
Now we have spell cost which is better.

04:54.650 --> 04:58.610
And I can go ahead and close out of CT spell cost.

04:58.610 --> 05:04.820
And here in Arcane Shards in its folder I'm going to make a new gameplay effect.

05:04.820 --> 05:14.000
So gameplay effect, we're going to make this and call it GE cost Arcane shards.

05:15.000 --> 05:16.380
We'll open this up.

05:16.380 --> 05:23.040
And just like the other costs, it's going to be an instant and we'll change the mana attribute.

05:24.090 --> 05:26.760
So scrolling down, we're going to leave it at instant.

05:26.760 --> 05:28.410
We're going to add a modifier.

05:28.740 --> 05:30.960
It's going to modify mana.

05:31.810 --> 05:33.010
It's going to add to it.

05:33.010 --> 05:34.780
We're going to have a scalable float.

05:34.780 --> 05:42.010
We're going to set it to negative one scaled by CT spell cost, choosing arcane shards.

05:42.460 --> 05:43.090
And that's it.

05:43.120 --> 05:50.020
We just have to go into arcane shards and go to class defaults and set its cost gameplay effect to cost

05:50.020 --> 05:51.100
arcane shards.

05:52.310 --> 05:53.600
Now for cooldown.

05:53.630 --> 05:59.090
Now cooldown is going to be its own gameplay effect, so we'll make one.

06:02.660 --> 06:07.730
And I'm going to call this GE cool down arcane shards.

06:08.270 --> 06:09.620
I'm going to open it up.

06:09.620 --> 06:11.930
And this one is going to have a duration.

06:11.930 --> 06:15.350
So we set the duration policy to has duration.

06:15.350 --> 06:19.850
And we're going to just hard code a duration for arcane shards.

06:19.850 --> 06:25.280
And I like arcane shards to have a cooldown of about let's say six seconds.

06:25.280 --> 06:27.860
I'd like this to have a longer cooldown.

06:27.890 --> 06:34.040
Now, the cooldown effects have a specific quality, and I'm going to go back to one of our others.

06:34.040 --> 06:35.390
Let's go to Firebolt.

06:36.260 --> 06:44.630
GE cooldown Firebolt just to remind you that even though they have no modifiers, they do have a granted

06:44.630 --> 06:47.360
tag and that's a cooldown tag.

06:48.080 --> 06:51.560
So we need a cooldown tag for Arcane Shards.

06:51.560 --> 06:55.250
We can just add one in project settings and go to Gameplay Tags.

06:55.250 --> 07:00.380
We can go to cooldown and we don't have an arcane sub category, so we're going to make one.

07:00.380 --> 07:05.630
So we're going to add cooldown Dot arcane Dot Arcane Shards.

07:06.260 --> 07:12.740
And now that that tag exists, we can close project settings and go to cooldown, not Firebolt, but

07:12.740 --> 07:16.640
Arcane Shards and add to its granted tags.

07:17.820 --> 07:22.170
And we're going to add cooldown arcane arcane shards.

07:22.560 --> 07:29.550
And with that, we just need to set the cooldown effect on the Arcane Shards ability all the way down

07:29.550 --> 07:30.540
at the bottom.

07:30.540 --> 07:31.980
It's going to be cooldown.

07:31.980 --> 07:34.800
Arcane Shards compile and save.

07:34.800 --> 07:36.930
Now that's almost everything.

07:36.930 --> 07:43.440
The only thing is, for our HUD to work, we need to make sure our data driven systems understand the

07:43.440 --> 07:46.530
cooldown associated with Arcane Shards.

07:46.530 --> 07:52.470
So we have to go to ability system data, ability info, and we have to find arcane shards.

07:52.470 --> 07:53.280
Here it is.

07:53.280 --> 07:59.790
We need to give it its cooldown tag and that's going to be cooldown arcane arcane shards.

07:59.790 --> 08:02.520
With that, we can test this out.

08:03.620 --> 08:07.730
I'm going to press play, I'm going to hit one and I'm going to.

08:08.420 --> 08:09.020
Cast.

08:09.020 --> 08:11.240
Arcane shards.

08:21.400 --> 08:24.340
All right, so I'm getting a big fat error.

08:25.200 --> 08:29.010
Where we're calling store shard spawn location.

08:29.370 --> 08:30.660
All right.

08:33.460 --> 08:35.440
So it looks like we're.

08:36.570 --> 08:38.760
Doing something wrong.

08:38.760 --> 08:40.350
And of course.

08:41.140 --> 08:43.000
If I go back to event graph.

08:43.620 --> 08:46.770
We're using Maxnum shards right here.

08:46.770 --> 08:54.600
But what about when we're getting our number of points right here in git ground points?

08:55.180 --> 08:58.180
We're passing in zero, so we're not getting any ground points.

08:58.180 --> 09:01.510
We actually have to pass that number in.

09:03.290 --> 09:04.310
Maximum shards.

09:04.310 --> 09:07.130
And in fact, we shouldn't use maximum shards, should we?

09:07.160 --> 09:12.110
We should calculate how many shards to spawn based on our level.

09:12.110 --> 09:19.070
So before we get our points from the point collection, get ground points, let's just move these forward

09:19.070 --> 09:19.850
a bit.

09:22.420 --> 09:26.560
And I'm going to get maximum shards.

09:30.110 --> 09:32.210
And we're going to call min.

09:33.380 --> 09:34.340
Integer.

09:34.880 --> 09:39.410
We're going to get the minimum between maximum shards and get ability level.

09:44.040 --> 09:50.400
Now we'll bring that in and we're going to promote this to a variable called num shards.

09:52.890 --> 09:54.270
And we're going to use this.

09:54.270 --> 09:56.730
We're going to use it and get ground points.

10:06.090 --> 10:08.340
And we're going to use it down here.

10:09.230 --> 10:10.700
Instead of the max.

10:12.680 --> 10:14.150
That's going to fix that.

10:21.870 --> 10:24.420
Okay, so we're at level one.

10:25.550 --> 10:27.170
We're spawning one shard.

10:27.170 --> 10:28.160
Perfect.

10:28.940 --> 10:29.360
Okay.

10:29.360 --> 10:31.550
And with that, we're just about ready to test.

10:31.550 --> 10:36.920
The only thing is, we need to commit our cost and our cooldown.

10:37.220 --> 10:43.130
Now, in arcane shards, where do we want to commit our cost and cooldown?

10:43.700 --> 10:50.480
Well, I'd like to commit the cost the first time that we summon a shard.

10:50.900 --> 10:55.850
In other words, right here is our set timer, and we spawn the first shard.

10:55.880 --> 10:58.730
I'd like to commit the ability cost here.

11:00.470 --> 11:02.930
So I'm going to call commit ability cost.

11:02.930 --> 11:07.790
And we should see our mana get spent for this.

11:09.070 --> 11:09.520
Now.

11:09.520 --> 11:15.610
We shouldn't cast the spell at all if we can't afford the cost, and we can check the cost, we can

11:15.610 --> 11:24.730
say check cost and check ability cost checks to see if we can afford the cost, but it doesn't apply

11:24.730 --> 11:25.420
the cost.

11:25.420 --> 11:27.820
We can do that right at the beginning.

11:27.820 --> 11:30.130
So we're going to go all the way up to here.

11:30.650 --> 11:36.950
Check the ability, cost and only if we can afford the ability cost should we do anything.

11:36.950 --> 11:38.300
And we can test that.

11:38.300 --> 11:40.310
So we'll have this branch here.

11:41.140 --> 11:46.690
Will commit the ability cost when we first spawn a shard, and in fact we can commit the cooldown at

11:46.690 --> 11:47.950
this point as well.

11:47.950 --> 11:54.310
Or we can wait until the last of our shards is spawned and commit the cooldown and end the ability there.

11:54.340 --> 11:57.460
I'd like to do that there, so I'm going to remove this delay.

11:57.460 --> 12:01.870
That was just a hack and we're going to destroy the point collection.

12:01.870 --> 12:03.580
Commit the cooldown.

12:04.280 --> 12:06.020
So we'll say commit ability.

12:06.020 --> 12:07.010
Cooldown.

12:12.760 --> 12:14.560
And we can end the ability here.

12:15.770 --> 12:17.210
Let's see how this works.

12:20.890 --> 12:22.450
So there's our cool down.

12:24.140 --> 12:25.370
Can't cast it.

12:28.960 --> 12:29.980
There we go.

12:30.010 --> 12:36.280
Now, just to test out what we did at the beginning of Arcane Shards.

12:36.280 --> 12:38.740
Namely, check the cost.

12:38.740 --> 12:42.160
We can see what happens if we don't have enough mana here.

12:42.700 --> 12:46.570
So to do that, I'm going to go to cost arcane shards.

12:47.610 --> 12:49.830
And scale this by say.

12:50.580 --> 12:53.250
Negative ten instead of negative one.

12:56.460 --> 12:58.740
Now we have just about zero mana.

12:58.860 --> 13:04.050
And if I try to cast the spell once the cooldown is over, I can't cast it.

13:04.080 --> 13:08.910
I can cast my other spells, but I can't cast this one because I can't afford it.

13:08.910 --> 13:14.730
So that's how we can prevent casting inability when we don't have the mana.

13:15.120 --> 13:20.190
I'm going to go back to the cost for arcane shards and set that back to negative one, as I believe

13:20.190 --> 13:21.660
that's a little too expensive.

13:22.250 --> 13:23.450
And with that.

13:24.330 --> 13:30.690
We now have cost and cooldown for Arcane Shards, and Arcane Shards has a bit more of a cooldown than

13:30.690 --> 13:31.500
the others.

13:31.980 --> 13:34.020
Now I can level up.

13:36.800 --> 13:37.880
Oops, I got stunned.

13:37.910 --> 13:39.200
I can't move.

13:39.530 --> 13:40.910
I need to move away.

13:40.910 --> 13:41.570
Okay?

13:41.570 --> 13:46.550
And I'm going to level up my arcane shards.

13:47.110 --> 13:48.850
Now I see it's level two.

13:49.890 --> 13:51.390
And I'm going to cast it.

13:53.400 --> 13:54.840
And we get two shards.

13:54.840 --> 13:55.740
Sweet.

13:55.740 --> 13:57.600
I'm going to level it up again.

13:58.210 --> 13:59.350
And cast it.

14:00.570 --> 14:01.770
And we get three shards.

14:01.770 --> 14:03.360
I'm going to level it up again.

14:04.800 --> 14:06.000
And cast it.

14:08.940 --> 14:09.990
Perfect.

14:12.220 --> 14:13.000
Excellent.

14:13.000 --> 14:16.030
So Arcane Shards is officially done.

14:16.970 --> 14:18.080
Awesome job.

14:18.080 --> 14:21.290
I hope you're ready for another exciting ability.

14:21.320 --> 14:22.970
I'll see you soon.
