WEBVTT

00:06.780 --> 00:07.740
Welcome back.

00:07.740 --> 00:15.480
So we just created some animations in equipped spells row and we're going to remove these nodes with

00:15.480 --> 00:16.410
event construct.

00:16.410 --> 00:19.080
We just wanted to see what those animations looked like.

00:19.080 --> 00:23.340
I'm going to unhide both of them and just save that.

00:23.990 --> 00:29.720
And close those textures I'm not using and go back and take a look at the spell menu.

00:29.750 --> 00:38.480
Now, what we do when we click on a spell globe is we're enabling or disabling these two buttons.

00:38.600 --> 00:45.140
And if we're selecting a spell globe that's eligible to be equipped and we click on the equip button,

00:45.140 --> 00:49.250
we're going to want to show the user where they need to click next.

00:49.250 --> 00:56.360
They need to click on an offensive spell globe If they are selecting an offensive ability and a passive

00:56.360 --> 00:58.310
one, if they're selecting a passive one.

00:58.640 --> 01:05.360
For this reason, abilities need to know whether or not they're offensive or passive.

01:05.390 --> 01:07.130
They need an ability type.

01:07.750 --> 01:12.580
And this is something that I'd like to keep set in our data asset.

01:12.610 --> 01:17.830
So in Blueprint's ability system data, I want to go to ability info.

01:18.560 --> 01:25.070
And for each gameplay ability I want a ability type tag.

01:25.250 --> 01:29.150
So we're going to add that to our data asset ability info.

01:29.390 --> 01:36.710
Now in addition to that, when we click on the equip button in the spell menu, we need a blueprint

01:36.710 --> 01:42.280
callable function to call on the widget controller to tell it that we're equipping something.

01:42.290 --> 01:49.970
And in addition to that, as soon as we click on the equip button, we'll be playing those animations.

01:50.060 --> 01:55.670
So we have a couple things that we want to add in C plus plus, so we'll close the editor.

01:56.330 --> 02:04.220
And we'll go ahead and open ability system data and get that ability info open and our aura ability

02:04.220 --> 02:07.370
info struct now needs another gameplay tag.

02:07.370 --> 02:10.430
It needs a ability type tag.

02:10.670 --> 02:12.650
So let's go ahead and add that.

02:12.650 --> 02:16.880
I'll put it after the cooldown tag and we'll call this ability type.

02:17.960 --> 02:21.830
So we'll remember to set that for our abilities.

02:21.950 --> 02:27.020
Now we're going to need a blueprint callable function in our widget controller class.

02:27.020 --> 02:30.410
So let's go to UI, widget controller and open spell menu.

02:30.410 --> 02:31.640
Widget controller.

02:31.640 --> 02:36.770
We're going to add a blueprint callable function for when the equip button is pressed.

02:36.770 --> 02:39.230
We'll call it equip button pressed.

02:41.510 --> 02:44.000
And it'll just be blueprint callable.

02:45.080 --> 02:47.180
So we can define this one.

02:48.500 --> 02:51.560
And what is a button press going to do?

02:51.590 --> 02:58.910
Well, for one, we need to tell the widget our spell menu that it needs to start playing an animation.

02:58.940 --> 03:04.340
What we're really doing is waiting for the user to choose an equip selection.

03:04.610 --> 03:08.780
Basically one of the slots down there that we want to equip to.

03:09.170 --> 03:15.230
So we're going to make a delegate to broadcast for this very reason, and it's just going to broadcast

03:15.230 --> 03:16.580
the ability type.

03:16.820 --> 03:21.050
We need to know the type of the ability we currently have selected.

03:21.380 --> 03:26.210
So let's go to spell menu, widget controller and declare a delegate.

03:26.660 --> 03:33.100
So it's going to be a dynamic multicast and it'll just have one param for the ability type.

03:33.110 --> 03:39.200
So we're going to declare dynamic multicast.

