WEBVTT

00:06.830 --> 00:07.790
Welcome back.

00:07.820 --> 00:15.200
In this video, we'd like to make an actor for our flame pillar, and I'd like it to have some more

00:15.200 --> 00:20.090
dynamic lighting that kind of fades in and gets brighter and darker.

00:20.090 --> 00:22.970
So it looks like the flame is dynamically emitting light.

00:23.000 --> 00:29.150
Now, one thing that's kind of bugging me is this little spot here where we can run around.

00:29.150 --> 00:33.890
I don't really want to be able to run back there, so I'm going to move these over a bit.

00:33.890 --> 00:39.050
I'm actually going to undo that and turn snapping on first and move those over.

00:39.860 --> 00:46.910
Now I have a gap, so I'm going to move these over and I think I can just delete this part and duplicate

00:46.910 --> 00:49.490
this one like so.

00:49.610 --> 00:53.540
Now I have a bit of a wider opening, which might be okay.

00:53.540 --> 00:58.430
Or I can delete that and just duplicate this one and bring it down.

00:58.430 --> 01:01.090
Actually a three by three might be better.

01:01.100 --> 01:03.710
So we don't have that little spot down there.

01:03.740 --> 01:04.700
Okay, cool.

01:04.970 --> 01:06.320
That was just bugging me.

01:06.320 --> 01:14.330
So now we have a blocked part so that way we can deal with the complication of having that ceiling in

01:14.330 --> 01:16.550
the way and we'll get to that.

01:16.550 --> 01:20.930
But for now, we're making a flame pillar, so let's do that.

01:20.930 --> 01:25.970
And I see absolutely no reason to make this a C plus plus actor.

01:26.000 --> 01:33.290
This is a purely cosmetic designer type thing to make, so we're going to make it in the editor with

01:33.290 --> 01:34.100
Blueprint.

01:34.100 --> 01:37.880
So I'm going to remove that texture filter.

01:37.880 --> 01:45.600
I don't need to search for stair anymore and I'm going to go ahead and go to Blueprints Actor and make

01:45.600 --> 01:48.630
a new folder called Flame Pillar.

01:49.020 --> 01:51.390
We'll make a new blueprint here.

01:51.480 --> 01:58.440
I'm going to right click Create Blueprint class, choose actor and this will be BP Underscore Flame

01:58.440 --> 01:59.190
Pillar.

02:01.130 --> 02:03.980
So the flame pillar is going to be pretty simple.

02:04.130 --> 02:06.080
For one, it needs a mesh.

02:06.080 --> 02:13.250
So we're going to select the default scene route, add a static mesh and call this the pillar.

02:13.640 --> 02:18.080
Well, pillar, not the pillar, and I'm going to drag it on to the default scene route.

02:18.080 --> 02:19.430
So it's the route.

02:19.460 --> 02:26.720
Now with Pillar selected, I'm going to set this to the static mesh pillar in this project.

02:26.720 --> 02:32.930
So now we have an actor with Pillar and we can add our own flame to it.

02:32.930 --> 02:40.220
So selecting Pillar, I'm going to click Add Type Niagara and use a Niagara particle system.

02:40.220 --> 02:48.650
I'm going to call it flame and set the system to fire and bring it on up so that it's right there.

02:48.650 --> 02:52.820
I'm going to disable snapping and bring it down like so.

02:52.820 --> 02:57.320
Now I'd like a point light and I'd like the point light attached to the flame.

02:57.320 --> 03:00.810
So with the flame selected, I'm going to search for point light.

03:00.810 --> 03:09.660
Select that and we're going to call this fire light and I'm going to bring that up right up to the flame

03:09.660 --> 03:10.530
itself.

03:10.560 --> 03:14.010
And I think this could be a little bit more orange.

03:14.010 --> 03:18.210
So I'm going to bring it over into the yellow, almost orange color.

03:19.080 --> 03:20.310
Like so.

03:22.160 --> 03:23.230
That looks good.

03:23.870 --> 03:25.240
Let's get one of these in.

