WEBVTT

00:07.290 --> 00:08.250
Welcome back.

00:08.820 --> 00:11.760
Now we've done a few improvements.

00:11.760 --> 00:16.170
I'm going to close all these tabs and I took all my enemies out.

00:16.170 --> 00:18.660
So I'm going to bring a couple back in.

00:18.750 --> 00:25.500
I am going to leave my nav mesh bounds volume off to the side though, so they can't come at me.

00:25.500 --> 00:32.850
And I'm going to go into blueprints character Goblin Spear, and I'll bring in a couple Goblin spears.

00:32.940 --> 00:37.380
I'm going to put one here and I'll put another one right there.

00:38.220 --> 00:39.360
And press play.

00:39.750 --> 00:44.940
Now here's what I wanted to observe by dragging these two in.

00:45.060 --> 00:50.040
Now, if I right click on this one, I'm shocking it with the beam.

00:50.040 --> 00:50.690
Right?

00:50.700 --> 00:56.910
But if I right click on the goblin behind it, we're going straight through the first one.

00:56.910 --> 00:58.320
And that's a problem.

00:58.320 --> 01:00.450
So we need to fix that.

01:00.480 --> 01:05.640
Now in addition to that we're going to have multiple targets.

01:05.670 --> 01:13.950
You probably don't know this yet, but as we level up our electric beam or our electrocute spell as

01:13.950 --> 01:21.030
we spend points on it, I'd like this electric beam to propagate to nearby enemies.

01:21.030 --> 01:28.050
So if I'm shocking this one here, once we level it up, I'd like it to propagate and create a connecting

01:28.050 --> 01:31.260
beam between these two enemies if they're close enough.

01:31.410 --> 01:38.640
And then if we level it up again, well, then if there's two enemies nearby, if I can.

01:39.570 --> 01:41.420
Duplicate this one.

01:41.430 --> 01:45.250
If, let's say my electrocute spell is level three.

01:45.270 --> 01:50.910
Then if I shock this guy, I want two beams to propagate to nearby enemies.

01:50.910 --> 01:55.920
So that's the kind of thing I have in mind for this type of spell.

01:56.010 --> 02:03.780
So whenever I start electrocuting something like this guy over here, I'm going to need to get.

02:04.910 --> 02:10.370
The first thing that my beam would hit, which would be this guy here, because this one's in the way,

02:10.370 --> 02:11.060
right?

02:11.150 --> 02:15.500
So if I shock over here, I need to hit this one before I hit that one.

02:15.500 --> 02:22.880
And I'm going to call the first enemy that I hit the first target, I'm going to call it my first target

02:22.880 --> 02:23.450
okay.

02:23.450 --> 02:27.170
So we need a way to get that first target.

02:27.260 --> 02:30.140
So let's go into our gameplay ability.

02:30.140 --> 02:34.670
Ability system or a abilities lightning electrocute.

02:35.440 --> 02:42.190
And here in electrocute, if we go out to the event graph, we'll see that we're creating the beam by

02:42.190 --> 02:45.370
adding a gameplay cue on an actor.

02:45.370 --> 02:52.330
We're actually adding it to the avatar actor specifically, but we're passing in the mouse hit location

02:52.330 --> 02:57.190
through with the gameplay parameters, and that's why our beam is positioned correctly.

02:58.570 --> 03:02.800
But now I'd like to handle this with more care.

03:02.830 --> 03:07.210
I'd like to take this whole bit here where we're getting the weapon.

03:07.210 --> 03:11.580
We're making the gameplay parameters and adding the gameplay cue on an actor.

03:11.590 --> 03:17.320
I'm going to collapse this to a function, and this is all going to be related to spawning the electric

03:17.320 --> 03:18.040
beam.

03:18.040 --> 03:24.100
So I'm going to right click collapse the function and call this spawn electric beam.

03:24.610 --> 03:29.590
And now this function will handle all that we need to do to spawn the electric beam.

