Gameplay Events & Story Flags
Table of Contents
Gameplay Events
Gameplay code should not need to know which quests exist. It reports what happened once, and quests pick the events they care about. UPulseQuestEventSubsystem (world subsystem) is that channel.
UPulseQuestEventSubsystem::SendQuestEvent(this, TAG_Event_Enemy_Killed, KillerPawn, KilledEnemy, 1, EnemyTags);
In Blueprint use Send Quest Event (or Broadcast Quest Event with a full FPulseQuestGameplayEvent).
FPulseQuestGameplayEvent | Description |
|---|---|
EventTag | What happened, e.g. Event.Enemy.Killed.Wolf |
Instigator | Who caused it: pawn, controller or player state. Used to find the quest managers it counts for. Empty: counts for everyone |
Target | What it happened to, e.g. the enemy. Optional |
Count | How often, e.g. 3 items at once |
ContextTags | Extra tags, e.g. the kind of enemy or item |
Payload | Optional instanced struct |
Events are only handled on the authority; broadcast them on the server.
Who reacts
| Listener | Use |
|---|---|
Gameplay Event objective (UPulseQuestObjective_GameplayEvent) | “Kill 5 wolves”, “collect 3 herbs”: counts events into its progress. No Blueprint needed |
Any objective with bListenForQuestEvents | Override On Quest Event for own rules |
| Wait for Quest Event task | Wait in a quest or director state, without UI progress |
OnQuestEvent of the subsystem | Your own systems (achievements, tutorials, …) |
An event counts for a quest manager if its instigator belongs to it: the manager’s owner, its avatar, or an actor with the same controller (IPulseQuestManagerInterface::IsActorOfQuestManager). For shared quest hosts every player counts.
Story Flags
Story flags are gameplay tags on UPulseQuestManagerData: decisions and facts of the story (“spared the bandit”, “knows the secret passage”). They are replicated, saved and cleared by a reset.
| Where | Read | Write |
|---|---|---|
| Quest / director StateTree | Has Story Flag condition | Set Story Flag task |
| Quest conditions and rewards (and every other Pulse list) | Story Flags condition | Set Story Flags reward |
| Blueprint / C++ | HasStoryFlag, MatchesStoryFlags, UPulseQuestLibrary::HasStoryFlag | SetStoryFlag, SetStoryFlags, ClearStoryFlags (authority) |
| Dialogs (PulseDialogQuestBridge) | Story flag conditions in dialogs | Set Story Flag dialog task |
OnStoryFlagsChanged fires on the authority and on clients. Use a tag root such as Story. for the flags.
One story state
History, story flags and the tracked quest are one struct, FPulseQuestStoryState (Get Story State), replicated as one property and saved as versioned bytes. Its rules are pure functions (Pulse::Quest::Story): every change is planned on a copy and applied in one step, then one event fires per part that changed, in the order history, flags, tracked quest. Setting a value that is already set fires nothing. A finished quest changes history and tracked quest together, so OnQuestHistoryChanged already sees the finished quest untracked; a reset clears all three parts in one step; a load fires only the events of the parts it changed. Clients fire the same events when the state replicates.
Tracked Quest
UPulseQuestManagerData also stores the quest the player tracks (SetTrackedQuest, authority, replicated, saved). It is cleared when the quest finishes. The view models expose it as TrackedQuest.