03:40.680 --> 03:49.560
And we'll do a delegate one param and I'm going to call this f wait for equip selection.

03:51.510 --> 03:53.970
And we can tack on signature to it.

03:55.720 --> 04:02.200
And it's one param will be a const f gameplay tag and it's going to be the ability type.

04:03.360 --> 04:05.040
So let's make one of these.

04:05.040 --> 04:06.210
We'll add it.

04:06.600 --> 04:07.800
It'll be right here.

04:07.800 --> 04:12.750
And we'll call it wait for equip, delegate.

04:13.740 --> 04:15.720
And we'll make it blueprint assignable.

04:16.440 --> 04:20.610
So that's what we want to broadcast and equip button pressed.

04:20.610 --> 04:23.010
And that means we need to get the abilities.

04:23.040 --> 04:24.240
Ability type.

04:24.360 --> 04:28.680
So to get the ability type, we need the ability info.

04:28.830 --> 04:36.930
Luckily spell menu widget controller has ability info and we can get find ability info for tag and we

04:36.930 --> 04:40.510
need to get the ability info for our currently selected ability.

04:40.530 --> 04:47.460
So we use selected ability dot ability and once we have that ability info we can get the ability type.

04:47.700 --> 04:54.930
So we can say dot ability type and we can store this in a local gameplay tag.

04:55.020 --> 04:58.860
Const gameplay tag ability type.

05:00.060 --> 05:07.350
Now that we have the ability type, we can broadcast our delegate so we can say wait for equipped delegate

05:07.380 --> 05:10.020
dot broadcast ability type.

05:13.460 --> 05:19.850
Now, in addition, I'd like to have a boolean that we can set to true here so we know we're waiting

05:19.850 --> 05:23.720
for the user to select and equip selection.

05:23.750 --> 05:30.650
So I'll make a private boolean called Be Waiting for equip Selection.

05:31.640 --> 05:37.490
It'll be false by default, but as soon as quit button is pressed, we'll set it to true.

05:38.210 --> 05:41.210
So be waiting for equip selection is true.

05:41.240 --> 05:47.190
Now all we need to do is listen for that delegate and call equip button pressed.

05:47.210 --> 05:53.140
So let's compile and go back to the editor and it looks like I'm missing.

05:53.180 --> 05:54.050
Oh, right.

05:54.050 --> 05:56.420
I should have a comma right there.

05:57.080 --> 05:59.060
Okay, let's try that again.

06:01.150 --> 06:04.120
Okay, so we have a couple things we can't forget.

06:04.770 --> 06:11.080
Before I forget, I'm going to go to ability info and set the ability type to these two abilities.

06:11.100 --> 06:16.020
They need to be in abilities type offensive.

06:16.050 --> 06:18.280
They're both offensive abilities.

06:18.330 --> 06:24.060
So abilities type offensive and we can save and close out of that.

06:24.390 --> 06:29.250
Now next, our spell menu needs to listen to a delegate.

06:29.640 --> 06:34.830
So right here, where we're binding to a delegate already on the spell menu.

06:34.830 --> 06:36.030
Widget controller.

06:36.120 --> 06:38.610
I'd like to bind another one.

06:38.820 --> 06:43.500
Now, this stuff here, this could be easily collapsed to a function.

06:43.500 --> 06:45.750
We're setting description texts, right?

06:45.750 --> 06:51.450
So I'm going to right click collapse two function and just call this set descriptions.

06:53.660 --> 06:53.990
Mike.

06:53.990 --> 06:55.280
So that looks good.

06:56.290 --> 07:02.860
And after that, we're going to get BP spell menu, widget controller, and we're going to look for

07:02.890 --> 07:03.160
that.

07:03.190 --> 07:05.050
Wait for equip delegate.

07:09.220 --> 07:14.470
And this one, I think, can go down on a new line right there.

07:14.470 --> 07:16.810
So I'm going to add a new pin.

07:18.240 --> 07:21.330
And just make sure these don't get out of hand.