03:30.430 --> 03:37.450
And the first thing we need to do to spawn the electric beam is to get our first trace target.

03:37.480 --> 03:45.910
In other words, if I'm again zapping behind this person, then I need to actually hit what's in the

03:45.910 --> 03:46.600
way.

03:46.940 --> 03:47.380
Right.

03:47.380 --> 03:54.460
It's kind of like in shooter games, if you're doing a line trace with a hitscan weapon and you're aiming

03:54.460 --> 03:59.860
over here, well, you should hit whatever's between the gun and the target, right?

03:59.890 --> 04:02.530
Because that's how it would be in real life.

04:03.180 --> 04:08.100
Okay, so for that reason, I need to get the first trace target.

04:08.100 --> 04:11.460
And this is going to be in a C plus plus function.

04:11.460 --> 04:14.880
So I'd like to do this in the most optimal way possible.

04:15.030 --> 04:16.950
So I'm going to close the editor.

04:17.190 --> 04:25.020
I'm going to open up my ability which is or a beam spell.

04:26.240 --> 04:30.740
And we're going to add a blueprint callable function to or a beam spell.

04:31.660 --> 04:33.930
And we'll make it public.

04:33.940 --> 04:37.300
And I'm going to call this trace first target.

04:37.420 --> 04:45.910
It's going to take a const f vector by reference called beam target location.

04:45.910 --> 04:50.650
Because we're already going to have a beam target location.

04:50.680 --> 04:57.160
Now we need to trace and see if there's something in between Ora's staff and the target location.

04:57.160 --> 04:59.230
So we're going to generate this definition.

05:00.450 --> 05:05.850
And what we're going to do is we're going to perform a trace.

05:05.850 --> 05:10.800
But this trace in particular, I'd like it to be a sphere trace.

05:10.800 --> 05:16.440
So we get a little bit of leeway just because we don't really want to be too precise here.

05:16.470 --> 05:22.230
You could do a line trace if you wanted to, but I'd like to capture anything in the way, even remotely

05:22.230 --> 05:24.450
in the way with a bit of a sphere trace.

05:24.480 --> 05:31.290
Now, to do a sphere trace, one of the functions the engine has is you Kismet system library.

05:31.330 --> 05:34.860
So as soon as I typed, that writer included the header for me.

05:35.520 --> 05:41.150
And the function on this library I'm interested in is sphere trace single.

05:41.160 --> 05:45.390
Now sphere trace single requires a world context object.

05:45.390 --> 05:49.890
And I can pass in owner character, and I can even check owner character.

05:49.890 --> 05:53.850
At this point it should be valid by the time we call this.

05:54.210 --> 06:05.070
Now for Sphere Trace single, it needs a start location and we need to know the socket location.

06:05.250 --> 06:09.300
So this is going to be tracing from the tip socket on the weapon right.

06:09.300 --> 06:13.740
So for that reason I'm going to get the owner character.

06:15.840 --> 06:21.120
And see if it implements the combat interface.

06:23.320 --> 06:31.450
We can wrap this in an if statement, and then we can take the I combat interface and execute.

06:34.000 --> 06:37.750
Get weapon and we can pass in owner character.

06:39.460 --> 06:42.970
And if we get that weapon, we can get its socket location.

06:42.970 --> 06:48.970
So I'm going to store this weapon, returned the skeletal mesh component.

06:48.970 --> 06:53.740
And to use skeletal mesh component pointer called weapon.

06:55.470 --> 06:59.130
And we'll wrap this in an if statement as well, just to make sure.

07:00.460 --> 07:01.810
That we have a weapon.

07:03.130 --> 07:07.900
And then I'll make a const f vector called socket location.

07:10.610 --> 07:19.040
And I'll get the weapon and call get socket location passing in an F name with type socket.

07:19.040 --> 07:22.790
And of course this could be a parameter, this f name.

