Welcome back.
In this video, we'd like to make an actor for our flame pillar, and I'd like it to have some more
dynamic lighting that kind of fades in and gets brighter and darker.
So it looks like the flame is dynamically emitting light.
Now, one thing that's kind of bugging me is this little spot here where we can run around.
I don't really want to be able to run back there, so I'm going to move these over a bit.
I'm actually going to undo that and turn snapping on first and move those over.
Now I have a gap, so I'm going to move these over and I think I can just delete this part and duplicate
this one like so.
Now I have a bit of a wider opening, which might be okay.
Or I can delete that and just duplicate this one and bring it down.
Actually a three by three might be better.
So we don't have that little spot down there.
Okay, cool.
That was just bugging me.
So now we have a blocked part so that way we can deal with the complication of having that ceiling in
the way and we'll get to that.
But for now, we're making a flame pillar, so let's do that.
And I see absolutely no reason to make this a C plus plus actor.
This is a purely cosmetic designer type thing to make, so we're going to make it in the editor with
Blueprint.
So I'm going to remove that texture filter.
I don't need to search for stair anymore and I'm going to go ahead and go to Blueprints Actor and make
a new folder called Flame Pillar.
We'll make a new blueprint here.
I'm going to right click Create Blueprint class, choose actor and this will be BP Underscore Flame
Pillar.
So the flame pillar is going to be pretty simple.
For one, it needs a mesh.
So we're going to select the default scene route, add a static mesh and call this the pillar.
Well, pillar, not the pillar, and I'm going to drag it on to the default scene route.
So it's the route.
Now with Pillar selected, I'm going to set this to the static mesh pillar in this project.
So now we have an actor with Pillar and we can add our own flame to it.
So selecting Pillar, I'm going to click Add Type Niagara and use a Niagara particle system.
I'm going to call it flame and set the system to fire and bring it on up so that it's right there.
I'm going to disable snapping and bring it down like so.
Now I'd like a point light and I'd like the point light attached to the flame.
So with the flame selected, I'm going to search for point light.
Select that and we're going to call this fire light and I'm going to bring that up right up to the flame
itself.
And I think this could be a little bit more orange.
So I'm going to bring it over into the yellow, almost orange color.
Like so.
That looks good.
Let's get one of these in.
Let's get a couple of them, actually.
So I don't really want this one anymore.
With its separate Niagara system, I'm going to remove both of those and turn snapping back on and grab
myself a flame pillar and bring it in and duplicate it over to this side.
So I have a couple of them now.
That light is a little bit bright.
I'd like it to be a little softer.
It doesn't have to have such a high intensity.
But what I really like to do, though, is make its intensity dynamic.
So I'm going to use a timeline for that.
So my fire light, if it's going to be dynamically changing its intensity, it has to be either stationary
or movable.
It can't be static.
Now, movable means that we can change its intensity and its color dynamically, but we could also move
it throughout the level during the game.
That's not what we need for this.
So saving a little bit on performance, we can change it to stationary so we can be stationary and still
dynamically change the intensity of the light.
And that's what we're going to do.
Now we don't have to actually tick.
I'm going to search for tick with flame pillar, self selected and uncheck.
Start with tick enabled.
We don't need to tick.
We're going to use a timeline instead.
So I'm going to right click in the event graph type timeline and add a timeline and we can call this
flame intensity timeline.
And we're going to add a curve to it.
We'll add a track.
This track is going to be a float track.
And I'm going to call this track Flame Intensity.
Really, it's point light intensity, but whatever.
And we can start adding some keys to this.
So I'm going to add two, three, four keys.
We have a length of five seconds here, so I'm going to set that to more like two seconds and just have
a few keys and move them up and down.
And this will be for our flame intensity.
Now, there's no need to go below zero.
A zero intensity means the flame is basically out, but we're going to just have something like this.
I'll add one more key and go back down.
Like so.
And then of course, I can highlight all of them.
Right click Select Auto and they're nice and smooth.
So now I have a timeline that once we run it, it'll return this flame intensity and it goes from zero
to just above one, probably close to two.
And what I'd like to do is set the intensity when we're running this timeline for my point light called
fire light.
So if I drag fire, light, drag it off and type set intensity, we can call set intensity passing in
a value.
Now what is its intensity Already?
It's set to 5000, so I'd like a base intensity boolean, so I'm going to drag off of new intensity,
promote to a variable and call this base intensity compile and set that to 5000 by default.
And then I'm going to multiply by the flame intensity.
As we're playing this timeline.
That means we'll be fading in and out.
The intensity will multiply 5000 by zero.
So that's exactly zero.
And then going all the way up to one, we're scaling it by that 5000.
So the intensity will go up to 5000, then down, then up, then down, then up.
And so we'll see a sort of flickering looking behavior.
So that's going to be tied to update.
So we'll figure out how to loop it in a second.
For now, let's just drag Beginplay up to play from start and see what this looks like in the game.
So pressing play.
We see that it's flickering.
Now, a couple issues.
For one, it stops.
We're going to want it to keep playing.
And another issue is when we press play.
They're both flickering in sync with each other, so that doesn't look very nice either.
So to handle both of those problems, I'm going to delete those nodes I'm not using here.
I'm going to make another timeline and this timeline is going to have a different length.
So rather than just adding a new track to this timeline, I'm just going to make a second timeline.
This first one is called flame intensity.
Timeline.
I'm going to rename it to Flame intensity, Underscore one, and then I'll make another timeline.
And this one will be called flame intensity.
Underscore two.
We'll double click this.
This could be a completely different track with a different length.
We'll set it to three seconds, we'll add a float track and we'll start adding some keys to this curve
and we'll make this track quite a bit different than the other one.
And we'll move things up and down.
Like so and I'm going to highlight all of them, make them auto curves.
And I have now this curve here, which looks a bit different.
Right?
I'm going to set these end points, exact this 1 to 3 seconds and a value of zero, this 1 to 0 seconds
and a value of zero.
Just because I can.
And now I have my second timeline.
So now what I can do is I'm going to make a custom event to play each timeline.
So I'm going to right click here type custom event.
I'm going to call this start time.
You can't see because that hover tooltip was in the way.
Start timeline underscore one and I'm going to make another custom event.
Start timeline underscore two.
Start timeline.
One will play this one from the start.
Start timeline two will play the other one from the start.
I'd like to make sure that both of them have used last keyframe checked.
So I'm going to check that for both of them.
And I want to do the same thing.
Multiply base intensity by this flame intensity.
By the way, this one isn't called flame intensity, so I'm just going to rename it to flame intensity
for the track and I can just make a function that can do this and call it twice.
So I'm going to right click collapse the function and call this scale flame intensity.
And we'll call this down here for update, just like we did for the first track.
Like.
So now this input, I'm being a little quick.
We could call this intensity instead of just a.
And if we compile that now, we see intensity there.
Okay, so we have two events.
What I'd like to do is play one at random and begin play.
So I'm going to make yet another custom event and this will be Choose Timeline.
And we can just get a random integer between 0 and 1.
So I'm going to say random int and get random integer and range.
We'll get a random int between 0 and 1, basically a coin flip and then we can switch on that.
INT So I'm going to use switch on int.
And if it's a zero, we'll play the first timeline.
And if it's a one, we'll play the second timeline.
So I'm going to add a pen twice.
So we have a zero and one off of zero.
I'm going to call start Timeline one.
Off of one I'm going to call start time line to.
And the default can just start timeline two.
So now we have this Choose Timeline event.
And I'm going to call that and begin play.
So choose timeline like so now when we finish one of these timelines, we can simply call choose timeline
and play one of these two at random.
So we're going to do Choose Timeline.
After we finished the first timeline and choose timeline.
After we finish the second one.
So each time a timeline finishes, we'll play another one of them at random.
And then we shouldn't have such a rigid looking system where all of our torches are flickering at the
same rate.
So let's go ahead and save all.
Press play.
And now we can see that they're not flickering in sync anymore.
They're flickering completely differently.
It looks random, but really, we're just choosing one of those timelines at random and it looks pretty
good.
Let's make sure we can still launch a fireball at it and we can't.
So we can take that pillar and just set its collision settings to the settings we need for our project.
We're going to set it to custom.
We're going to block the projectile and ignore visibility and camera, and that way we should be able
to click on it and run behind it.
And we should be able to hit it with the projectile.
And with that we have a nice flickering torch or pillar, essentially a torch, and things are looking
great.
Excellent job.
And I'll see you in the next video.