1 of 39

Checkpoint Tracker Variables, Functions & Event Graph

Time Attack Racer

2 of 39

Youtube Video Tutorial Part 1

3 of 39

Checkpoint BP

In the previous presentation you set up your Checkpoint BP and have it displayed initially and then disappearing when you have passed through it in the correct direction. For testing purposes you unselected the Hidden In Game option for the Trigger box so that you could see it disappear. You now want to reselect that option as well as uncheck the option for Generate Overlap Events. You will call these into action using script as you continue to develop your game. Both of these can be found in the details panel when the Trigger component is selected. Before leaving this BP remember to Compile and Save!

4 of 39

Tracker BP

  • You first want to add a component to the BP by searching for ‘Billboard” this will provide you with a method of actually seeing your Tracker in the level.
  • Drag and drop the Billboard on top of the DefeaultSceneRoot effectively replacing it
  • Compile and Save!
  • Next in the level, drag the Tracker into the map and you will notice that when you rotate around it, the temporary 2D image of the dinosaur will always be facing you.

5 of 39

Tracker BP

Create 10 New Variables...

  • MaxLaps
    • Type: Integer
    • Check the box for Editable
    • Category: Custom Settings
  • GoldTime, SilverTime, BronzeTime, DefaultBestLap, DefaultBestTime
    • Type: Float
    • Check the box for Editable
    • Category: Custom Settings
  • NameOfMap
    • Type: Text
    • Check the box for Editable
    • Category: Custom Settings
  • SaveGameName
    • Type: String
    • Check the box for Editable
    • Category: Custom Settings
  • LevelMusic, CheckpointSoundFX
    • Type: search for “AmbientSound”
    • Select Reference
    • Check the box for Editable
    • Category: Custom Settings

6 of 39

Tracker BP

Set Default Values...

  • MaxLaps Default Value: 2
  • GoldTime Default Value: 60
  • SilverTime Default Value: 120
  • BronzeTime Default Value: 180
  • DefaultBestLap Default Value: 60
  • DefaultBestTime Default Value: 120
  • NameOfMap Default Value: Loopty Loop Map
  • SaveGameName Default Value: LL_SaveGame
  • Compile and Save!

You should now be able to see these values from within the level editor by selecting the Tracker component and locating the Custom Settings section in the Details panel.

7 of 39

Tracker BP

Import Audio files as a WAV format…

8 of 39

Tracker BP

In order to select the audio files we first need to drag them from the Content Browser into the level editor space. Try to locate them near the Tracker for simplicity. They will look like little speakers with a checkmark.

  • With the Tracker selected, set the Level Music and Checkpoint Sound.

9 of 39

Tracker BP

Go back to the Tracker BP…

  • Create a new Variable called “Checkpoints”
    • Type: search for “Checkpoint” and select Reference
    • Make it an Array by selecting the 9 squares
    • Check the box for Editable
    • Category: Checkpoints
    • Compile and Save!
  • In the Level Editor, with the Tracker selected, you should see this new category.�

This will allow you to add all of your checkpoints to the array and create the sequential order for how they should be completed. You will need to do this once you have placed all your checkpoints around the track!

10 of 39

Tracker BP

In the Tracker BP…

  • Create a new Variable called “TotalCheckpoints”
    • Type: Integer�

This will allow you to keep track of how many checkpoints are present within a level. You will use this to determine when you’ve completed a lap and when the next set of checkpoints should be queued up.

11 of 39

Tracker BP

In the Tracker BP…

  • Create a new Function called “UpdateTimes”
    • This will be used to pass all of the Custom Settings parameters on to the MyPlayerController BP
  • Create a new Function called “LapCheck”
    • Create a new Input called “Checkpoint”
      • Type: Integer
      • This will be used to keep track of when we have completed the total number of checkpoints.�

12 of 39

Tracker BP

In the Tracker BP…

  • Create a new Function called “ActivateCheckpoint”
    • This will be used to que up and activate the series of checkpoints
    • Create a new Input called “NextCheckpoint”
      • Type: search for “Checkpoint” and select Reference
  • Create a new Function called “RaceCompleteCheck”
    • Create a new Output called “IsRaceComplete?”
      • Type: Boolean
  • Compile and Save!�

13 of 39

Youtube Video Tutorial Part 2

14 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Make a reference to the MyPlayerContoler BP
    • Right click in the graph and search for “Get Player Controller”
    • Drag off the return value and search for “Cast To MyPlayerController” and connect it to the Event Begin Play node
    • Right click on the As My Player Controller pin and select Promote to Variable
    • Name this new variable “ControllerReference”