07:22.790 --> 07:26.270
It could be a member variable on or a beam spell.

07:26.270 --> 07:29.480
And then you could subclass this and use it for enemies.

07:29.480 --> 07:32.990
For example I'm just going to use type socket for now.

07:32.990 --> 07:34.370
Just putting it out there.

07:34.370 --> 07:35.480
You could do that.

07:35.480 --> 07:40.580
And once we have the socket location that's going to be the trace start for the sphere trace.

07:40.580 --> 07:46.910
So right here we'll say sphere trace single socket location will be that start the end.

07:46.910 --> 07:47.510
We have that.

07:47.510 --> 07:49.490
It's the beam target location.

07:50.960 --> 07:52.610
Now for the sphere radius.

07:52.640 --> 07:57.140
It's not going to be that big about ten for the trace type query.

07:57.140 --> 08:03.350
I'm just going to use trace type query one trace complex is going to be false.

08:03.470 --> 08:06.470
I rarely trace against complex geometry.

08:06.470 --> 08:11.300
And the next input we need an array of actors to ignore.

08:11.300 --> 08:12.980
So we're going to create one of those.

08:13.280 --> 08:17.600
So we're going to make a t array of actors.

08:17.630 --> 08:21.230
Those are pointers we'll call this actors to ignore.

08:21.410 --> 08:23.330
And we can add the owner character.

08:23.930 --> 08:28.040
So actors to ignore dot add owner character.

08:29.270 --> 08:32.780
And we can pass actors to ignore into the function.

08:35.320 --> 08:47.230
Now we need a debug trace type and for now we can say E draw debug trace for duration and we need an

08:47.230 --> 08:48.700
f hit result next.

08:48.850 --> 08:50.530
So we'll make one of those.

08:51.850 --> 08:57.480
We'll call it hit result and we'll pass that in.

08:57.490 --> 09:00.580
I'm going to start putting these on their own lines here.

09:11.540 --> 09:13.400
So hit result is next.

09:16.150 --> 09:18.790
Be ignore self is going to be true.

09:20.110 --> 09:22.360
We do want to ignore the self.

09:22.890 --> 09:25.720
And I don't think I need any more parameters.

09:25.740 --> 09:31.170
We'll leave those trace colors at their defaults, and we're not even going to draw a debug once we're

09:31.170 --> 09:32.130
done with this.

09:32.130 --> 09:33.810
For now, though, we can draw one.

09:34.610 --> 09:39.470
So once we perform a sphere trace, we need to see if we got a blocking hit.

09:39.500 --> 09:48.560
So we'll say if hit result dot be blocking hit, then once we get that blocking hit we're going to reset

09:48.560 --> 09:50.150
the mouse hit location.

09:50.930 --> 09:55.280
I'm going to set it to our hit result dot impact point.

09:56.330 --> 10:02.690
And I'm going to set the mouse hit actor to hit result dot get actor.

10:04.270 --> 10:09.580
So now, if we had something in between the staff and our target point, we're resetting the mouse hit

10:09.580 --> 10:12.460
location and that target actor.

10:13.360 --> 10:15.760
All right, so we're ready to launch and try this out.

10:15.760 --> 10:18.850
But we do need this to be a blueprint callable function.

10:18.850 --> 10:20.530
So we'll make that happen.

10:20.530 --> 10:24.340
And let's go ahead and launch the editor.

10:26.210 --> 10:32.180
Okay, so we're back in the editor and right here in Spawn Electric Beam, we can now call our trace

10:32.180 --> 10:35.180
first target blueprint callable function.

10:35.180 --> 10:38.930
And we're going to need to pass in the beam target location.

10:38.930 --> 10:41.350
And luckily we have that.

10:41.360 --> 10:43.880
It's called mouse hit location.

10:43.880 --> 10:46.430
We can get that and we can pass it in.

10:46.700 --> 10:50.930
Now at this point we'll be performing a sphere trace with debug.

