This guide will walk you through the process of setting up the Bloodstain Replay system on a basic Character using Blueprints.
Prerequisite: This guide is based on the standard Third-Person Template in Unreal Engine 5.6.
1. Open Your Player Character Blueprint
First, open your primary player character Blueprint. For this guide, we will use BP_ThirdPersonCharacter
.
2. Get the Bloodstain Subsystem
In the Event Graph, get a reference to the Bloodstain Subsystem
. This subsystem is the main entry point for all recording and playback functionality.
3. Wire Up the Core Functions
For this basic setup, we will trigger the core functions using keyboard inputs. Connect the Start Recording
, Stop Recording
, and Spawn All Blood Stains in Level
nodes to key press events.
Pro Tip: In a real project, you would trigger these functions from game events, such as
Event OnDied
for stopping a recording, orEvent OnPlayerSpawned
for spawning existing stains.
The default recording settings capture the last 5 seconds at 10 FPS. These can be configured in the Record Options
struct.
The default playback settings are 1x speed with looping disabled. These can be configured in the Playback Options
struct.
4. Create a BloodStain Variable
To handle interaction, we need a variable to store a reference to the bloodstain actor the player is currently overlapping. Create a new variable named BloodStainActor
of type BP_BloodStainActor
(Object Reference).
5. Detect Overlaps with Bloodstains
Use the Event ActorBeginOverlap
and Event ActorEndOverlap
events to manage the BloodStainActor
variable.
- When the player overlaps with a
BP_BloodStainActor
, set theBloodStainActor
variable. - When the player stops overlapping, clear the variable by setting it to
null
.
6. Set Up the Interact Logic
Create an input event (e.g., the ‘F’ key). When pressed, check if the BloodStainActor
variable is valid. If it is, call the Interact
function on it to trigger the replay.
7. Test the Interaction
After recording and spawning the bloodstains, walk into the trigger volume of a spawned stain. An interaction prompt should appear.
8. Trigger the Replay
Press the interact key (e.g., ‘F’). The replay of the recorded actor’s final moments will now play.