WEBVTT

00:07.400 --> 00:08.570
Welcome back.

00:08.950 --> 00:12.160
Now I'm going to show you an interesting.

00:12.160 --> 00:18.640
We could call it a bug, but we'll say an interesting feature that I'd like to change in this video.

00:18.760 --> 00:24.760
And that's if we're activating our electrocute ability and we're holding that input.

00:24.760 --> 00:27.320
So we're staying in that shock loop.

00:27.340 --> 00:28.780
We haven't released it yet.

00:28.810 --> 00:33.210
We're still in the shock loop and holding that right mouse button down.

00:33.220 --> 00:39.280
If I left click at the same time, you'll see that we're actually doing things right.

00:39.310 --> 00:41.740
Our player controller knows that we're left clicking.

00:41.740 --> 00:49.210
And in fact, if I say hold shift and left click will actually cast a spell which we're not supposed

00:49.210 --> 00:49.720
to cast.

00:49.720 --> 00:54.610
And if we click on, say, an enemy, well, that will happen too.

00:54.610 --> 00:56.800
That's not supposed to happen either.

00:56.800 --> 01:01.330
So we need a way to disable certain things from happening.

01:01.330 --> 01:06.700
These are all happenings that are triggered inside of the player controller.

01:06.700 --> 01:14.560
So what I'd like is an easy way to disable things in the player controller, such as input pressed and

01:14.560 --> 01:21.240
released, callbacks being called, and maybe even the highlighting that's happening there.

01:21.250 --> 01:25.780
I'd like a way to disable things easily, right?

01:25.780 --> 01:31.310
If we're activating our electrocute ability, I'd like to disable stuff.

01:31.330 --> 01:39.160
Now, the gameplay ability system makes this easy because if we go into our electrocute ability, notice

01:39.160 --> 01:47.560
that we have these tags and we have the activation owned tags, which are tags that are applied to the

01:47.560 --> 01:52.780
owner, which is the owning ability system component, while this ability is active.

01:52.930 --> 02:00.040
So if this ability is active we can give a tag or 2 or 3 or however many we want to the ability system

02:00.040 --> 02:00.910
component.

02:00.940 --> 02:06.730
Now this is pretty useful because our player controller can check our ability system component to see

02:06.730 --> 02:08.230
if it has any tags.

02:08.320 --> 02:14.800
So I'd like to create some tags specifically for disabling certain things like input pressed, input

02:14.800 --> 02:16.480
released, input held.

02:16.480 --> 02:22.510
And then we can add any number of those tags to our ability system component while we're in this electrocute

02:22.510 --> 02:24.100
ability while it's active.

02:24.250 --> 02:29.500
So I'm going to go ahead and close out of the editor, and we're going to add a couple of native gameplay

02:29.500 --> 02:31.300
tags to our project.

02:31.330 --> 02:33.610
So I'll go to.

02:34.340 --> 02:40.760
Or a gameplay tag stage and we'll just add a few new gameplay tags.

02:42.260 --> 02:49.250
So I'm going to have a new gameplay tag, and these will be under the super tag player.

02:49.250 --> 02:55.250
So they can be related to, say, the player, player controller, or player state things that the player

02:55.250 --> 02:55.860
does.

02:55.880 --> 03:02.810
So for example, we can have player dot block dot input.

03:03.400 --> 03:04.390
Pressed.

03:05.670 --> 03:08.730
We can have player block input held.

03:10.020 --> 03:13.020
We can even have a player block input released.

03:14.780 --> 03:20.150
And I'd also like a player block highlight.

03:20.720 --> 03:25.070
Or rather, we could even block cursor trace altogether.

03:27.460 --> 03:30.790
And that's that cursor trace that we're doing in the player controller.

03:30.790 --> 03:36.940
So we can have any number of these that we can grant to the ability system component.

03:36.940 --> 03:41.950
And we can always check these tags on the ability system component before doing any of these things

03:41.950 --> 03:43.260
in the player controller.

03:43.270 --> 03:44.800
So I'm going to make these tags.