03:25.250 --> 03:26.870
Let's get a couple of them, actually.

03:26.870 --> 03:29.060
So I don't really want this one anymore.

03:29.060 --> 03:36.530
With its separate Niagara system, I'm going to remove both of those and turn snapping back on and grab

03:36.530 --> 03:41.420
myself a flame pillar and bring it in and duplicate it over to this side.

03:41.720 --> 03:44.600
So I have a couple of them now.

03:44.600 --> 03:46.610
That light is a little bit bright.

03:46.610 --> 03:48.470
I'd like it to be a little softer.

03:51.840 --> 03:54.030
It doesn't have to have such a high intensity.

03:54.030 --> 03:58.530
But what I really like to do, though, is make its intensity dynamic.

03:58.740 --> 04:01.480
So I'm going to use a timeline for that.

04:01.500 --> 04:09.240
So my fire light, if it's going to be dynamically changing its intensity, it has to be either stationary

04:09.240 --> 04:10.070
or movable.

04:10.080 --> 04:11.520
It can't be static.

04:11.550 --> 04:17.970
Now, movable means that we can change its intensity and its color dynamically, but we could also move

04:17.970 --> 04:20.550
it throughout the level during the game.

04:20.550 --> 04:22.170
That's not what we need for this.

04:22.170 --> 04:28.470
So saving a little bit on performance, we can change it to stationary so we can be stationary and still

04:28.470 --> 04:31.500
dynamically change the intensity of the light.

04:31.500 --> 04:33.000
And that's what we're going to do.

04:33.360 --> 04:35.890
Now we don't have to actually tick.

04:35.910 --> 04:40.740
I'm going to search for tick with flame pillar, self selected and uncheck.

04:40.740 --> 04:42.500
Start with tick enabled.

04:42.510 --> 04:43.800
We don't need to tick.

04:43.830 --> 04:45.960
We're going to use a timeline instead.

04:45.960 --> 04:52.900
So I'm going to right click in the event graph type timeline and add a timeline and we can call this

04:52.900 --> 04:56.560
flame intensity timeline.

04:57.310 --> 04:59.270
And we're going to add a curve to it.

04:59.290 --> 05:00.220
We'll add a track.

05:00.250 --> 05:03.570
This track is going to be a float track.

05:03.580 --> 05:07.510
And I'm going to call this track Flame Intensity.

05:07.540 --> 05:10.450
Really, it's point light intensity, but whatever.

05:10.630 --> 05:13.000
And we can start adding some keys to this.

05:13.000 --> 05:15.880
So I'm going to add two, three, four keys.

05:17.920 --> 05:24.970
We have a length of five seconds here, so I'm going to set that to more like two seconds and just have

05:24.970 --> 05:27.820
a few keys and move them up and down.

05:27.820 --> 05:30.940
And this will be for our flame intensity.

05:30.970 --> 05:33.850
Now, there's no need to go below zero.

05:33.880 --> 05:40.150
A zero intensity means the flame is basically out, but we're going to just have something like this.

05:43.130 --> 05:45.920
I'll add one more key and go back down.

05:48.010 --> 05:49.570
Like so.

05:50.740 --> 05:53.470
And then of course, I can highlight all of them.

05:53.770 --> 05:57.220
Right click Select Auto and they're nice and smooth.

05:57.250 --> 06:04.720
So now I have a timeline that once we run it, it'll return this flame intensity and it goes from zero

06:04.720 --> 06:08.380
to just above one, probably close to two.

06:08.470 --> 06:15.820
And what I'd like to do is set the intensity when we're running this timeline for my point light called

06:15.820 --> 06:16.480
fire light.

06:16.480 --> 06:23.530
So if I drag fire, light, drag it off and type set intensity, we can call set intensity passing in

06:23.530 --> 06:24.490
a value.

06:24.640 --> 06:26.530
Now what is its intensity Already?

06:26.530 --> 06:34.570
It's set to 5000, so I'd like a base intensity boolean, so I'm going to drag off of new intensity,

