LEGO® Quest System with NPC Behaviour
LEGO® Quest System with NPC Behaviour
A new sample project landing in UEFN brings a fully wired LEGO® quest system together with reactive NPC behaviour, giving you a reference-quality starting point for structured objective tracking and character interaction in LEGO® worlds. Rather than assembling these systems from scratch, you can study and strip-mine a project that already has the Verse-side quest orchestration, NPC state machines, and UI feedback integrated end-to-end.
What Changed
A sample project titled LEGO® Quest System with NPC Behaviour has been added to the UEFN sample library. The project ships with:
- Quest manager logic written in Verse — a coordinator device that tracks quest state (inactive → active → completed) and broadcasts progress to subscribing devices and UI elements.
- NPC behaviour trees expressed in Verse — characters that idle, detect the player, issue quest dialogue, and react to quest completion events, all driven by concurrent Verse tasks rather than Blueprint behaviour trees.
- LEGO® Prop and Character assets — pre-configured LEGO® meshes and rigs that are already referenced by the Verse devices, so the sample runs out of the box in a LEGO® world template.
- HUD / objective tracker — a Verse-driven UI layer that surfaces active objectives, completion counts, and reward state without requiring any additional Blueprint wiring.
The sample is accessible from the UEFN Content Browser → Samples panel and can be added directly to a new or existing LEGO® world project.
What You Can Build
1. Multi-Stage Quest Chains with Branching Completion
Before this sample, wiring a sequential quest chain meant hand-rolling event buses between multiple creative_device subclasses and managing shared mutable state carefully to avoid race conditions. The sample demonstrates a clean pattern using a central quest_manager device that owns all state and exposes typed interfaces:
# Simplified pattern derived from the sample
quest_manager := class(creative_device):
var ActiveQuest : quest_data = quest_data{}
var CompletedQuests : []quest_data = array{}
OnObjectiveComplete(Objective : objective_data) : void =
if (AllObjectivesMet[ActiveQuest]):
CompleteQuest(ActiveQuest)
AdvanceToNextQuest()
CompleteQuest(Quest : quest_data) : void =
set CompletedQuests = CompletedQuests + array{Quest}
QuestCompletedEvent.Signal(Quest)
You can extend this pattern to branch quest lines — signal different follow-up quests based on which objectives were satisfied and in what order, without rewriting the state machine from scratch.
2. Stateful NPCs That React to Quest Progress
The sample's NPC devices run concurrent Verse tasks that listen on shared events, letting a character's behaviour change dynamically as quest state evolves. You can adapt the pattern to build NPCs that have distinct pre-quest, mid-quest, and post-quest personalities:
npc_quest_actor := class(creative_device):
@editable QuestManager : quest_manager = quest_manager{}
OnBegin<override>()<suspends> : void =
race:
RunIdleBehaviour()
AwaitQuestActivation()
AwaitQuestActivation()<suspends> : void =
QuestManager.QuestActivatedEvent.Await()
RunActiveQuestBehaviour()
RunActiveQuestBehaviour()<suspends> : void =
loop:
# Poll player proximity, trigger dialogue, etc.
Sleep(0.5)
Because each phase is a separate suspending function, adding a new NPC state (e.g., "betrayal" after a failed quest) is a matter of inserting another race branch rather than refactoring a monolithic update loop.
3. Reward Delivery Tied to Quest Completion Events
The sample shows how to decouple reward logic from quest logic using Verse's event system, which means you can swap out reward types (XP, items, unlockable areas) without touching the quest manager. A reward handler device simply subscribes to the QuestCompletedEvent:
lego_reward_handler := class(creative_device):
@editable QuestManager : quest_manager = quest_manager{}
@editable RewardGranter : item_granter_device = item_granter_device{}
OnBegin<override>()<suspends> : void =
loop:
CompletedQuest := QuestManager.QuestCompletedEvent.Await()
if (CompletedQuest.RewardTier = reward_tier.Gold):
RewardGranter.GrantItem(GetPlayspace().GetPlayers()[0])
This subscriber pattern scales cleanly to multiple reward handlers listening on the same event — achievement unlocks, cinematic triggers, and leaderboard updates can all fire independently from the same completion signal.
References
References
Read this doc in Cortex → Original on Epic: https://dev.epicgames.com/community/snippets/o2KW/fortnite-lego-quest-system-with-npc-behaviourRelated
Open in graph →Related topics