WEBVTT

00:07.010 --> 00:07.610
All right.

00:07.610 --> 00:12.350
So now our spell globes need to know what cooldown tag to listen for.

00:12.380 --> 00:16.820
That means they need to receive that in the ability info struct.

00:16.850 --> 00:19.420
When ability info is broadcast.

00:19.430 --> 00:23.520
So that's something that we'll need to add to that struct.

00:23.540 --> 00:27.050
So we need to make sure that we broadcast that info.

00:27.350 --> 00:35.150
Additionally, I'd like this wait for cooldown change node to return a reference to the task that we've

00:35.150 --> 00:36.060
just created.

00:36.080 --> 00:39.110
That way we can end it if it already exists.

00:39.110 --> 00:44.930
So in other words, we want a little output value pin here that will return that.

00:44.990 --> 00:46.460
So a couple of things to do.

00:46.460 --> 00:48.240
Let's go ahead and close the editor.

00:48.260 --> 00:56.020
What we'll do is we'll go into wait cooldown, change, and to get that output pin, we go to our UClass

00:56.030 --> 00:56.810
macro.

00:57.710 --> 01:03.860
I'm going to make sure it has blueprint type that's already there by default, but just making it clear

01:03.860 --> 01:12.330
and then we use meta equals and we can say exposed async proxy and then we say what we want that to

01:12.330 --> 01:13.100
be called.

01:13.110 --> 01:15.360
We're going to call it async task.

01:15.360 --> 01:17.610
So now we should see async task.

01:17.610 --> 01:25.080
And just quickly to show that I'm going to run this in debug mode to see that change to our task node.

01:25.660 --> 01:34.570
So back here in our spell globe in the event graph now we have an async task node and what we can do

01:34.570 --> 01:37.210
with this is we can promote that to a variable.

01:37.210 --> 01:39.280
So we have this at all times.

01:39.280 --> 01:40.750
I'm going to call this.

01:41.650 --> 01:44.920
Wait cooldown, change task.

01:45.280 --> 01:53.080
And before we actually call this before we reach this node, it's a good idea to call that end task

01:53.080 --> 01:56.890
function we created just in case one already exists.

01:56.890 --> 01:59.290
And that way we're not overwriting this.

01:59.320 --> 02:01.080
We don't get any memory leaks.

02:01.090 --> 02:06.430
So I'm going to add a pen and this will be the then three.

02:06.580 --> 02:13.300
And before we even get to this, we're going to get our wait cooldown change.

02:13.300 --> 02:15.700
We're going to make it a validated get.

02:15.700 --> 02:18.580
And if it is valid, we're going to end it.

02:18.580 --> 02:25.240
We're going to call that blueprint callable end task function that we created where that takes care

02:25.240 --> 02:28.180
of ending it before we create another one.

02:29.140 --> 02:37.540
Okay, So now that we've got that, let's focus on making sure that our spell globe knows the cooldown

02:37.540 --> 02:39.820
tag that it's supposed to listen for.

02:40.400 --> 02:44.840
So step one will be adding a cooldown tag to the ability info.

02:44.990 --> 02:47.000
So we're going to close our editor.

02:48.000 --> 02:52.890
And our ability info struct is defined in the data asset class.

02:52.890 --> 02:59.100
So we can go to public ability system data and that data asset class is ability info.

02:59.390 --> 03:03.060
Here's where we're going to have a gameplay tag for the cooldown tag.

03:03.900 --> 03:06.360
So this is going to be called cooldown tag.

03:07.180 --> 03:14.860
Now we can set this in our ability info blueprint so we can actually make this edit defaults only blueprint

03:14.860 --> 03:15.670
read only.

03:17.370 --> 03:23.970
And then as long as we set the cooldown tag for each gameplay ability in the data asset, then when

03:23.970 --> 03:30.570
we broadcast this an overlay widget controller here our ability info delegate that will be broadcast

03:30.570 --> 03:32.120
up to our widgets.

03:32.130 --> 03:38.700
So all we need to do is set that cooldown tag and the ability info data asset blueprint and then we

03:38.700 --> 03:42.030
can retrieve that cooldown tag in our widgets.

03:42.030 --> 03:43.320
So let's do that.