06:34.570 --> 06:44.080
promote to a variable and call this base intensity compile and set that to 5000 by default.

06:44.200 --> 06:47.950
And then I'm going to multiply by the flame intensity.

06:49.200 --> 06:51.780
As we're playing this timeline.

06:52.480 --> 06:55.210
That means we'll be fading in and out.

06:55.210 --> 06:58.450
The intensity will multiply 5000 by zero.

06:58.450 --> 07:00.010
So that's exactly zero.

07:00.010 --> 07:04.000
And then going all the way up to one, we're scaling it by that 5000.

07:04.000 --> 07:09.310
So the intensity will go up to 5000, then down, then up, then down, then up.

07:09.310 --> 07:13.950
And so we'll see a sort of flickering looking behavior.

07:13.960 --> 07:16.570
So that's going to be tied to update.

07:16.570 --> 07:19.180
So we'll figure out how to loop it in a second.

07:19.180 --> 07:26.710
For now, let's just drag Beginplay up to play from start and see what this looks like in the game.

07:27.900 --> 07:29.340
So pressing play.

07:29.340 --> 07:31.080
We see that it's flickering.

07:31.260 --> 07:32.670
Now, a couple issues.

07:32.670 --> 07:33.750
For one, it stops.

07:33.750 --> 07:35.430
We're going to want it to keep playing.

07:35.430 --> 07:38.160
And another issue is when we press play.

07:38.190 --> 07:43.580
They're both flickering in sync with each other, so that doesn't look very nice either.

07:43.590 --> 07:48.720
So to handle both of those problems, I'm going to delete those nodes I'm not using here.

07:49.140 --> 07:55.560
I'm going to make another timeline and this timeline is going to have a different length.

07:55.560 --> 08:01.320
So rather than just adding a new track to this timeline, I'm just going to make a second timeline.

08:02.190 --> 08:04.170
This first one is called flame intensity.

08:04.200 --> 08:04.920
Timeline.

08:04.920 --> 08:12.870
I'm going to rename it to Flame intensity, Underscore one, and then I'll make another timeline.

08:14.760 --> 08:16.860
And this one will be called flame intensity.

08:16.890 --> 08:18.270
Underscore two.

08:18.300 --> 08:19.590
We'll double click this.

08:19.590 --> 08:23.720
This could be a completely different track with a different length.

08:23.730 --> 08:29.400
We'll set it to three seconds, we'll add a float track and we'll start adding some keys to this curve

08:29.400 --> 08:33.540
and we'll make this track quite a bit different than the other one.

08:40.160 --> 08:43.010
And we'll move things up and down.

08:47.110 --> 08:51.790
Like so and I'm going to highlight all of them, make them auto curves.

08:51.790 --> 08:56.200
And I have now this curve here, which looks a bit different.

08:56.200 --> 08:56.860
Right?

08:56.860 --> 09:03.940
I'm going to set these end points, exact this 1 to 3 seconds and a value of zero, this 1 to 0 seconds

09:03.940 --> 09:05.230
and a value of zero.

09:06.020 --> 09:07.580
Just because I can.

09:07.580 --> 09:11.300
And now I have my second timeline.

09:11.630 --> 09:17.030
So now what I can do is I'm going to make a custom event to play each timeline.

09:17.030 --> 09:20.180
So I'm going to right click here type custom event.

09:20.210 --> 09:23.030
I'm going to call this start time.

09:23.030 --> 09:26.120
You can't see because that hover tooltip was in the way.

09:26.150 --> 09:32.450
Start timeline underscore one and I'm going to make another custom event.

09:35.110 --> 09:38.440
Start timeline underscore two.

09:39.770 --> 09:40.670
Start timeline.

09:40.670 --> 09:42.720
One will play this one from the start.

09:42.740 --> 09:45.770
Start timeline two will play the other one from the start.

09:45.890 --> 09:50.120
I'd like to make sure that both of them have used last keyframe checked.

09:50.770 --> 09:52.750
So I'm going to check that for both of them.