10:50.930 --> 10:57.260
And since we're resetting our mouse hit location in actor, that mouse hit location that's being passed

10:57.260 --> 11:01.640
into our gameplay parameters should now be updated.

11:01.640 --> 11:03.530
Let's test that theory.

11:04.350 --> 11:11.040
And sure enough, we are getting the trace, we're getting the hit, and our beam is stopping right

11:11.040 --> 11:13.510
there on the actor that's in the way.

11:13.530 --> 11:19.410
So now that that's working correctly, I can go in and remove the debug.

11:19.410 --> 11:21.150
We don't need to see the debug.

11:21.300 --> 11:25.560
Instead we can just use draw debug trace none.

11:25.710 --> 11:29.370
And now we won't see anything except our beam of course.

11:30.040 --> 11:36.340
So back in the editor, after making that little change, we should now see that.

11:36.980 --> 11:41.810
Sure enough, if we're zapping this dude back here, we hit this dude here.

11:42.360 --> 11:43.170
So.

11:44.440 --> 11:45.460
That works well.

11:45.460 --> 11:48.850
And because we're doing a sphere trace, we have some leeway.

11:51.030 --> 11:53.160
Only if we miss by a great deal.

11:53.900 --> 11:55.550
Are we going to miss?

11:55.550 --> 11:56.180
Right.

11:57.950 --> 11:59.860
Okay, so that's looking good.

11:59.870 --> 12:07.040
Spawn Electric Beam is now using a Sphere Trace performed in C plus plus for optimal performance.

12:07.040 --> 12:12.650
And once we have our first target, we're going to start doing things.

12:12.650 --> 12:18.950
And once we hit something, I need to know if we hit the floor or we hit an enemy, right?

12:18.950 --> 12:22.280
Did we hit a wall, a floor, something that's not an enemy?

12:22.280 --> 12:24.140
Or did we hit an enemy?

12:24.140 --> 12:30.140
If we did hit an enemy, then that's going to matter depending on what we want to do next.

12:30.290 --> 12:38.090
For one, if we add a gameplay cue, I want to add this gameplay cue on the actor we hit if it is an

12:38.090 --> 12:38.600
enemy.

12:38.600 --> 12:38.990
Why?

12:39.020 --> 12:45.050
Because we're going to be adding gameplay cues from one enemy to another enemy.

12:45.080 --> 12:50.960
We're not going to be adding all of these gameplay cues to the same actor aura, because that wouldn't

12:50.960 --> 12:51.470
work.

12:51.470 --> 12:59.810
We'll have to add a gameplay cue to separate enemies each time, and so the first time we trace, after

12:59.810 --> 13:06.410
we trace our first target, I'm going to make gameplay cue parameters specifically for that target.

13:06.410 --> 13:11.750
So I'm going to right click and say make gameplay cue parameters.

13:11.930 --> 13:14.900
We'll make that struct and we'll fill this in.

13:14.900 --> 13:19.730
And I'm going to fill it with a location that's going to be mouse hit location.

13:19.730 --> 13:20.570
We'll get that.

13:20.570 --> 13:22.370
We'll pass it into location.

13:24.120 --> 13:26.910
I'm also going to set the source object.

13:27.630 --> 13:34.560
As this is an object reference, it's a good way to pass an arbitrary object in, and I can pass my

13:34.560 --> 13:37.530
mouse hit actor through as the source object.

13:39.710 --> 13:46.580
And since I need a target attached component, that's going to be my owner character's weapon.

13:46.580 --> 13:53.240
So I'm going to call get weapon passing in the avatar or the owner character.

13:53.600 --> 13:55.220
Either one should work.

13:56.640 --> 14:00.990
And we can pass this straight in to the target attached component.

14:00.990 --> 14:01.800
So.

14:03.730 --> 14:06.040
We're going to call get weapon first.

14:08.440 --> 14:10.030
As we get the weapon.

