♪♪♪
Wes Bunn: Hi everyone. We are back. In the previous video, we set up the checkpoint system.
Click Play.
I can drive through the checkpoint.
The checkpoint is the Trigger.
As we drive through the Trigger it disappears from the level,
which is exactly what we want.
There is the checkpoint again.
As we drive through it, it disappears.
We set up the individual checkpoint.
Over the next few videos, we are going to be working on the system that
monitors all of the checkpoints in our level.
We will be able to have multiple checkpoints that turn on and off
sequentially as the Player enters the previous checkpoint.
That system is going to be set up inside the Tracker Blueprint.
We are going to start working on the Tracker Blueprint next.
Before we start working on the Tracker Blueprint, we need to do something for the Checkpoint Blueprint.
In the Content Browser, Double-click to open Checkpoint Blueprint.
Go to the Components window, and select Trigger.
In the Details panel,
we had unchecked Hidden in Game for testing so we could see the checkpoint
inside of the level.
Check the Hidden in Game checkbox. We are going to call this through script
when we want to make the Trigger volume visible in game.
We eventually want to set this for ParticleSystem too.
Check the Hidden in Game checkbox.
In the Details panel, scroll down to the Collision section.
Uncheck Generate Overlap Events.
We are also going to call this through script.
We only want to be able to overlap Triggers when we turn them on in-game.
Click Compile and click Save, and close Checkpoint Blueprint.
Next, we will work on the Tracker Blueprint.
As I mentioned, the Tracker Blueprint will keep track of all the checkpoints in the level.
Double-click to open Tracker Blueprint.
First, go to the Components window.
We are going to add a single component. Click +Add Component.
Type and select "Billboard". This is a Billboard Component.
It says a Billboard is, "A 2d texture that will be rendered always facing the camera."
We are going to use the Billboard Component as a way to see the Tracker Blueprint in the level.
Drag-and-drop Billboard on top of Root.
Click Compile and click Save.
Go back to the level.
Drag Tracker Blueprint into the level.
Left-click + drag Tracker Blueprint into the level.
We have a visual indication of where this Blueprint is now.
This Billboard Component will always face us, which is this dinosaur icon.
This icon indicates where the Tracker Blueprint is. You can go to the Details panel and scale it up.
Set X, Y, and Z to 1.5.
The icon looks a little bit bigger.
This Blueprint is important because it will hold all of the custom settings for our race.
Any settings we want to change for the race
is going to be done in the Details panel of the Tracker Blueprint.
It is important to know where the Tracker Blueprint is inside of the level.
In the World Outliner, you can also type "Tracker",
and select it this way as well.
I wanted to add the single Billboard Component so that we can see it.
Go to the Tracker Blueprint. We are going to set this up like we did with the PlayerController Blueprint.
We are going to add all the variables and functions we need in this video.
We will probably start working on the Event Graph for this Blueprint the next video.
In the video after that, we will finish some of the functions we will be adding.
Finally, we will test the system.
We have a lot of work to do in here, but we will do it in the next few videos.
First, we need to create some variables. Go to the My Blueprint tab.
Click +Variable.
Set Variable Name to "MaxLaps".
In the Details panel, click the Variable Type drop down and select Integer.
Check the Editable checkbox.
Enabling the Editable property allows us to edit it in the Details panel of the Level Editor.
I will show you this in a moment.
Enter a Tooltip.
"User defined maximum laps for the race."
Or, enter any tooltip that you think will help you.
Assign MaxLaps to a category.
For organizational purposes, set Category to "Custom Settings".
UE4 will nest the variable under the Custom Settings header.
Click Compile.
Go back to LooptyLoopMap.
Select Tracker in the Content Browser.
Go to the Details panel, and there is a Custom Settings section.
This is where level designers and artists can specify
how many laps they want this race or this map to have.
Making variables publicly editable will make things more user friendly for you,
and other designers or artists working on your projects.
They can make the maps and specify all the settings in the Details panel,
instead of having to open the MyPlayerController Blueprint
finding the variables and setting their values inside it.
We are going to pass the variables from Tracker
automatically to MyPlayerController
so we can edit them in the Details panel.
Let's continue adding the rest of the variables. We have a few more we need to add.
In the My Blueprint tab, select MaxLaps and press Ctrl + W to duplicate it.
Set Variable Name to "GoldTime".
This is the time needed to reach Gold status.
In the Details panel, click the Variable Type drop down and select Float
I am going to delete the Tooltip because I think it is self-explanatory, but add a tooltip if you want.
We have the GoldTime variable.
Select GoldTime, and press Ctrl + W. Set Variable Name to "SilverTime".
Press Ctrl + W. Set Variable Name to "BronzeTime".
There are a few other settings we want to allow designers to set within the Details panel.
Let's continue and add those.
Press Ctrl + W. Set Variable Name to "DefaultBestLap".
This variable will set the default lap time.
Press Ctrl + W. Set Variable Name to "DefaultBestTime".
Press Ctrl + W.
We want to be able to name the map. Set Variable Name to "NameOfMap".
Click the Variable Type drop down and select Text.
Press Ctrl + W.
Set Variable Name to "SaveGameName".
Click the Variable Type drop down and select String.
Let's also allow
designers and artists
to set the level music and checkpoint sound effect that plays. We will make those custom settings.
Let's add another variable. Press Ctrl + W.
Set Variable Name to "LevelMusic".
Click the Variable Type drop down, type and select "Ambient Sound".
I am going to add a tooltip for this variable.
Set Tooltip to "You need to add
a sound to the level first!"
In order to set this variable, we have to add a sound effect to the level.
Then, we will be able to select any of the sounds we want to play by clicking the drop down
for the LevelMusic and the CheckpointSoundFX.
Let's add one (1) more variable. Press Ctrl + W.
Set Variable Name to "CheckpointSoundFX".
Click Compile.
UE4 compiled successfully.
Now, I am going to set some default values for these variables.
I am going to set some default values for the variable properties so they are not all set to 0.
Select MaxLaps. Under Default Value, I will set Max Laps to 2.
I will set Gold Time to 60.0 seconds. Feel free to set these values to whatever you want.
Select SilverTime. I will set Silver Time to 120.0, or 2 minutes.
Select BronzeTime. I will set Silver Time to 180.0, or 2 minutes.
Select DefaultBestLap. I will set Default Best Lap to 60.0.
Select DefaultBestTime. I will set Default Best Time to 120.0.
For the first map, I will set Name Of Map to "Loopty Loop Map".
Select SaveGameName.
If you are going to be saving per map,
it is a good idea to be consistent with your naming conventions.
I will set Save Game Name to LL_SaveGame for Loopty Loop Save Game.
I will name any additional maps with the abbreviated level name and SaveGame.
We have to set Level Music and Checkpoint SoundFX in the level in the moment.
Click Compile and click Save.
Go back to LooptyLoopMap.
In the Details panel, there are all the settings we can now set.
We will set up the script for the variables later.
We will pass the variables to the PlayerController so they are applied.
Again, you see how useful it is to be able to set the values right here
instead of manually setting them inside the MyPlayerController Blueprint.
Let's go ahead and add Level Music and Checkpoint SoundFX.
When I mouse over Level Music it says, "You need to add a sound to the level first!"
Let's go ahead and add a sound.
In the Content Browser, go to the Audio folder.
Left-click + drag Bluepurints_TextPop03 into the level.
Left-click + drag RealisticRender_MusicDay02 into the level.
Select the Tracker, which is the dinosaur icon.
In the Details panel under Custom Settings, click the Level Music drop down.
We have the two (2) effects that are in the level.
For Level Music, select RealisticRender_MusicDay02.
Click the Checkpoint SoundFX drop down, and select Bluepurints_TextPop03.
All of our custom settings are created and applied.
We are about 10 minutes into the video. We are going to create the functions and then pause.
We will do the scripting in the next video.
Let's finish the Tracker.
Go to the Tracker tab.
In the My Blueprint tab, collapse Custom Settings.
There are a few more variables we need to add.
One of the variables we want to be publicly editable, but we don't want to add it to the Custom Settings.
We are going to put the variable in its own category because it is important.
Click +Variable.
Set Variable Name to "Checkpoints".
This variable will keep track of all the checkpoints we place in the level.
We need to change this from an Ambient Sound. Click the Variable Type drop down,
and type "Checkpoint".
We are referencing the Checkpoint Blueprint here.
We are going to have several Checkpoint Blueprints stored in this variable.
Select Checkpoint.
We need to make this variable an array, so that we can have more than one.
We are going to store all the checkpoints in the level inside this array.
Click the array icon next to Variable Type.
This will change the icon.
Check the Editable checkbox to make the variable publicly editable. This is very important.
Make sure the variable is publicly editable.
Set the Tooltip. "You must assign all checkpoints
from the level to this array."
You must assign all the checkpoints from the level to this array in order for this system to work.
Next, we are going to assign the variable to a category.
We are going to give it its own category since it is important. Set Category to Checkpoints.
Click Compile.
Go back to LooptyLoopMap.
In the Details panel, there is a new Checkpoints section
with the Checkpoints array. It tells us, "You must assign all checkpoints from the level to the array."
Currently, Checkpoints is set to 0.
We are going to add all the checkpoints we want for our system to an array.
I will fly out. We can add several checkpoints along the map.
Once we have all the checkpoints we want,
in the Details panel, we will click + to add elements to the array.
Click + twice to add 2 elements to the array.
Click the element drop down,
and we can now select all of the checkpoints in the level.
Any checkpoint we place will be populated in this list.
We are doing this because we are defining the array in sequential order.
We have Element 0 and Element 1.
Element 0 is our first checkpoint.
Since we only have one checkpoint, it is going to select this Checkpoint.
If we had a second checkpoint over here, we would assign that as the second checkpoint.
We would continue doing this with all of the checkpoints.
We could have used
a Get All Actors of Class node,
which would automatically find all the checkpoints in the level
and automatically add that to an array for us.
The problem with doing it that way
is you are not guaranteed they will be added to the array in a consistent order.
That would be problematic. We would get all of the checkpoints,
but there is no guarantee it would put them in the sequential order we need
for our race to be successful.
Setting up the checkpoints this way is one quick step.
Once you have placed all the checkpoints, define them in the Details panel so they are in sequential order.
Then, you will be done. That is all you need to do.
I am going to delete the elements.
Click + once to add an element. Select Checkpoint.
This will add Checkpoint to the array.
We need to create another variable. We will create the functions, and then we will take a break.
In the My Blueprint tab, click +Variable.
Set Variable Name to "TotalCheckpoints".
We are going to use this variable to keep track of all the checkpoints are in the level
so we know how many checkpoints we have.
Uncheck the array icon for this. We do not need to make this an array.
Click the Variable Type drop down and select Integer.
We just need to know the number value.
We are going to use this variable to determine if we have completed a lap,
when the next checkpoint should be queued, etc.
This variable is not going to be publicly editable. We are going to use this variable for script later.
The last business we have to take care of before we break
is to create some functions we are going to use later when we start scripting.
Let's get those out of the way.
In the My Blueprint tab, click +Function. There we go.
Name this function "UpdateTimes".
We are going to add some script in this function that will pass
all of these float value custom settings
over to the MyPlayerController Blueprint with this function.
UpdateTimes is going to handle that for us.
Click +Function.
Name this function "LapCheck".
This function needs an input on it. Go to the Details panel under Inputs,
and click New.
Name this input "Checkpoint".
Click the Variable Type drop down and select Integer.
We are going to use this function to basically tell us
if we have passed the total number of checkpoints.
Each time we come into this function, we pass through the checkpoint we just crossed.
We are going to compare that number with the total number of checkpoints.
If the number equals the total number of checkpoints, that means we passed through the final checkpoint
and can signify having completed a lap.
We will add some more script to see if we passed and completed a lap.
We will set up script to determine what happens when we pass all of the checkpoints. Is the race over, etc.
We have two (2) more functions to create.
Let's create another function.
Name this function "ActivateCheckpoint".
As the name suggests, this function is going to queue up and activate the next checkpoint.
We need to tell the function which checkpoint to activate next.
In the Details panel under Inputs, click New.
Click the input drop down, type and select "Checkpoint".
Select the Checkpoint Blueprint.
Name this input "NextCheckpoint".
This is the next checkpoint to activate.
We will add the script a little bit later.
We need one more function. Click +Function.
Name this function "RaceCompleteCheck".
This function needs an output. In the Details panel, go to the Outputs section.
Click New.
Click the output type drop down and select Boolean.
Name this output "IsRaceComplete".
This function handles checking to determine if the race is complete.
If the race is complete, we are going to output that so we can
pass that along to the relevant Blueprints that we need to know.
With all of that, we are about 17 minutes into this video. Click Compile and click Save.
We are going to pause here.
In the next video, we will continue inside the Event Graph of the Tracker Blueprint.
We will set up all the script we need there.
In the following video,
we will set up all the functions and we should be able to test the system.
That is going to do it. In this video, we set up all the custom settings. We are ready to go.
In the next video, we will begin scripting.
Thank you all for watching. We will see you in the next video.
♪♪♪