Quest Director
Table of Contents
Overview
A director decides which quests run, e.g. the main story with its branches. It is optional; set QuestDirectorClass in the manager parameters. The director exists only on the authority and is saved with the quest manager.
Every tick (every TickFrequency seconds, or every frame with bTickEveryFrame) the director fills a FPulseQuestDirectorContext with the wanted state of quests, then Resolve applies it:
EPulseQuestDirectorState | Quest running | Quest not running |
|---|---|---|
Active | stays active (the director takes it over if another system started it) | is started |
Succeeded | ends with Success | stays inactive |
Failed | ends with Failure | stays inactive |
Stopped | ends with Stopped | stays inactive |
Rules:
- Quests the director started and that are missing from the context are stopped, so an active quest must be set to
Activeon every tick. - A quest of the director that finished on its own is not started again while the director keeps wanting it
Active. It can be started again after the director wanted another state for it once. The same applies to a quest that could not be started (the reason is logged once). - The director starts quests with
bIgnoreConditionsand ownerDirector: it decides about the story itself. Use the Quest Finished, Has Story Flag and Can Start Quest conditions to branch.
UPulseQuestDirector
Abstract, Blueprintable.
| Member | Description |
|---|---|
bTickEveryFrame / TickFrequency | Evaluation rate |
Initialize / Cleanup (C++ and Blueprint events) | After creation, reset and load / before reset, load and end |
Tick (C++ Tick, Blueprint event Tick) | Set quest states into the context |
Set Quest State in Context | Blueprint helper to set a quest state in the context |
Force Tick | Evaluate in the next frame regardless of TickFrequency |
Get Quest Manager | Owning quest manager |
ActiveQuests | Quests started (or taken over) by this director |
OnQuestManagerLoaded (C++) | After a load, before Initialize |
Blueprint: A Blueprint quest director
- Create a Blueprint class of
Pulse Quest Director, setTick Frequency, and put it intoQuest Director Classof the quest manager. - Override
Tick→ for every quest that should run:Set Quest State in Context(Context = theContextpin, Quest Tag, New State =Active). - To finish a quest:
Set Quest State in ContextwithSucceeded,FailedorStopped(or just stop setting it: missing quests are stopped). Force Tickevaluates the director in the next frame, e.g. after a story flag changed.
UPulseQuestStateTreeDirector
Runs a StateTree with the Pulse Quest Director schema (StateTreeAsset). Create a Blueprint of the class, assign the StateTree and set the Blueprint as director class.
| Property | Description |
|---|---|
StateTreeAsset | The director StateTree |
LoadBehavior | LoadSavedState (continue in the saved state) or Restart (start from the first state) |
bStopQuestsWhenTreeFinishes | If true, all quests of the director stop when its StateTree finishes. Default false: they keep running |
bTickEveryFrame / TickFrequency | Default every frame. A longer interval saves time with large trees |
Use the Set Quest State task in states:
| Parameter | Description |
|---|---|
QuestTag | Quest to control |
StateToSet | Active keeps the quest running while the state is active. Succeeded / Failed / Stopped end it and finish the task |
StateToSetOnExit | For Active: result the quest gets when the state is left while the quest still runs |
StoppedResult | Whether a quest that ends with no result finishes the task with success or failure |
With StateToSet = Active the task finishes with the result of the quest when the quest ends by itself, so transitions can react to the outcome (“On State Succeeded” / “On State Failed”).
Blueprint: StateTree director state
- Create a Blueprint class of
Pulse Quest State Tree Directorand assign a state tree with thePulse Quest Directorschema. - In a state: task
Set Quest State(Quest Tag, State To Set =Active, State To Set On Exit =Stopped). - Transition on
Succeeded/Failedof the task to the next story state.
The Pulse Quest Director Extension (StateTree editor data extension) is deprecated. If a StateTree still has it, its Load Behavior wins over the property of the director.
Save and Load
UPulseQuestDirectorsaves the quests it runs; the StateTree director also saves its active state (by state id, with the state path as fallback, so renaming or moving states keeps saves working).- Every saved quest remembers who started it (
EPulseQuestOwner). After a load the manager restarts the quests of the player and of other quests itself; the director restarts its own quests when it wants themActiveagain. Loaded quests the director does not want back in its first tick are not restored later. - The StateTree director continues in the saved state (unless
LoadBehaviorisRestart). The transition is applied right away, so the quests of the first state are not started for one tick. - A reset restarts the director from the beginning. A failed load restarts it too.