14:10.900 --> 14:17.170
We take its value, we pass it in as target attached component to our gameplay parameters.

14:17.910 --> 14:20.880
So now we have these gameplay parameters, right?

14:20.880 --> 14:23.100
I'm going to promote this to a variable.

14:23.310 --> 14:30.090
So promote a variable and I'm going to call it first target queue params.

14:31.280 --> 14:35.900
The reason I need the first target params is because it's going to be different.

14:36.080 --> 14:43.130
The target attach component is going to be the weapon, but for subsequent targets, that's not going

14:43.130 --> 14:50.060
to be the case, because I'm going to want the second beam to go from my first target to the next enemy

14:50.060 --> 14:57.620
over, and the third beam to go from that first target to the next enemy over, and so on.

14:57.770 --> 15:04.970
Now, once I've stored my first target params, I'm going to take these lines and move them away for

15:04.970 --> 15:05.720
a second.

15:05.990 --> 15:09.050
I need to see if my mouse hit actor.

15:09.080 --> 15:12.330
The thing I hit implements the combat interface.

15:12.350 --> 15:17.410
That's what's going to tell me if it's the floor or an enemy, right?

15:17.420 --> 15:20.150
If it's an enemy or not an enemy rather.

15:20.150 --> 15:26.870
So I'm going to use does implement interface specifying the combat interface.

15:28.150 --> 15:30.340
And we're going to use the mouse hit actor.

15:33.060 --> 15:35.820
And we'll hook that in and we'll have a branch.

15:36.390 --> 15:39.360
And we'll check that.

15:39.390 --> 15:45.900
Now this we can just say is mouse hit actor an enemy?

15:47.640 --> 15:52.290
Okay, so the answer to that question determines what we do next.

15:53.070 --> 15:56.490
If the answer is yes, we have this true right.

15:56.490 --> 16:04.510
And the thing that we apply or add this gameplay cue to depends on the answer to this question.

16:04.530 --> 16:09.600
If we did hit an enemy, then I want to add the cue to the enemy.

16:09.600 --> 16:11.750
That's going to be our mouse hit actor.

16:11.760 --> 16:17.520
If we did not hit an enemy, I want to add the cue to the avatar actor.

16:17.550 --> 16:25.740
Or in other words, so what I'm going to do is the target for the gameplay cue is going to be I'll go

16:25.740 --> 16:30.180
ahead and make it a local variable and call this cue target.

16:31.400 --> 16:35.810
And I'm going to set the target based on the answer to this question.

16:35.840 --> 16:40.400
If we just hit an enemy, the target will be the mouse hit actor.

16:40.400 --> 16:45.140
So we're going to set target equal to mouse hit actor.

16:52.130 --> 16:53.570
So that goes to true.

16:54.620 --> 16:57.070
In the false case, we're going to set it to the avatar.

16:57.080 --> 17:01.370
So get avatar actor from actor info.

17:01.760 --> 17:04.280
That's who the target is going to be.

17:04.460 --> 17:08.510
Now either way we're going to apply a gameplay queue.

17:08.510 --> 17:13.730
So we're going to call Add gameplay queue on actor.

17:13.760 --> 17:15.560
I'm going to go ahead and just.

17:16.250 --> 17:17.990
Take these two nodes.

17:19.200 --> 17:24.090
I'm actually going to move everything way over here and just right here.

17:24.090 --> 17:26.100
Add gameplay cue on actor.

17:26.100 --> 17:29.880
No matter whether the thing we hit is an enemy or not.

17:29.880 --> 17:33.450
Both of these go into add gameplay cue on actor.

17:35.380 --> 17:38.140
The difference is the target.

17:38.290 --> 17:43.610
What we set the target to depends on if we hit the enemy or not.

17:43.630 --> 17:46.750
If it implements the combat interface rather.

17:46.930 --> 17:51.220
Now our parameters are going to be the first target params.

17:51.340 --> 17:59.110
We've set those and now our target might be an enemy and it might be Ora.