03:44.800 --> 03:47.050
Let's go into the cpp file.

03:47.050 --> 03:52.420
We'll go all the way down to the bottom and we'll add a multi-line comment first.

03:54.040 --> 03:57.130
We'll say player block tags.

03:59.350 --> 04:04.480
And in fact, we can just make these player tags because they don't have to all be block tags necessarily.

04:04.510 --> 04:07.210
So let's make these new tags.

04:07.210 --> 04:10.950
We're going to start with player block.

04:10.960 --> 04:12.580
And we'll just go from top to bottom.

04:12.580 --> 04:14.380
So we'll start with Cursor trace.

04:14.380 --> 04:21.490
And the name will be player dot block dot cursor trace.

04:22.930 --> 04:29.350
And for the string we'll say block tracing under the cursor.

04:29.770 --> 04:31.840
We can copy this and paste it.

04:31.840 --> 04:33.460
And we'll have the next one.

04:33.460 --> 04:35.920
And this will be player block input held.

04:35.920 --> 04:39.730
And we'll change it to player dot block dot input held.

04:39.730 --> 04:47.170
And we'll say block input held callback for input.

04:47.200 --> 04:50.110
We'll go ahead and make the next one.

04:52.640 --> 05:00.960
Player block input pressed and we'll change this to input pressed and we'll say block input pressed.

05:00.980 --> 05:02.660
Callback for input.

05:04.910 --> 05:06.140
We'll do the next one.

05:11.190 --> 05:13.080
And that's going to be released.

05:13.080 --> 05:14.420
So player dot block.

05:14.430 --> 05:15.930
Dot input released.

05:17.040 --> 05:18.570
Block input released.

05:18.570 --> 05:21.360
Callback for input.

05:21.360 --> 05:27.090
So now that we have these native tags, what we can do is give these to the ability system component.

05:27.090 --> 05:29.610
When activating an ability if we want to.

05:29.610 --> 05:35.310
And as long as we're checking these and preventing things from happening, we can block these phenomena.

05:35.310 --> 05:36.930
For example the cursor trace.

05:36.930 --> 05:40.080
Let's go to our player controller where we're doing that.

05:40.290 --> 05:47.190
So in player or a player controller notice that we have a cursor trace function.

05:49.470 --> 05:50.450
Right here.

05:50.460 --> 05:51.840
Let's go to that.

05:52.590 --> 05:59.490
And here in Cursor Trace we're doing all this stuff, but we can block it all if the ability system

05:59.490 --> 06:02.190
component has that blocked tag.

06:02.190 --> 06:05.430
So we can say if and we have a git ask here.

06:06.480 --> 06:11.940
So only if that's valid at the time then we can check the ask.

06:12.210 --> 06:16.680
So I'm going to have an and in the check and say and git ask.

06:17.790 --> 06:19.740
And if we search for has.

06:20.800 --> 06:24.940
Then we have things like has any matching gameplay tags.

06:24.970 --> 06:31.270
Has all matching gameplay tags, has matching gameplay tag, and if we go to the function.

06:32.260 --> 06:39.370
We can see here that has matching gameplay tag comes from the AI gameplay tag asset interface, and

06:39.370 --> 06:43.750
this checks the gameplay tag container that the ability system component has.

06:43.750 --> 06:46.200
And this can check for a single tag.

06:46.210 --> 06:53.710
So really all we need to do is pass a tag in here we can use F or a gameplay tags get.

06:54.450 --> 06:55.980
And we can check for that player.

06:55.980 --> 06:57.960
Block cursor trace tag.

06:57.990 --> 07:04.080
Now, if the ability system component has player block cursor trace, then it can simply return from

07:04.080 --> 07:07.380
this function and never even trace anything.

07:07.500 --> 07:16.350
But if we're already highlighting something, well, we could just clear out unhighlight anything that's

07:16.350 --> 07:17.220
highlighted.

07:18.900 --> 07:22.260
So I'm going to take these two lines here.

