I’m working on a story-driven game in Unreal Engine 5 and currently using multiple trigger boxes to activate events such as dialogue, sound effects, and character appearances.
However, I’m facing a problem where the player might activate triggers out of order, which could break the story sequence.
Here’s an example of what I want:
Trigger 1: Footsteps sound plays
Trigger 2: Lights turn off → but only if Trigger 1 has already been triggered
So, I want to enforce a specific sequence of trigger boxes.
What is the best way to manage this kind of conditional flow in UE5?
As the number of triggers increases, I want to avoid things getting too messy.
Is there a scalable or clean way to implement ordered trigger-based events like this?
Hey there @e7de84f7c71249dc8a21a7d1f05899f3! Depending on the scope of the project, personally I would likely look to create a Game Instance Subsystem as a story manager to manage the flags that have been triggered and to keep the data persistent.
Then depending on if all of your story beats are sequential or not, I’d make an enum to define the states, then call to the story manager to ask “Can I fire yet?” and have the manager decide based on the state at the time. Alternatively I would have a data asset to hold the flags themselves and have the story manager check them directly.
Basically - you need bind to the delegate at the right moment (step by step).
And don’t forget to unbind after triggering.
All quest systems are based around this, just in a more convenient form.
Considering the next steps, such as implementing a save system and managing transitions between levels,
would it be better to move this logic into the Game Instance instead?
Also, could you give some advice on how to best manage the Blueprint nodes for this system?
Plugins are a good solution.
If they don’t suit you, you need your own “quest manager” system.
It essentially consists of two base classes - a manager that creates task objects, and tasks themselves, which have a delegate that will inform the manager that the step has been completed.
The implementation is simple and eliminates the need to copy similar things. But for the same reason, you are limited in the ability to make changes for each individual task.
Don’t worry. By the end of the project it will look like a dump. Don’t rush it.
If you plan to add the ability to save anywhere - then you will have big problems without using C++.
The more you want to save, the bigger the problem.
thank you so much for explaining it so kindly! I’m still a beginner and my project is small-scale, so I’ll try it out first. If I run into any issues, I’ll consider other methods later!
I agree with Pred! It will be a bit harder without C++, especially when working with data or persistent objects. If you can only work with BP, you can do most of this inside the Game Instance itself, but be wary it will be very cluttered by the end of your project.