Language:
Page Info
Engine Version:

Calling Events through Sequencer

Choose your OS:

When playing a cinematic through Sequencer, there may be instances when you want to fire off an Event that initiates some scripted functionality. Perhaps at a certain point in your cinematic you want a door to open, a particle effect to spawn in and play or affect the Player in some way. With the Event Trac****k you can key the exact frame in the cinematic you want your Event to be called. You can then use a**Director Class Blueprint to provide the scripted functionality you want to occur using the Event Endpoint**.

In this guide, we use an Event Track to print text to the screen indicating our character is dead. At the same time, we disable player movement and simulate physics on the character.

Steps

For this guide we are using the Blueprint Third Person Template project.

  1. From the Main Toolbar, click the Cinematics button and select Add Level Sequence with any name and save location.
    UsingEventTracks_01.png

  2. In the Details panel for the Level Sequence, enable the Auto Play option. 
    UsingEventTracks_02.png

  3. Select the ThirdPersonCharacter in the Level, then add it to Sequencer from the + Track button. 
    NewEventTrack_03.png

  4. Right-click on the ThirdPersonCharacter in the Level, then select Edit ThirdPersonCharacter
    NewEventTrack_04.png
    Inside the Third Person Character Blueprint, we will add a Custom Event that will be called from Sequencer. 

  5. Right-click in the Event Graph and search for then add a Custom Event
    NewEventTrack_05.png

  6. Call the Custom Event KillPlayerText and connect a Print String node with the text Kill My Player! as the String. 
    NewEventTrack_06.png
    In this example we are printing text to the screen when the Custom Event is called. You can provide any scripted functionality you wish and connect it to the Custom Event for it to be executed when it is called from Sequencer.

  1. In Sequencer, click the + Track button on the ThirdPersonCharacter track and select Event
    NewEventTrack_07.png

  2. Move the Timeline to frame 60, then click the + sign for the Events track to add an Event Key. 
    NewEventTrack_08.png

  3. Right-click on the new keyframe, then under Properties, click Unbound and select Create New Endpoint
    NewEventTrack_09.png

You are then presented with a new Director Class Blueprint. 

Click image for full view.

In the Director Blueprint, you can provide the scripted functionality you want to occur for a given target (or targets). You can also use the Director Blueprint to call a Blueprint Interface  that other Blueprints implement and in turn execute when getting the call. 

Please see Event Track OverviewNEW! for more information.

  1. In the My Blueprint panel, change the name of the function to PrintKillPlayer and off the Target pin, call Kill Player Text. NewEventTrack_10.png
    This example targets the ThirdPersonCharacter Blueprint. We can also change the Target type which will give us access to functions related to the Target type we specify. 

  2. In Sequencer for the ThirdPersonCharacter Track, add CharacterMesh0
    NewEventTrack_11.png

  3. For CharacterMesh0, click the + Track button and add an Event track. 
    NewEventTrack_12.png

  4. Add a key at frame 60 for the Events track, then right-click on it and under Properties > Create Quick Binding, select SetAllBodiesSimulatePhysics
    NewEventTrack_13.png
    Since object binding for this Event Track is a Skeletal Mesh Component, we now have access to Quick Bindings related to Skeletal Meshes. Selecting this function will automatically add the node to the Event Endpoint and open the graph. 

  5. Set New Simulate to enabled, then add a Set Collision Enabled node with Collision Enabled (Query and Physics) as the New Type
    NewEventTrack_14.png
    This will instruct the Skeletal Mesh to simulate physics and will turn on collision so it will not fall through the floor. 

  6. In Sequencer, for ThirdPersonCharacter click the + Track button and add a CharMoveComp track. NewEventTrack_15.png

  7. Add an Event Track for CharMoveComp and an Event key at frame 60 with a Quick Binding to call DisableMovement. NewEventTrack_16.png
    Here we are targeting the Character Movement Component and using an Event to disable the ability to move around while the character is simulating physics. 

  8. Click the Play button to Play in the Editor.

End Result

When you play in the Editor, after a few moments, text will appear in the upper-left corner of the window and the character will fall to the ground with your ability to move disabled. 

Adding an Event Track to an Object within Sequencer creates an Object Binding where you can call Events, Functions or access properties of the Object that you are bound to. Event Tracks can also be used to execute script within the Level Blueprint, UI Widget Blueprints, or communicate with multiple Blueprints through a Blueprint Interface. 

See Event Track OverviewNEW! for more information.