07:22.260 --> 07:25.410
And we can call Unhighlight actor on both of them.

07:25.410 --> 07:29.700
And after calling Unhighlight actor we can set them both to null pointer.

07:30.690 --> 07:33.590
So last actor is equal.

07:33.600 --> 07:35.340
We'll set it equal to null pointer.

07:35.340 --> 07:38.490
And this actor will set that equal to null pointer.

07:39.390 --> 07:40.860
And we'll return.

07:40.860 --> 07:47.250
And of course these two checks will fail on the next time they're checked because we just null them

07:47.250 --> 07:47.970
out.

07:48.000 --> 07:54.270
So cursor trace is going to be checking for this blocked tag.

07:54.270 --> 07:57.150
And we won't bother tracing and highlighting things.

07:57.150 --> 08:03.570
And we'll actually unhighlight everything if we have that block cursor trace tag.

08:03.570 --> 08:05.910
So that's how we can block cursor trace.

08:05.940 --> 08:07.800
Now that's not the only tag we made.

08:07.800 --> 08:11.700
We also have block input held released and pressed.

08:11.700 --> 08:17.010
So if we go to those functions we have ability input tag pressed.

08:17.010 --> 08:19.260
So we can check for tags here.

08:19.260 --> 08:23.100
So what I'm going to do is just copy this if statement.

08:23.760 --> 08:31.740
And right here in ability input tag pressed we can make a check only we're not going to check for player

08:31.740 --> 08:32.910
block cursor trace.

08:32.910 --> 08:37.170
Instead we're going to check for player block input pressed.

08:38.370 --> 08:41.280
And if we're blocking pressed input we can return.

08:43.360 --> 08:49.060
So we're not going to send ability input processed data to the ability system component.

08:49.090 --> 08:50.590
We're going to return instead.

08:50.590 --> 08:53.680
It'll be like we never actually clicked the mouse button.

08:54.010 --> 08:59.890
Now we can block released events as well by simply doing the same thing, but changing the block tag

08:59.920 --> 09:01.630
to input released.

09:02.020 --> 09:05.200
And we can do this for input held as well.

09:05.980 --> 09:08.870
We can have ability input tag held.

09:08.890 --> 09:12.460
Place the check for the block for input held.

09:13.180 --> 09:14.790
And return in that case.

09:14.800 --> 09:19.120
And of course, we also have another callback bound to input.

09:19.120 --> 09:24.790
If we take a look at our move function, we also even have the shift pressed.

09:24.820 --> 09:26.550
If we wanted to block that.

09:26.560 --> 09:30.130
So the move function is going to move us right.

09:30.160 --> 09:33.310
That's going to be for wasD movement.

09:33.850 --> 09:38.730
We can also check block input pressed and return in this case.

09:38.740 --> 09:41.710
And if you want you can do it for shift pressed and release.

09:41.710 --> 09:45.820
But I don't think that's going to matter now because we're blocking everything else.

09:45.850 --> 09:49.660
Now let's hit debug and launch the editor.

09:50.780 --> 09:54.380
So back here in the editor in electrocute.

09:54.410 --> 09:58.050
Now we can add some tags for activation own tags.

09:58.070 --> 10:05.180
Now the cool thing about this is any tags we add to this will be granted to the ask upon ability activation

10:05.180 --> 10:10.880
and removed from the ask upon the ending of the ability or cancellation.

10:10.880 --> 10:16.180
So we can add any number of these player blocked tags.

10:16.190 --> 10:21.710
Now when in the electrocute ability I want to block the cursor trace.

10:21.710 --> 10:28.220
I also want to block the input pressed and held events, but not released because we're waiting for

10:28.220 --> 10:29.180
input release.

10:29.210 --> 10:34.310
We'll never get that if we're blocking that, because we're blocking this at the player controller level.

10:34.400 --> 10:39.740
So we can just have these three block tags cursor trace input held and input pressed.

10:40.630 --> 10:43.180
And what we can do is press play.

10:43.270 --> 10:46.360
We can hold this down.