09:52.930 --> 09:55.900
And I want to do the same thing.

09:55.900 --> 10:00.160
Multiply base intensity by this flame intensity.

10:00.490 --> 10:06.850
By the way, this one isn't called flame intensity, so I'm just going to rename it to flame intensity

10:07.060 --> 10:13.990
for the track and I can just make a function that can do this and call it twice.

10:13.990 --> 10:20.440
So I'm going to right click collapse the function and call this scale flame intensity.

10:21.630 --> 10:27.810
And we'll call this down here for update, just like we did for the first track.

10:29.370 --> 10:29.760
Like.

10:29.760 --> 10:33.950
So now this input, I'm being a little quick.

10:33.960 --> 10:36.900
We could call this intensity instead of just a.

10:38.450 --> 10:41.780
And if we compile that now, we see intensity there.

10:43.090 --> 10:45.010
Okay, so we have two events.

10:45.040 --> 10:48.530
What I'd like to do is play one at random and begin play.

10:48.550 --> 10:55.210
So I'm going to make yet another custom event and this will be Choose Timeline.

10:55.210 --> 10:59.980
And we can just get a random integer between 0 and 1.

11:00.400 --> 11:04.870
So I'm going to say random int and get random integer and range.

11:04.870 --> 11:10.720
We'll get a random int between 0 and 1, basically a coin flip and then we can switch on that.

11:10.720 --> 11:12.820
INT So I'm going to use switch on int.

11:14.940 --> 11:17.580
And if it's a zero, we'll play the first timeline.

11:17.580 --> 11:20.140
And if it's a one, we'll play the second timeline.

11:20.160 --> 11:22.110
So I'm going to add a pen twice.

11:22.110 --> 11:24.780
So we have a zero and one off of zero.

11:24.810 --> 11:28.230
I'm going to call start Timeline one.

11:29.220 --> 11:32.220
Off of one I'm going to call start time line to.

11:34.390 --> 11:37.480
And the default can just start timeline two.

11:37.870 --> 11:40.960
So now we have this Choose Timeline event.

11:40.990 --> 11:43.120
And I'm going to call that and begin play.

11:43.180 --> 11:53.200
So choose timeline like so now when we finish one of these timelines, we can simply call choose timeline

11:53.200 --> 11:54.820
and play one of these two at random.

11:54.820 --> 11:57.160
So we're going to do Choose Timeline.

11:58.730 --> 12:02.600
After we finished the first timeline and choose timeline.

12:02.720 --> 12:04.640
After we finish the second one.

12:04.850 --> 12:10.100
So each time a timeline finishes, we'll play another one of them at random.

12:10.100 --> 12:16.910
And then we shouldn't have such a rigid looking system where all of our torches are flickering at the

12:16.910 --> 12:17.730
same rate.

12:17.750 --> 12:20.360
So let's go ahead and save all.

12:21.030 --> 12:22.080
Press play.

12:22.870 --> 12:27.700
And now we can see that they're not flickering in sync anymore.

12:27.730 --> 12:29.290
They're flickering completely differently.

12:29.290 --> 12:34.600
It looks random, but really, we're just choosing one of those timelines at random and it looks pretty

12:34.600 --> 12:35.110
good.

12:38.850 --> 12:42.870
Let's make sure we can still launch a fireball at it and we can't.

12:42.870 --> 12:50.280
So we can take that pillar and just set its collision settings to the settings we need for our project.

12:50.310 --> 12:52.350
We're going to set it to custom.

12:52.950 --> 13:02.250
We're going to block the projectile and ignore visibility and camera, and that way we should be able

13:02.250 --> 13:05.130
to click on it and run behind it.

13:05.910 --> 13:09.540
And we should be able to hit it with the projectile.

13:10.980 --> 13:19.320
And with that we have a nice flickering torch or pillar, essentially a torch, and things are looking

13:19.320 --> 13:20.070
great.

13:20.490 --> 13:21.420
Excellent job.

13:21.420 --> 13:23.190
And I'll see you in the next video.