17:59.530 --> 18:03.280
So if we go back to our gameplay cue shock loop.

18:04.030 --> 18:11.240
An ability system gameplay cue notifies GC shock loop and go to while active.

18:11.260 --> 18:14.950
We're going to check our source object now and see what it is.

18:15.130 --> 18:22.030
Now the source object could be aura, it could be a player interface, or it could not be.

18:22.060 --> 18:23.140
It depends.

18:24.300 --> 18:26.700
So I'm going to store the source object.

18:26.700 --> 18:28.890
I'm going to promote it to a variable.

18:29.940 --> 18:31.800
Called source Object.

18:39.370 --> 18:47.290
And then after we've spawned the system and set it to our beam system variable, I'm going to perform

18:47.290 --> 18:47.950
a check.

18:49.040 --> 18:51.320
I'm going to see what that source object is.

18:51.320 --> 18:52.580
So I'm going to get it.

18:52.760 --> 18:57.380
And I'm going to say does implement interface.

18:57.380 --> 19:02.510
And I'm going to check to see if it implements the combat interface.

19:04.210 --> 19:06.640
And we'll place a branch here.

19:07.700 --> 19:14.000
So what does that mean if this source object is implementing the combat interface?

19:14.000 --> 19:20.060
Well, if we look back in electrocute, we first checked that mouse hit actor to see if it implements

19:20.060 --> 19:21.530
the combat interface.

19:22.030 --> 19:27.220
And if it does, that's who we're applying this gameplay cue on.

19:28.000 --> 19:28.360
In.

19:28.360 --> 19:33.040
Either way, it's that mouse hit actor that we're passing in for the source object.

19:33.340 --> 19:34.980
So we know a couple of things, right?

19:34.990 --> 19:42.490
We know that if we hit a combat interface, we're applying the cue to that actor that we hit.

19:42.790 --> 19:46.090
If we didn't hit a combat interface, we hit a floor or something.

19:46.090 --> 19:54.010
We're applying that cue to the avatar, and we know that in shock loop by checking the interface here,

19:54.130 --> 19:57.940
true means that we hit something like an enemy.

19:57.970 --> 20:01.510
False means that we hit something like a wall.

20:01.780 --> 20:06.260
Now that means something different for our Niagara parameter.

20:06.280 --> 20:13.210
If we want to set that Niagara parameter to the mouse hit location, well, the mouse hit location better

20:13.240 --> 20:14.710
be correct, right?

20:14.740 --> 20:19.810
Well, it'll be correct if we hit a wall or a floor or something like that.

20:19.810 --> 20:24.780
In other words, in the false case when our combat interface check fails.

20:25.890 --> 20:31.300
And of course we need to set that Niagara variable to our beam system.

20:31.320 --> 20:36.150
We're going to go ahead and take that beam system variable.

20:38.850 --> 20:41.910
That's what we're going to set the parameter for.

20:41.970 --> 20:45.600
We'll set it to mouse hit location because we hit a floor.

20:45.630 --> 20:48.390
We didn't hit a combat interface.

20:48.420 --> 20:53.780
If we did hit a combat interface we want the location of that combat interface.

20:53.790 --> 20:56.820
So we want the location of our source object.

20:56.850 --> 20:58.230
Let's get that.

21:00.200 --> 21:02.810
We're going to have to cast it, at least to an actor.

21:05.020 --> 21:05.980
And.

21:07.410 --> 21:11.010
We're going to get its location with git actor location.

21:11.890 --> 21:15.730
And that's the location we're going to use to set the Niagara variable.

21:15.730 --> 21:18.160
So we're going to duplicate this.

21:18.160 --> 21:24.220
And instead of mouse hit location we're using this actor location here.

21:24.520 --> 21:28.660
And that will be here if we don't fail with the cast.

21:30.220 --> 21:32.210
Just going to stack these nodes here.