10:46.360 --> 10:48.010
And if we left click.

10:52.930 --> 10:57.310
All we're getting, actually is our Niagara system.

10:57.310 --> 10:58.570
We're actually not blocking that.

10:58.570 --> 11:00.040
We're going to have to take care of that.

11:00.040 --> 11:06.340
But if we hold shift and click, we don't get our left mouse button ability and we can't actually highlight

11:06.340 --> 11:07.270
any of our actors.

11:07.270 --> 11:09.750
Now I'm going to highlight this actor.

11:09.760 --> 11:15.640
I'm going to right click just to make sure that we see that highlighting has stopped.

11:16.250 --> 11:23.330
So right click I can left click and I don't get anything other than our Niagara system.

11:23.330 --> 11:24.410
So we'll need to fix that.

11:24.410 --> 11:29.270
But if we're already highlighting and we right click it's going to stop highlighting that enemy.

11:29.270 --> 11:31.760
So that's something to be aware of.

11:32.430 --> 11:37.380
Now, if you don't want to block that, you can just remove that block tag from activation own tags.

11:37.380 --> 11:39.000
So we can take cursor trace.

11:39.000 --> 11:42.960
We can cut that out and then we'll still trace.

11:44.000 --> 11:48.590
The thing I don't like about that is if we're hiding the mouse cursor and I move the mouse up to that

11:48.590 --> 11:50.180
enemy, it'll highlight.

11:50.180 --> 11:59.180
So that's why I want to actually include that block tag cursor trace in activation own tags.

12:00.200 --> 12:02.620
Okay, so this is looking and working great.

12:02.630 --> 12:07.100
I do want to suppress that Niagara click effect.

12:07.100 --> 12:16.370
So what I'm going to do is check if player block input pressed is a tag we have before playing that

12:16.370 --> 12:17.210
Niagara system.

12:17.210 --> 12:18.980
So I'm going to search for Niagara.

12:18.980 --> 12:22.490
And we're going to place a check here.

12:22.490 --> 12:32.960
And I'll just say if get AC and not AC has matching gameplay tag, if we don't have this tag then we

12:32.960 --> 12:35.990
can spawn system at location.

12:35.990 --> 12:38.420
So I'll put that in here instead of returning.

12:38.600 --> 12:45.770
And that way we just prevent that Niagara system if we're blocking input pressed and that's fine.

12:45.770 --> 12:52.670
Now you could be more specific and go add a gameplay tag to specifically block spawning this system

12:52.670 --> 12:54.320
if you wanted to do that as well.

12:54.590 --> 12:56.930
But I'm okay with just using this tag.

12:56.930 --> 12:58.730
So last thing to check.

12:58.730 --> 13:03.470
Let's make sure that we're not spawning that system while electrocute is active.

13:05.880 --> 13:08.640
All right, I'm going to get this back open.

13:08.640 --> 13:11.700
I'm going to use my electrocute ability.

13:11.700 --> 13:14.520
I'm going to left click and I don't see anything.

13:14.520 --> 13:17.850
So it's like we're never actually left clicking at all.

13:18.700 --> 13:22.150
And in fact, we can WASC and we don't get any movement there.

13:22.180 --> 13:28.720
We're suppressing that as long as we're in our ability, so we can be left clicking and holding it down.

13:28.720 --> 13:31.150
And right click will interrupt that with the shock.

13:31.150 --> 13:34.960
And if I release the right mouse button now we're running again.

13:34.960 --> 13:37.930
So it's actually a very nice smooth system.

13:38.050 --> 13:42.760
And that is going to handle that little bug.

13:42.850 --> 13:48.460
And actually we can add these to any ability as long as our ability system component has any of these

13:48.460 --> 13:53.650
tags it will block the corresponding action that's related to that gameplay tag.

13:53.830 --> 13:55.120
Pretty powerful.

13:55.300 --> 13:56.200
All right.

13:56.200 --> 13:57.160
Excellent job.

13:57.160 --> 13:58.300
I'll see you soon.