15 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Create a Custom Event called “ApplySettings”
  • Drag off the Set node from the previous step and search for “ApplySettings”�(This will take all of the custom settings you've created and pass them along to the player controller BP and have that called into action when you start the game)
  • Back on the ApplySettings event...
    • Create a Get reference to the Controller Reference variable
    • Drag off the Controller Reference variable and search for “Set Max Laps”
    • Create a Get reference to the MaxLaps variable and connect that to the green Max Laps Integer input pin on the Set node
    • Connect the Apply Settings event node to the Set node
    • Create a reference to the custom UpdateTimes function by dragging it into the event graph and connect the Set node to it
    • Drag off the Controller Reference variable and search for “Start Game Setup”
    • Connect the Update Times node to the Start Game Setup node

16 of 39

Tracker BP

In the Tracker BP Event Graph…

  • This is what the graph should look like as of now...

17 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Create a Custom Event called “StartSequence”
  • Drag off the ApplySettings node from the Event BeginPlay string and search for “StartSequence”
  • Back on the StartSequence event…
    • Create a Get reference to the Checkpoints array variable
    • Drag off the Checkpoints array variable and search for “ForEachLoop”
    • Connect the StartSequence node to the ForEachLoop node
    • Drag off the Array Index output pin and search for “+” and select Integer+Integer
    • Drag off the Array Element and search for “Set Checkpoint Number”
    • Connect the ForEachLoop node to the Set Checkpoint Number node
    • Connect the Integer+Integer node to Checkpoint Number input pin on the Set node

18 of 39

Tracker BP

In the Tracker BP Event Graph…

  • This is what the graph should look like as of now...

19 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Back on the StartSequence event…
    • Create a Get reference to the Checkpoints array variable (copy and paste from the last one)
    • Drag off the 2nd Checkpoints array variable and search for “Length”
    • Create a Set reference to the TotalCheckpoints variable
    • Connect the Set Checkpoint Number node to the Set Total Checkpoints node
    • Connect the Length node to the Set Total Checkpoints node

20 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Back on the StartSequence event…
    • Create a reference to the custom ActivateCheckpoint function by dragging it into the event graph and connect the Set Total Checkpoints node to it
    • Drag off the 2nd Checkpoints array variable and search for “Get”
    • Connect the Get node to the blue Next Checkpoint pin on the ActivateCheckpoint function node

21 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Back on the StartSequence event…
    • Create a Get reference to the Checkpoints array variable (copy and paste from the last one)
    • Drag off the 3rd Checkpoints array variable and search for “ForEachLoop”
    • Connect the ActivateCheckpoint function node to the 2nd ForEachLoop node
    • Drag off the Array Element and search for “Assign Checkpoint Cleared”
      • This comes with a 2nd custom event node!
    • Connect the 2nd ForEachLoop node to the Bind Event to CheckpointCleared node
    • Rename the new custom event “Checkpoint Cleared”

22 of 39

Tracker BP

In the Tracker BP Event Graph…

  • Back on the StartSequence event…
    • Create a Get reference to the LevelMusic variable
    • Drag off the LevelMusic variable and search for “Play (AudioComponent)”
    • Connect the Bind Event to CheckpointCleared node to the Play node

23 of 39

Tracker BP

In the Tracker BP Event Graph…

  • On the Checkpoint Cleared event…
    • Create a reference to the LapCheck function by dragging it into the graph
    • Connect the Checkpoint Cleared event node to the LapCheck function node with both an executable wire and green wire between Next Checkpoint and Checkpoint pins
    • Create a Get reference to the CheckpointSoundFX variable
    • Drag off the CheckpointSoundFX variable and search for “Play (AudioComponent)”
    • Connect the LapCheck node to the Play node
    • Create a Get reference to the ControllerReference variable
    • Drag off the ControllerReference variable and search for “Get Race Complete”
    • Create a Branch node, connect the Play node to it and connect the red Race Complete pin to the red Condition pin.
    • Drag off the ControllerReference variable and search for “Restart”
    • Connect the True executable pin of the Branch node to the Restart node

24 of 39

Tracker BP

In the Tracker BP Event Graph…

  • This is what the CheckpointCleared event should look like as of now...

25 of 39

Tracker BP

In the Tracker BP Event Graph…

  • This is what the entire event graph should look like as of now...

I forgot to make this connection before!

26 of 39

Youtube Video Tutorial Part 3

27 of 39

Tracker BP Functions

In the UpdateTimes Function Event Graph…

  • Create a Get reference to the ControllerReference variable
  • Drag off the ControllerReference variable and search for “Set Gold Time”
  • Drag off the ControllerReference variable and search for “Set Silver Time”
  • Drag off the ControllerReference variable and search for “Set Bronze Time”
  • Drag off the ControllerReference variable and search for “Set Default Best Lap Time”
  • Drag off the ControllerReference variable and search for “Set Default Best Race Time”
  • Drag in each variable that corresponds with the set nodes and connect them.
  • Connect the Update Times node to the Set Gold Time node and daisy chain the remainder of the set nodes from there.

28 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Create a new Local Variable called “LocalCheckpoint”
    • Type: Integer
  • Create a set node from the Local Checkpoint variable and connect it to the Lap Check node with both the executable wire and the green integer wire
  • Drag in a Get node for the TotalCheckpoints variable
  • Draf off the green pin of the set LocalCheckpoint node and search for “=”, select Equal (integer)
  • Connect the TotalCheckpoints node to the bottom of the equals node
  • Create a Branch node and connect the executable wire from the set LocalCheckpoint node to it
  • Connect the red condition output pin from the equals node to the red condition input pin of the Branch node

29 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Create a Get reference to the Checkpoints array variable
  • Drag off the Checkpoints array variable and search for “Get”
  • Create a Get reference to the LocalCheckpoint variable and connect it to the integer pin of the Get node
  • Drag in the Activate Checkpoint function node and connect it to False
  • Connect the output pin of the Get node to the Next Checkpoint input pin on the Activate Checkpoint function node

30 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Copy and paste this set of nodes…���
  • Disconnect the Local Checkpoint node
  • Drag off from it and search for “integer-integer”
  • Connect the - node to the Get node
  • It should now look like this…�����

This will reset the position of the vehicle to a previously completed checkpoint if the car gets flipped over.

31 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Drag off the Get node and search for “GetActor Transform”
  • Create a Get reference to the Controller Reference Variable
  • Drag off the Controller Reference node and search for “Set Respawn Location”
  • Connect the orange Return Value of the GetActor Transform node to the orange Respawn Location pin
  • Connect the Activate Checkpoint node to the Set Respawn Location node

This was all for the False branch, on the following slides we will set up the True branch.

32 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Drag in the Race Complete Check function node and connect the True branch to it
  • Create another Branch node
  • Connect both the executable and condition pins together
  • Create a Get reference to the Checkpoints array variable
  • Drag off the Checkpoints array variable and search for “Get”
  • Drag in the Activate Checkpoint function node and connect the Get node to it
  • Connect the False branch to the Activate Checkpoint function node

This will set up the True branch!

33 of 39

Tracker BP Functions

In the Lap Check Function Event Graph…

  • Create a Get reference to the Controller Reference variable
  • Drag off from there and search for “Update Lap”
  • Connect the Activate Checkpoint function node to the Update Lap function node
  • Connect the Update Lap function node to the orange Set Respawn Location node from the initial False branch
  • Connect the True condition of the 2nd Branch to the executable in of the Update Lap function node
  • After some rearranging this is how it should look when completed...

34 of 39

Tracker BP Functions

In the ActivateCheckpoint Function Event Graph…

  • Drag off the ActivateCheckpoint node and search for “Get Trigger”
  • Drag off the Trigger node and search for “Hidden In Game”
  • Connect the executable from the ActivateCheckpoint node to the Set Hidden In Game Node
  • Drag off the ActivateCheckpoint node and search for “Get Particle System” and connect it to the Set Hidden In Game Node
  • Drag off the Trigger node and search for “Set Generate Overlap Events”, you need to set it because by default it's turned off
  • Connect the executable from Set Hidden In Game to the Set Generate Overlap Events to create the loop and then check the box

This will activate the next checkpoint.

35 of 39

Tracker BP Functions

In the Race Complete Check Function Event Graph…

Make a comparison between the Actual Lap and Max Laps count and evaluate that with a Branch (True/False)

  • Drag in the Controller Reference variable and create a Get node
  • Drag off the Controller Reference and search for “Actual Lap”
  • Drag off one of the variables and search for “>=”
  • Connect both variables to the >= nodes
  • Create a Branch node

36 of 39

Tracker BP Functions

In the Race Complete Check Function Event Graph…

Use the Branch to trigger the Race Complete sequence when all laps are completed.

  • Drag in another Controller Reference variable and create a Get node
  • Drag off and search for “Set Race Complete” and then check the box
  • Connect the Set Race Complete to the True pin on the Branch node
  • Create a copy of the Set Race Complete and uncheck the box
  • Connect the 2nd Set Race Complete to the False pin on the Branch node
  • Connect the 2nd Controller Reference to the 2nd Set Race Complete

37 of 39

Tracker BP Functions

In the Race Complete Check Function Event Graph…

When need to connect both of the Set nodes from the previous step to the function output Return Node but can't do both at once so we will create a variable that can be set simultaneously.

  • Create a Local Variable called “LocalComplete” and make it a Boolean
  • Create two set nodes for this new variable and make the following connections�����
  • Create a Get node for the new variable and make the following connections

38 of 39

Tracker BP Functions

The Race Complete Check Function Event Graph should look like this when complete

39 of 39

Tracker BP Functions

Design your test lap by placing checkpoints in sequential order around the track.

  • Place as many checkpoints as you want
  • Line up your last checkpoint right behind the Player Start location
  • Select the Tracker and add them to the Checkpoint array in order
    • Checkpoint 2 was a music file for me so I didn’t include it in the array