07:22.870 --> 07:25.660
So this will now go into the then three.

07:26.580 --> 07:32.100
And then right here, we can decide what happens for our weight, for equip, delegate.

07:32.340 --> 07:36.990
Now our equip spell row has our offensive selection boxes.

07:38.210 --> 07:45.290
With animations, offensive selection, animation, passive selection, animation and so on.

07:45.290 --> 07:52.130
And as soon as we have broadcast this delegate, we've broadcast the ability type for our currently

07:52.130 --> 07:58.400
selected ability and we can check to see if that ability type is offensive or passive.

07:58.550 --> 08:06.830
So what I'd like to do is handle what we do in response to this in a function called on wait for equip.

08:07.500 --> 08:09.570
So let's make that function.

08:09.690 --> 08:16.980
We'll call it on wait for equip and it'll take a gameplay tag as an input.

08:18.650 --> 08:22.610
So we'll change this input type to gameplay tag.

08:25.180 --> 08:27.460
And it's going to be ability type.

08:30.900 --> 08:37.380
We'll compile and save that, and then we'll just call this nice little function on wait for equip and

08:37.380 --> 08:39.660
pass in the ability type.

08:40.740 --> 08:43.770
So what do we do in on wait for equip?

08:43.980 --> 08:50.100
Well, first I want to check to see if the tag is the offensive ability type.

08:50.100 --> 08:53.520
So we're going to say matches tag exact.

08:54.670 --> 09:01.630
Or match his tag with exact match, and I'm going to see if it's equal to abilities type offensive.

09:02.410 --> 09:08.410
Now, whether or not it is is just going to be a Boolean variable I'm going to promote this to it'll

09:08.440 --> 09:12.400
be a local variable called is offensive.

09:14.870 --> 09:20.240
So if the gameplay tag is offensive, so will our boolean be?

09:20.600 --> 09:23.120
Now we can branch off based on this.

09:23.120 --> 09:29.810
But before we do, no matter which one it is offensive or passive, I want to disable the equip button

09:29.810 --> 09:33.200
and the spell point button until we're done waiting.

09:33.200 --> 09:34.700
So we're going to take button equip.

09:34.700 --> 09:36.770
Actually, we don't need to take those buttons.

09:36.770 --> 09:41.690
We have a function that can set buttons enabled.

09:41.690 --> 09:44.930
We're going to call that and set them both to false.

09:44.930 --> 09:50.120
And after that, now we can branch based on is offensive.

09:53.640 --> 09:55.320
So is offensive.

09:55.350 --> 09:58.380
Will be true if it's the offensive ability type.

09:58.380 --> 10:05.670
And if that's the case, we want to take our equipped spell row and get its offensive animation.

10:05.880 --> 10:10.020
So get offensive selection animation and play it.

10:10.020 --> 10:13.020
So we're going to take that and use play animation.

10:20.370 --> 10:24.990
And for loops to play, we're going to use zero because we want this to loop.

10:27.720 --> 10:33.870
Now, on the other hand, if it's not offensive, then we're going to play the passive version.

10:33.870 --> 10:35.880
So we're going to get equipped spells row.

10:38.940 --> 10:41.400
And get passive.

10:41.940 --> 10:44.700
Selection animation, and we're going to play that.

10:48.140 --> 10:49.220
Instead.

10:53.430 --> 10:54.840
Okay, so that's it.

10:55.600 --> 10:58.450
So that handles the delegate.

10:58.480 --> 11:00.610
We're going to go ahead and comment this.

11:00.640 --> 11:04.330
We'll say wait for equipped delegate.

11:06.540 --> 11:11.310
And with that, we just need to call the function.

11:12.480 --> 11:15.280
That we created for when we press the equip button.

11:15.300 --> 11:17.010
Equip button pressed, it's called.

11:17.130 --> 11:22.650
And we can do that right after our spend point button pressed delegate.

11:22.650 --> 11:25.320
So we're going to get our button equip.

