Welcome back.
Now, our interest is to create some kind of actor that will travel us to another level.
And before we continue on with developing that, I'd like to do something that's pretty fun using what
we've already implemented here.
You see, we already have a highlight interface on our checkpoint actor and.
We have an overlap sphere that if we overlap with it, triggers something in response.
And this is a actor that has a save game variable be reached, which allows us to kind of know that
we've reached a certain point.
So I like that our checkpoints tell us that we've reached a certain point, but it would be nice if
we had other little objects scattered throughout our dungeons that glow as soon as we reach them and
basically give us what the beacons give us, minus actually saving the game.
So it's more just a sense of how far we are in the level, a sense of progress, but not exactly a checkpoint
per se, in that it doesn't save the game state, it doesn't save our state or our status.
All I want it to do is save the fact that it's lit up.
So that's actually pretty easy to do because of the system we already have in place.
We can just inherit from what we have in our checkpoint.
So what we can do is we can take our checkpoints.
I'm going to close all other tabs except for checkpoint dot h, and just make sure that we have enough
things exposed to blueprint to easily extend this in blueprint if we would like to.
Now I'd like handle glow effects to be blueprint callable so we can choose when and how to implement
handle Glow effects.
So I'm going to make this blueprint callable as Handle Glow effects is going to call our checkpoint
reached blueprint implementable event.
After setting our checkpoint mesh material to a newly created dynamic material instance, as well as
disabling the sphere so we can implement that in a blueprint based on this class.
So that's a blueprint implementable event.
Now breached is blueprint read only and it's our save game variable.
I'd like to be able to set this from within blueprint.
So I'm going to make it blueprint read write.
And the reason for that is in blueprint I plan on implementing what happens when our sphere gets overlapped,
as I don't want to save the world state and I don't want to execute save progress, I just want to handle
glow effects.
So we'll need to suppress that from within our blueprint.
Now we can suppress that by simply not binding to it if we don't want to.
We can have some kind of setting that prevents.
Our callback from being bound, such as a boolean called be call overlap callback.
We can have this set to true by default, but we can override this in blueprint by making it edit defaults
only.
Or even add it anywhere.
And then we'll only bind to on component began overlap if b.
Call overlap callback.
Really?
It should be b bind overlap callback.
Let's make it bind.
Overlap.
Callback.
Now that's an option.
So let's go ahead and close the editor down.
And compile and launch and make a new blueprint based on this.
So we can browse to the asset of our checkpoint blueprint and we can make a new one here.
Right click blueprint Class checkpoint and create a blueprint based on checkpoint.
We can select that.
And we can call this BP beacon.
Now, this does technically mean this is a player start within our world, but we don't have to give
it a player start tag, especially if we're always choosing a player start tag specifically when we
load in.
Let's open our BP beacon.
And for the beacon I'm going to choose its checkpoint mesh.
I'm going to choose static Mesh beacon SMM beacon.
And I'm going to select BP Beacon self and search for that setting bind overlap callback I'm going to
uncheck that and leave the custom depth stencil value override to 252.
So now that I have this beacon, I can see what it looks like in the world by dragging one in.
So it looks like my capsule position is a little funky, so we can adjust that.
I'm going to go ahead and undock this.
So I can see both screens.
And just move my checkpoint mesh out just a bit away from my capsule component, which is right here.
And I'd like to move it down as well.
And I'm going to get this whole actor out just a bit.
So I know where it is in relation to the ground, and I can bring that.
Pillar down a bit.
Like that.
Now we do have a sphere as well, and I can increase that sphere radius if I like.
I'm going to make it a little bigger.
Like this.
I'm actually going to make sure to encompass.
That player starts capsule component.
There we go.
I can save all now and press play.
And I can highlight it.
So that means it's something special, right?
If I click on it, at least if I had a navmesh bound volume, I could move to it.
Now, in order to not be distracted by enemies, I'm going to delete that enemy and just get my nav
mesh bounds volume back across the entire map.
That way I can actually click to move and I can test these things out, like clicking on this beacon
and coming over to it.
Now we're no longer binding that C plus plus callback, but I'd like to use an overlap event for my
sphere.
I'm going to right click and use on component begin overlap.
And I'm going to see if the other actor does implement.
An interface.
We'll check for the player interface.
And if it does?
Well, then I'd like to do a few things.
I'd like to.
Call the blueprint callable function.
We made this blueprint callable.
It's called handle glow effects.
And that's going to end up calling checkpoint reached.
So after calling handle glow effects.
I can implement checkpoint reached as well.
And implement checkpoint reached.
And I have a dynamic material instance at this point so I can make a timeline.
So I'll go ahead and make a beacon timeline.
So add timeline.
I'll call this beacon timeline.
I'll open it up, add a track.
We'll make it a float track called Beacon Track.
I'll make it one second long and right click and add a key.
At time zero it'll have a value of zero, and I'll right click and add a key at time one, and it'll
have a value of one.
I'll go ahead and select both keys.
Make it an auto curve so it's nice and smooth.
And I'll go ahead and play this timeline and move this dynamic material instance with a reroute node
around the timeline.
And I know this dynamic material instance is valid and has a glow parameter because the beacon mesh,
if I browse to it and take a look at its material, it's using my beacon.
And if I open that, it has a glow parameter.
So I can call set scalar parameter value.
And call this on update and set the parameter name to glow.
And I can scale this value.
If I would like a glow parameter.
So I'm going to multiply that.
Track value and promote this to a variable called glow factor.
I know I've repeated that as we have a glow factor in the checkpoint as well.
We could have made that a C plus plus member variable, but I'm going to compile and give glow factor
a value of 100.
And that way we now have our checkpoint being reached.
So now that we're calling the timeline, we should see our beacons glow.
Let's test this out.
And when we reach it, they glow.
I think a glow factor of 100 looks fantastic, and it makes my checkpoints pale in comparison.
So I'm going to open my checkpoint and take its glow factor and up that to, I believe, 100.
It was 20.
Let's see how 100 looks.
That's fantastic.
So now we have these beacons right.
And the beacons have a variable with save game.
In fact, if we go into the My Blueprint panel into variables and we open the checkpoint dropdown,
here's that reached.
This is a save game variable.
It has save game and it's you property.
And by the way if you were wondering you can make blueprint created variables save game variables as
well.
You just have to expand advanced in their details panel and check save game if you wanted to save that
as well.
I don't want to save Glow Factor, but just pointing that out now this should because it's a checkpoint
and implements the save interface.
It should.
Remain glowing.
Once we save the game and exit and come back.
Let's test that out though.
I'm going to put one right here.
I'll move it right there.
And.
Why not?
Let's bring one over here.
I'm going to get a BP beacon on the ground right here.
I'm going to hit the end key to bring it down.
I think I'll rotate it by 90 degrees as well.
And move it right there.
Okay, let's save all.
Let's go to our load menu.
I'd like to delete this slot and create a new one just called S.
Select it and play.
Let's reach this beacon.
There we go.
And let's reach a checkpoint.
Let's exit and come back.
And we did not save the beacon.
And I believe we actually never set be reached to true.
Let's do that after handle glow effects as it was set in checkpoint in our overlap callback.
So we're suppressing that.
So we're never actually setting be reach to true are we.
Let's actually set it here.
We made it blueprint read right.
Let's set it to true on component began overlap.
And now we should be able to load in.
Reach the beacon.
Reach a checkpoint as well.
Exit and come back.
Let's see if that beacon is lit up.
And it is.
So we're saving that beacon and it's now no longer reachable.
And if we wanted to, we could actually suppress the highlight as well.
If something is reached for example, we could no longer highlight it.
You could do that for a checkpoint as well if you wanted to, and that's really not too hard to do.
You can just go into the checkpoint C plus plus class to the highlight function, highlight actor and
only highlight if.
Be reached is false.
So if not be reached then you can set render custom depth to true, otherwise it would be false.
So just a real quick test testing out that feature.
Let's see if we can get that.
Highlighting suppressed when breached is true.
Okay, so we're back.
I don't think I need these blueprints open, but I'm going to go ahead and open the load menu.
And select a slot.
Let's go ahead and let's just reach this beacon over here.
Okay, so we've reached it, and we no longer get the highlighting.
Perfect.
Now we do still run to the location.
We're still overriding that, and I'm fine with that.
I'm actually okay with that.
I would rather that because when an object puts a hole in the nav mesh, clicking on it gives us a pretty
undefined location if we want it to run to it.
Okay, so this is great.
And also due to the cool nature of this highlighting that we get with new beacons, you can kind of
count beacons reaching them as a measure of progress too.
You could put something in the HUD that shows how many beacons you've reached, and when you clear a
dungeon, you can know that you've cleared the whole thing.
If you've cleared all the beacons, and that can be something you can show at the end of a dungeon,
for example.
Excellent.
Plus, they look really cool.
I mean, look at those runes.
That's pretty awesome.
All right.
Excellent job.
And I'll see you in the next video.