All right.
So now our spell globes need to know what cooldown tag to listen for.
That means they need to receive that in the ability info struct.
When ability info is broadcast.
So that's something that we'll need to add to that struct.
So we need to make sure that we broadcast that info.
Additionally, I'd like this wait for cooldown change node to return a reference to the task that we've
just created.
That way we can end it if it already exists.
So in other words, we want a little output value pin here that will return that.
So a couple of things to do.
Let's go ahead and close the editor.
What we'll do is we'll go into wait cooldown, change, and to get that output pin, we go to our UClass
macro.
I'm going to make sure it has blueprint type that's already there by default, but just making it clear
and then we use meta equals and we can say exposed async proxy and then we say what we want that to
be called.
We're going to call it async task.
So now we should see async task.
And just quickly to show that I'm going to run this in debug mode to see that change to our task node.
So back here in our spell globe in the event graph now we have an async task node and what we can do
with this is we can promote that to a variable.
So we have this at all times.
I'm going to call this.
Wait cooldown, change task.
And before we actually call this before we reach this node, it's a good idea to call that end task
function we created just in case one already exists.
And that way we're not overwriting this.
We don't get any memory leaks.
So I'm going to add a pen and this will be the then three.
And before we even get to this, we're going to get our wait cooldown change.
We're going to make it a validated get.
And if it is valid, we're going to end it.
We're going to call that blueprint callable end task function that we created where that takes care
of ending it before we create another one.
Okay, So now that we've got that, let's focus on making sure that our spell globe knows the cooldown
tag that it's supposed to listen for.
So step one will be adding a cooldown tag to the ability info.
So we're going to close our editor.
And our ability info struct is defined in the data asset class.
So we can go to public ability system data and that data asset class is ability info.
Here's where we're going to have a gameplay tag for the cooldown tag.
So this is going to be called cooldown tag.
Now we can set this in our ability info blueprint so we can actually make this edit defaults only blueprint
read only.
And then as long as we set the cooldown tag for each gameplay ability in the data asset, then when
we broadcast this an overlay widget controller here our ability info delegate that will be broadcast
up to our widgets.
So all we need to do is set that cooldown tag and the ability info data asset blueprint and then we
can retrieve that cooldown tag in our widgets.
So let's do that.
Okay.
Back in the editor.
We're going to open our data asset.
So we'll go to blueprints, ability system data and open ability info.
And now we have a cooldown tag.
We just need to set this to cooldown fire Firebolt for our firebolt ability.
Now that's going to be received in our spell globe when it receives ability info here.
So we need to go into receive ability info and take our cooldown tag.
And if you don't see it, go ahead and expand the break for Aura ability info.
We want to promote this to a variable, not a local variable, but a variable on this widget.
But we don't want to do this for all the widgets.
We only want to do it for the widgets for which this cooldown tag applies.
That's the widgets that have the input tag that matches.
So we're only going to promote the cooldown tag to a variable in the true case when we check if the
input tag matches.
Otherwise, all of them are going to have the same cooldown tag, right?
So we're going to take cooldown tag and just after the branch we're going to promote this to a variable.
We'll call it cooldown tag.
I like to remove the space and the name there and we'll only set it if it's true here.
Now let's go back out to the event graph.
As soon as receive ability info is called in response to the ability info delegate broadcast, then
our spell globe will have its cooldown tag set.
Now we can't just use this, wait for cooldown, change right away.
Right after we've bound to this delegate.
We have to wait until receive ability info has been called.
Only then do we have our cooldown tag.
Right.
So we have to do all of this stuff after we receive the ability info.
In other words, we can do a sequence here.
And then do these things after we have a valid cooldown tag.
So let's move these just over here and use the sequence.
First, we check if we should end the task.
Then we start the task and instead of hard coding in Firebolt, we can now use our cooldown tag instead.
So let's go ahead and see how this works.
Now, we should only see one message.
There it is.
And we should see the end message.
There it is.
So that's only for the one spell globe that has the cooldown tag listening for its firebolt spell.
The others don't have the firebolt spell.
All right.
So that is the next step.
We now have a cooldown tag and as soon as we receive ability info, then the cooldown tag will be set
for this given spell globe widget.
Now we need to figure out how we can update the spell globe to show the correct time here and also to
make it dark so that it looks like it's actually grayed out.
And then we can know for sure that once we cast a spell, we'll see it dark here.
We'll see the countdown time and then it'll get bright again when we can cast the spell again.
And we'll do all that in the next video.
So great job.
I'll see you soon.