21:32.570 --> 21:40.760
So whether the source object is a floor or a wall or a combat interface, either way we're setting that

21:40.760 --> 21:42.080
Niagara variable.

21:42.470 --> 21:44.330
So we'll just say up here.

21:45.700 --> 21:50.920
Mouse hit actor was a combat interface.

21:51.940 --> 21:53.830
And we'll say down here.

21:55.210 --> 21:59.860
Mouse hit actor was not a combat interface.

22:09.290 --> 22:12.380
Okay, so organizing these nicely.

22:14.070 --> 22:14.940
Like so.

22:17.150 --> 22:17.780
Now.

22:18.350 --> 22:22.650
We've set our vector parameter on the Niagara system.

22:22.670 --> 22:26.150
We're going to spawn sound attached no matter which one we did.

22:26.150 --> 22:29.900
So we're going to plug both of these in to spawn sound attach.

22:30.660 --> 22:33.060
We're going to attach it to attach component.

22:33.300 --> 22:36.540
We're going to save that shock sound audio component.

22:36.540 --> 22:39.460
And we're going to end by reaching the return node.

22:39.480 --> 22:45.030
So basically all that we've changed is that if we don't hit a combat interface, we don't hit one of

22:45.030 --> 22:46.660
our goblins or something.

22:46.680 --> 22:51.660
Then we're going to set the beam end location to the place we hit.

22:51.690 --> 22:58.760
Otherwise we're setting it to the location of that actor that we hit that implements the combat interface.

22:58.770 --> 23:02.400
We can test this by right clicking.

23:05.570 --> 23:12.620
And of course, now that we're adding a cue to an actor, we're only going to get to remove that cue

23:12.620 --> 23:16.490
if we've added it to self, because we're only removing it from the self.

23:16.520 --> 23:21.110
If we add it to another actor, we can not remove it.

23:21.110 --> 23:21.860
It's stuck.

23:25.070 --> 23:26.690
So that's something to be aware of.

23:26.720 --> 23:33.290
But luckily our electrocute has saved first target params.

23:34.250 --> 23:42.500
So we need to know if we should remove this first target q params from the self, the owner from the

23:42.500 --> 23:46.370
avatar actor, or from the mouse hit actor.

23:46.370 --> 23:54.230
Because if the mouse hit actor implements the combat interface, then we're adding the looping gameplay

23:54.230 --> 23:56.120
cue on the mouse hit actor.

23:56.240 --> 24:00.560
If it doesn't implement the interface, we're adding it to the avatar actor.

24:00.560 --> 24:06.650
So what we should do is when we know this boolean value, we should save it.

24:06.650 --> 24:08.780
So we're going to promote it to a variable.

24:08.780 --> 24:15.470
So right here, as soon as we know if the mouse hit actor implements the interface, we're promoting

24:15.470 --> 24:19.430
this to a variable not even a local variable a regular variable.

24:19.430 --> 24:23.630
And it's going to be called implements interface.

24:24.590 --> 24:28.250
It should actually be called first target implements interface.

24:28.250 --> 24:29.840
But that's a long name.

24:30.260 --> 24:36.380
But even so we can call it that first target implements interface.

24:36.770 --> 24:38.840
That means we'll need to make room for it.

24:41.620 --> 24:42.660
But that's fine.

24:42.670 --> 24:44.710
At least we know what we're talking about.

24:44.710 --> 24:50.770
So now that we know that our first target implements the interface, that means we added a gameplay

24:50.770 --> 24:52.450
cue to it and we have to remove it.

24:52.450 --> 24:55.000
So we have to go to prepare to end.

24:55.000 --> 25:02.830
And instead of just removing the gameplay cue from owner, now we need to check this boolean with a

25:02.830 --> 25:03.250
branch.

25:03.250 --> 25:06.210
We need to see if the first target implements the interface.

25:06.220 --> 25:12.160
If it does, then we need to remove the first target cue params.