03:44.170 --> 03:44.620
Okay.

03:44.620 --> 03:45.760
Back in the editor.

03:45.820 --> 03:47.770
We're going to open our data asset.

03:47.770 --> 03:53.200
So we'll go to blueprints, ability system data and open ability info.

03:53.200 --> 03:55.330
And now we have a cooldown tag.

03:55.330 --> 04:01.090
We just need to set this to cooldown fire Firebolt for our firebolt ability.

04:01.120 --> 04:07.120
Now that's going to be received in our spell globe when it receives ability info here.

04:07.660 --> 04:12.490
So we need to go into receive ability info and take our cooldown tag.

04:12.490 --> 04:17.170
And if you don't see it, go ahead and expand the break for Aura ability info.

04:17.260 --> 04:22.720
We want to promote this to a variable, not a local variable, but a variable on this widget.

04:22.720 --> 04:24.980
But we don't want to do this for all the widgets.

04:25.000 --> 04:29.590
We only want to do it for the widgets for which this cooldown tag applies.

04:29.620 --> 04:33.230
That's the widgets that have the input tag that matches.

04:33.250 --> 04:40.750
So we're only going to promote the cooldown tag to a variable in the true case when we check if the

04:40.750 --> 04:41.840
input tag matches.

04:41.860 --> 04:45.040
Otherwise, all of them are going to have the same cooldown tag, right?

04:45.040 --> 04:51.220
So we're going to take cooldown tag and just after the branch we're going to promote this to a variable.

04:51.220 --> 04:52.750
We'll call it cooldown tag.

04:52.750 --> 04:58.390
I like to remove the space and the name there and we'll only set it if it's true here.

04:58.600 --> 05:01.030
Now let's go back out to the event graph.

05:01.510 --> 05:09.890
As soon as receive ability info is called in response to the ability info delegate broadcast, then

05:09.890 --> 05:12.950
our spell globe will have its cooldown tag set.

05:12.980 --> 05:17.390
Now we can't just use this, wait for cooldown, change right away.

05:17.390 --> 05:20.000
Right after we've bound to this delegate.

05:20.030 --> 05:23.960
We have to wait until receive ability info has been called.

05:23.960 --> 05:26.390
Only then do we have our cooldown tag.

05:26.390 --> 05:26.900
Right.

05:26.900 --> 05:32.050
So we have to do all of this stuff after we receive the ability info.

05:32.060 --> 05:34.550
In other words, we can do a sequence here.

05:37.170 --> 05:42.040
And then do these things after we have a valid cooldown tag.

05:42.060 --> 05:46.160
So let's move these just over here and use the sequence.

05:46.170 --> 05:48.750
First, we check if we should end the task.

05:48.780 --> 05:56.400
Then we start the task and instead of hard coding in Firebolt, we can now use our cooldown tag instead.

05:57.180 --> 05:59.430
So let's go ahead and see how this works.

05:59.430 --> 06:01.890
Now, we should only see one message.

06:01.890 --> 06:02.880
There it is.

06:02.910 --> 06:05.040
And we should see the end message.

06:05.040 --> 06:05.970
There it is.

06:05.970 --> 06:14.940
So that's only for the one spell globe that has the cooldown tag listening for its firebolt spell.

06:14.970 --> 06:17.130
The others don't have the firebolt spell.

06:17.610 --> 06:18.480
All right.

06:18.480 --> 06:20.550
So that is the next step.

06:20.550 --> 06:27.510
We now have a cooldown tag and as soon as we receive ability info, then the cooldown tag will be set

06:27.510 --> 06:31.110
for this given spell globe widget.

06:31.140 --> 06:38.820
Now we need to figure out how we can update the spell globe to show the correct time here and also to

06:38.850 --> 06:43.260
make it dark so that it looks like it's actually grayed out.

06:43.260 --> 06:48.120
And then we can know for sure that once we cast a spell, we'll see it dark here.

06:48.120 --> 06:53.460
We'll see the countdown time and then it'll get bright again when we can cast the spell again.

06:53.460 --> 06:55.890
And we'll do all that in the next video.

06:55.890 --> 06:57.310
So great job.

06:57.340 --> 06:58.480
I'll see you soon.