11:27.350 --> 11:29.360
We're going to get its button widget.

11:29.360 --> 11:30.560
So get button.

11:32.920 --> 11:34.480
We're going to bind to Onclicked.

11:34.480 --> 11:36.880
So assign Onclicked.

11:38.580 --> 11:39.510
We'll hook that up.

11:40.910 --> 11:46.760
And we'll get our spell menu, widget controller and call equip button pressed.

11:48.780 --> 11:50.010
Just like that.

11:51.240 --> 11:53.340
And this gets a comment as well.

11:53.640 --> 11:56.790
It says equip button pressed.

12:02.450 --> 12:09.950
Okay, so now when we press the equip button, we should be able to see those animations.

12:10.040 --> 12:13.670
Now by default, we see them anyway.

12:13.940 --> 12:17.810
But if I press the button, nothing happens.

12:18.500 --> 12:26.450
And that is because if we look at our play animation nodes, they don't have a user widget object reference.

12:26.450 --> 12:28.510
So we do need to pass one in.

12:28.520 --> 12:30.830
That's going to be the equip spells row.

12:30.890 --> 12:37.000
So let's make sure to pass that in to Target before trying to play the animation.

12:37.010 --> 12:40.880
So if we click, then we see that we play the animation.

12:40.880 --> 12:45.740
Now we should set the render opacity to both of these to zero by default.

12:45.740 --> 12:47.870
So we'll go ahead and do that.

12:47.870 --> 12:50.180
So we don't see those big ugly boxes.

12:50.180 --> 12:54.050
We only want to see them when they're animated like so.

12:56.580 --> 13:00.270
So now we have something showing us we need to click right here.

13:00.360 --> 13:04.180
Now notice that we can't click right here anymore.

13:04.200 --> 13:11.220
What's giving me the hint that I can't click on these buttons is they're not highlighting and I'm moving,

13:11.220 --> 13:11.520
right?

13:11.520 --> 13:18.390
So what I need to do is take both of these and set their visibility to.

13:19.280 --> 13:20.690
Not hit testable.

13:20.720 --> 13:21.680
Both of them.

13:23.100 --> 13:25.680
That way we can still click on those buttons.

13:29.100 --> 13:30.060
Perfect.

13:32.140 --> 13:37.960
Now, we can't really test the passive abilities right now because, well, we don't have the ability

13:37.960 --> 13:38.830
to equip them.

13:38.830 --> 13:42.820
We don't really have any valid ability tags for them.

13:42.820 --> 13:47.440
But we do have these and if we go ahead and level up.

13:49.120 --> 13:52.940
And we take this eligible ability and spend a point on it.

13:52.960 --> 13:55.800
Well, now we can click on equip for this one.

13:55.810 --> 13:58.420
So we have the ability to equip.

13:58.420 --> 14:02.440
Now, the last thing I'd like to handle is canceling this animation.

14:02.440 --> 14:05.770
If we say select a different ability.

14:05.800 --> 14:09.220
So basically when we first select an ability.

14:10.050 --> 14:12.750
Or if we deselect an ability.

14:13.050 --> 14:20.850
So on selecting and deselecting an ability, we should cancel all animations if they're playing on this

14:20.850 --> 14:21.750
row here.

14:24.040 --> 14:33.310
So for that I need another delegate that also takes in the ability type, just like wait for equip delegate.

14:33.340 --> 14:36.570
We're going to make one to stop waiting for equip.

14:36.580 --> 14:42.040
So it'll also pass through a gameplay tag for the ability type.

14:42.130 --> 14:44.620
So let's go ahead and make one of those.

14:45.430 --> 14:52.810
And we can just use the same signature, wait for equip selection signature, and we're going to call

14:52.810 --> 14:55.900
this one stop waiting for equip delegate.

14:55.900 --> 15:00.550
So we're going to call it stop waiting for equip delegate.

15:02.490 --> 15:06.190
And we need to broadcast this in a couple situations.