25:12.280 --> 25:19.630
So rather than removing a gameplay cue from owner, we need to take our mouse hit actor and we need

25:19.630 --> 25:24.820
to call remove gameplay cue on actor.

25:27.360 --> 25:30.230
So we know that it implements the interface.

25:30.240 --> 25:32.490
Therefore we added the queue to it.

25:32.520 --> 25:39.030
We need to remove it and we remove it by gameplay tag shock loop and by parameters.

25:39.030 --> 25:40.860
We have to use those parameters.

25:40.860 --> 25:43.470
So we plug in those gameplay queue params.

25:43.500 --> 25:50.160
However, if this boolean is false, then we know that we added the gameplay queue to the avatar actor.

25:50.310 --> 25:56.640
So I'm going to delete that node and reuse remove gameplay queue on actor and use the avatar actor.

25:56.640 --> 25:59.910
So get avatar actor from actor info.

25:59.940 --> 26:04.350
That's the target and it's the same gameplay queue params.

26:04.350 --> 26:05.400
We added it.

26:06.100 --> 26:08.230
Instead to the avatar.

26:10.560 --> 26:18.120
So now we're checking this boolean to see who we applied these first target params to.

26:18.150 --> 26:19.290
And now.

26:20.790 --> 26:22.020
We remove them.

26:22.320 --> 26:28.000
And if we hit a wall or something, well, we remove them from the self from the avatar.

26:28.020 --> 26:34.590
But if we hit one of these enemies, a combat interface, we remove it from that actor.

26:36.320 --> 26:38.480
Because that's the mouse head actor.

26:39.020 --> 26:39.680
Okay.

26:39.680 --> 26:42.920
And by the way, if you're wondering why I was taking some.

26:43.670 --> 26:45.320
Passive damage right here.

26:45.320 --> 26:52.490
That's because the enemy's attack abilities have a debuff chance.

26:52.490 --> 26:54.650
I believe I set that to 100.

26:54.650 --> 26:57.260
So anyway, we won't dig into that right now.

26:57.260 --> 27:03.440
But now we're removing the queue from whoever we added it to, whether it's the mouse hit actor or the

27:03.440 --> 27:04.250
avatar.

27:04.400 --> 27:07.910
This is very important because the difference is crucial.

27:07.910 --> 27:16.580
If we didn't hit a combat target, then we don't need to propagate our electric beam to future targets.

27:16.580 --> 27:20.300
But if we hit a combat interface, we do.

27:20.330 --> 27:23.090
That's why we need the distinction here.

27:23.120 --> 27:27.260
So our next step in spawn electric beam.

27:27.260 --> 27:34.340
After we've added a gameplay queue to our first target, our mouse hit actor or our self.

27:34.340 --> 27:42.080
If we didn't hit a combat interface, now we need to propagate the beam towards nearby enemies.

27:42.170 --> 27:45.590
So in other words, we're going to start off by.

27:46.270 --> 27:54.040
Every time I launch a beam and a hit one of these enemies, it's going to go to the next enemy over.

27:54.070 --> 28:00.150
In fact, it'll go to the next, however many enemies we choose, if they're within a certain radius.

28:00.160 --> 28:02.020
So that's going to be next.

28:02.020 --> 28:07.930
For now, we have our beam working, and the difference now is crucial.

28:07.930 --> 28:12.370
It's that we're adding our gameplay cue to the self or the avatar.

28:12.370 --> 28:18.850
I'm calling the avatar the self unless we hit an enemy or a combat interface, in which case we now

28:18.850 --> 28:22.990
apply it to the mouse head actor and remove it from the mouse hit actor.

28:22.990 --> 28:29.080
Remembering by storing that first target cue params and the mouse head actor.

28:29.080 --> 28:36.100
So next we'll apply multiple cues to multiple enemies based on how close they are.

28:36.130 --> 28:37.330
We'll do that next.

28:37.480 --> 28:38.650
I'll see you soon.