15:06.210 --> 15:14.970
One is in Globe Deselect, we need to broadcast this and we need to know what the ability type is before

15:14.970 --> 15:16.110
we broadcast it.

15:16.110 --> 15:23.850
So we need an gameplay tag called ability type for the ability type.

15:23.850 --> 15:33.690
And it's going to be our selected ability type and we can get our ability info, data asset and call

15:33.690 --> 15:38.310
find ability info for tag using selected ability dot ability.

15:39.720 --> 15:42.090
And from that we can get the ability type.

15:42.300 --> 15:47.700
So now that we have the selected ability type, we can broadcast stop waiting for equip, delegate,

15:48.750 --> 15:51.180
passing in selected ability type.

15:53.550 --> 15:59.460
So we very much need to know that ability type when we want to stop playing an animation, right?

15:59.490 --> 16:06.100
Now we also want to do this same thing when we're selecting one of our spell globes.

16:06.120 --> 16:11.100
So right here in Spell Globe selected, I want to do this very same thing.

16:11.100 --> 16:18.060
So I'm going to paste these two lines, except I really only need to use the ability tag so I can find

16:18.060 --> 16:20.910
ability info for ability tag.

16:20.910 --> 16:26.790
We can get its ability type here and we can broadcast stop waiting for equip, delegate passing in that

16:26.790 --> 16:27.960
ability type.

16:28.140 --> 16:34.890
So if we're selecting a different ability, we need to actually hit equip before we go and play those

16:34.890 --> 16:35.790
animations.

16:35.790 --> 16:37.890
In the meantime, we stop playing them.

16:37.890 --> 16:41.820
So let's handle this delegate in the spell menu.

16:43.200 --> 16:45.150
So back to the spell menu.

16:46.390 --> 16:48.960
We're going to bind now to this one.

16:48.970 --> 16:51.910
We can do it right after wait for equip delegate.

16:51.910 --> 16:54.280
So we'll get the spell menu.

16:54.280 --> 16:55.450
Widget controller.

16:56.830 --> 16:59.620
And a sign Stop waiting for equip delegate.

17:00.650 --> 17:03.290
Now this will be similar to on wait for equip.

17:03.290 --> 17:10.850
In fact, I want to play those animations in our equip spells row to hide the offensive box and the

17:10.850 --> 17:14.630
passive box based on the ability type passed in.

17:14.660 --> 17:19.370
So I'm going to make a function for stop waiting for equip delegate.

17:19.400 --> 17:28.160
So instead of on wait for equip, we're going to have a new function called Stop waiting for equip.

17:29.720 --> 17:31.640
This will take a gameplay tag.

17:37.900 --> 17:40.780
It's going to be the ability type.

17:44.750 --> 17:50.510
And we're going to check if it matches tag exact offensive.

17:50.510 --> 17:57.320
So abilities type offensive and this will also have a local variable called is offensive.

18:03.950 --> 18:10.540
Now for this one, if we have any animations playing, we want to stop them on the equipped spell row.

18:10.550 --> 18:16.550
So we're going to get the equipped spell row and we can call stop all animations.

18:17.940 --> 18:21.570
And after that we can use a branch.

18:22.200 --> 18:24.180
Checking is offensive.

18:32.900 --> 18:42.620
And if it's true, we can get our equip spells row and get hide offensive box and play that animation.

18:42.620 --> 18:47.510
But if it's false, we'll get hide passive box.

18:48.400 --> 18:55.660
So we'll take that widget animation and call play animation on it and we have to pass the widget itself

18:55.660 --> 18:56.440
in.

18:56.740 --> 19:03.640
We only want to play one loop this time, so if it's an offensive ability type, we're going to hide

19:03.640 --> 19:05.080
the offensive box.

19:05.080 --> 19:09.250
And if it's a passive, we're going to hide the passive box.

19:15.800 --> 19:19.940
So we'll just play this animation once and then stop.

19:20.790 --> 19:22.260
And that's going to fade it out.

19:22.260 --> 19:27.810
So we're going to call stop waiting for equip and response to that delegate.

19:29.750 --> 19:31.880
And we'll pass in the ability type.

19:32.390 --> 19:34.370
Let's just see if this works.

19:37.480 --> 19:38.170
Okay, right away.

19:38.170 --> 19:41.020
I'm seeing that we do play it when we select it.

19:41.050 --> 19:43.960
We should only play it if something is currently equipped.

19:43.960 --> 19:44.350
Right.

19:44.350 --> 19:51.220
But if we press the equip button and we have that animation going and we select something else, it

19:51.220 --> 19:52.120
stops it.

19:52.120 --> 19:57.700
And if we have it going and we deselect the self, it also stops it.

19:58.060 --> 20:03.730
So we just need to make sure we don't play the animation if it's not already playing.

20:04.030 --> 20:05.950
Luckily we know when that is.

20:05.950 --> 20:08.830
It's when we're waiting for an equip selection.

20:08.830 --> 20:10.780
We even have a boolean for it.

20:10.930 --> 20:16.690
So what we'll do is every time we're about to broadcast, stop waiting for equip delegate.

20:16.720 --> 20:21.010
We'll only do so if we're currently waiting for an equip selection.

20:21.010 --> 20:25.270
That's the only time that we're playing those animations.

20:25.270 --> 20:32.680
So we're going to wrap them in if be waiting for equip selection and that's going to be where we broadcast

20:32.680 --> 20:39.080
it here and spell Globe selected and where we broadcast it in Globe Deselect.

20:39.080 --> 20:44.720
So right here, we'll only do this if we're waiting for equip selection.

20:45.080 --> 20:51.350
So if be waiting for equip selection, then we'll broadcast these.

20:54.250 --> 21:01.450
Now, in addition to this, we should also set this Boolean back to false so we can say be waiting for

21:01.450 --> 21:05.530
equip selection equals false and both of these cases.

21:06.560 --> 21:13.010
So we're going to stop waiting for equip, delegate, and we're also going to set that Boolean to false.

21:14.710 --> 21:16.810
And we can test this out.

21:17.170 --> 21:22.870
We'll go ahead and select the Firebolt and click on Equip.

21:22.900 --> 21:26.100
We see the animation, we can deselect it.

21:26.110 --> 21:33.670
It goes away if we select it again, it does not play until we click equip again and then deselecting

21:33.670 --> 21:33.760
it.

21:33.760 --> 21:34.840
It goes away.

21:38.070 --> 21:44.880
If we have the equip animation going and we select something else, it goes away and doesn't come back.

21:44.970 --> 21:47.400
And finally, let's go ahead and just.

21:48.320 --> 21:49.520
Get this one.

21:51.950 --> 21:53.030
There we go.

21:53.910 --> 21:57.120
So I'm going to have it playing and select this one over here.

21:58.990 --> 21:59.440
Okay.

21:59.440 --> 22:00.880
We'll spend a point on it.

22:00.910 --> 22:02.110
We'll click equip.

22:02.840 --> 22:04.250
We can cancel it.

22:07.200 --> 22:09.870
Okay, We're getting the behavior we want.

22:10.900 --> 22:11.500
Excellent.

22:11.530 --> 22:13.010
We're one step closer.

22:13.030 --> 22:21.580
So now that we can click on Equip and it's waiting for us to click down here, the next step is to handle

22:21.580 --> 22:23.470
what happens when we click down here.

22:23.470 --> 22:32.320
And that's going to involve reassigning the input tag for an ability, if it has one, or assigning

22:32.320 --> 22:40.000
an input tag to an ability for the first time and actually making that ability have the status of equipped

22:40.000 --> 22:41.350
if it's not already.

22:41.380 --> 22:45.220
So that's the next thing we need to do and we'll do that next.

22:45.370 --> 22:46.420
I'll see you soon.
