Objectives
Table of Contents
- Overview
- Ready-made Objectives
- Lifecycle
- Key Properties
- Progress, Display Text and Markers
- Save Identifier System
EPulseObjectiveNetMode- Blueprint API
- Gameplay Tasks
FPulseQuestObjectiveAddParams
Overview
UPulseQuestObjective (abstract, Blueprintable) is one piece of work inside a quest: “collect 5 herbs”, “talk to the guard”. Objectives are usually started by the Quest Objective StateTree task of the quest, or by StartObjective on the quest manager. They belong to a quest and are stopped when the quest ends.
Ready-made Objectives
These classes work without a Blueprint subclass. Set them in the Quest Objective task and configure them there (DisplayText, TargetProgress, Targets) or in a Blueprint subclass.
| Class | Completes when | Settings |
|---|---|---|
Gameplay Event Objective (UPulseQuestObjective_GameplayEvent) | TargetProgress matching gameplay events arrived | EventTag, bExactMatch, ContextTagQuery, TargetClass, bUseEventCount |
Reach Location Objective (UPulseQuestObjective_ReachLocation) | An avatar of the manager is at a target (all avatars with bRequireAllAvatars) | Targets of the task, else actors with TargetActorTag and the places of the Pulse Sim records in TargetRecordIds (found while nothing of them is loaded), else DefaultTargets; AcceptanceRadius, CheckInterval |
Timer Objective (UPulseQuestObjective_Timer) | Duration seconds passed (success, or failure with bFailWhenTimeIsUp) | Progress counts seconds of the Pulse game clock (it pauses with it and runs out when the clock jumps past the end), elapsed time is saved; the tuning knob Pulse.Tuning.Quest.TimeLimit scales the duration (GetDuration, the quest tag in the tags), a change applies at once |
Wait For Input Objective (UPulseQuestObjective_WaitForInput, abstract) | The local player triggered InputAction TargetProgress times | InputAction, TriggerEvent |
Pulse Message Objective (UPulseQuestObjective_Message) | The messages of a trigger added up to TargetProgress | Trigger, ProgressMode, bOnlyPlayersOfQuest (category Trigger) |
Reach Attribute Value Objective (UPulseQuestObjective_AttributeValue) | An attribute of an avatar of the manager is at least or at most a value (all avatars with bRequireAllAvatars) | Attribute, Goal, Value, bPercent, bRequireAllAvatars, bShowProgress (category Attribute) |
Attribute Depleted Objective (UPulseQuestObjective_AttributeDepleted) | Attributes ran out Count times, or fails when one runs out | Attribute, Subject, Conditions, bOnlyCausedByQuestPlayers, bCountEachActorOnce, Outcome, Count (category Attribute) |
Example: “Kill 5 wolves” is a Gameplay Event objective with EventTag = Event.Enemy.Killed.Wolf and TargetProgress = 5, and the enemy calls Send Quest Event when it dies.
Pulse Message Objective
Counts messages of the PulseFoundation message bus, so any plugin can drive a quest without a bridge: items gathered (Pulse.Message.Inventory.ItemAdded), enemies killed (Pulse.Message.Combat.Died), villagers talked to (Pulse.Message.Interact.Completed), skills learned. Trigger is a message trigger of PulseFoundation: the channel, conditions on the context of the message (“the item has the tag Wood”) and the value (ValuePath, empty for the amount of the context).
| Setting | What it does |
|---|---|
Trigger | The messages that count (channel, match, conditions, value path) |
ProgressMode | Value: a message adds its value (3 wood gathered add 3). Count: every message adds 1 (talking to 3 villagers) |
bOnlyPlayersOfQuest | Only messages about the players of the quest manager count (the Player of their context); messages without a player count for everyone |
Only the authority counts; clients get the replicated progress. Values below 1 add up until they make a whole unit (saved with the objective). Set the trigger in a subclass (Blueprint or C++). Objective templates in C++ build it from fields of their own (“Enemy Tags”, “Count”): they override BuildTrigger (the trigger that is bound when the objective starts and checked by IsDataValid; default: Trigger) and hide the category Trigger with HideCategories. Count Message (BlueprintNativeEvent) decides for each message whether and how much it counts.
Attribute objectives
Two objectives follow attributes (health, stamina, hunger, strength: the Pulse.Stat.* tags) through the attribute contract of PulseFoundation, so they work with the Pulse Attributes component and with GAS without a bridge. Both run on the authority only; clients get the replicated progress and result.
Reach Attribute Value completes when an avatar of the quest manager (the pawn of the player, the pawns of a party; every one with bRequireAllAvatars) reaches a value: “reach 10 strength”, “rest until your stamina is full” (bPercent, Value 1), “eat until your hunger is down to 20” (Goal AtMost).
| Setting | What it does |
|---|---|
Attribute | The attribute (Pulse.Stat.*) |
Goal | AtLeast: the value or above it. AtMost: the value or below it |
Value | The value to reach; with bPercent a part of the range from 0 to 1 ((Value - Min) / (Max - Min)) |
bRequireAllAvatars | Every avatar must reach it (party quests); else one is enough |
bShowProgress | AtLeast only: the whole units of the attribute (percent points with bPercent) up to Value are the progress, “Strength {Progress}/{Target}” |
It checks when it starts (a value reached already completes it at once, also after a load), after every event of an attribute source of the quest players (a change, a band, a modifier, a new source after a respawn) and when a rate gets there: rates move a value without a change event, so the objective sets a timer on the Pulse game clock for the time the rate needs. It has no tick. The progress follows the events; while a rate runs it shows the value of the last event. Is Goal Reached (BlueprintNativeEvent) gets the attribute of each avatar for rules of your own.
Attribute Depleted counts attributes that run out (reach their minimum; the Depleted event of the contract): “break 3 crates” (health of other actors), “exhaust the ogre” (its stamina), “run out of stamina once” (a tutorial), or a fail condition: “do not let your oxygen run out”.
| Setting | What it does |
|---|---|
Attribute | The attribute (Pulse.Stat.*); Pulse.Stat.Health for things that break or die |
Subject | QuestPlayers: the players of the quest manager (their pawns or player states). OtherActors: every other actor with an attribute source |
Conditions | Conditions on the context of the depletion: Target is the actor whose attribute ran out, Instigator who caused it (“Actor Has Tags” on Target for crates only). Empty: every actor of the subject |
bOnlyCausedByQuestPlayers | OtherActors only: the instigator of the change must be a quest player (the player broke the crate) |
bCountEachActorOnce | An actor counts once while the objective runs, also when its attribute fills and runs out again (default on; not saved) |
Outcome | Progress: each depletion adds 1, the objective succeeds at Count. Fail: the first depletion fails the objective |
Count | How many depletions complete it (Outcome Progress) |
Only depletions while the objective runs count. A value that was loaded or replicated empty only catches up with an earlier state (CatchUp of the context) and does not count. Count Depleted (BlueprintNativeEvent) decides for each depletion whether it counts. Enemies of Pulse Gameplay combat can also be counted by their death message with Defeat Enemies of PulseQuestGameplayBridge; a downed enemy has empty health but is not dead.
The rules are pure functions in Pulse::Quest::Attributes (Quest/Objectives/PulseQuestAttributeObjectiveTypes.h): IsReached, GetSecondsToReach, GetValueProgress.
Lifecycle
| Step | Function | Notes |
|---|---|---|
| 1 | Init Objective (BlueprintNativeEvent) | On the authority: return InProgress to run, any other status finishes it without starting. Also called on clients (result ignored) |
| 2 | Pre Load Objective / Post Load Objective | Only when saved data for the objective exists (after a load) |
| 3 | Objective Started | The objective runs. Bind to gameplay here |
| 4 | Tick | Only if implemented (Blueprint) or bWantsTick (C++) |
| 5 | Complete Objective(Mode) | Authority only: Success, Failure or Stopped |
| 6 | Objective Completed | Gameplay tasks of the objective are ended |
| – | Cleanup | The objective is removed without completing (reset, manager cleanup). Gameplay tasks are ended |
Complete Objective may be called from Objective Started (e.g. when the goal is already reached); the completion is applied right after the start is handled. When the quest ends, all of its running objectives end with Stopped.
Events: OnObjectiveStarted / OnObjectiveCompleted, OnProgressChanged and OnDisplayChanged on the objective, and the objective events of the quest manager and of the quest data.
Blueprint: A Blueprint objective
- Create a Blueprint class of
Pulse Quest Objective, setSave ID(unique within the quest). - Add a variable
Collected(Integer), in its details enableSaveGame, so it is saved with the quest. - Override
Objective Started→ bind to your gameplay (e.g. an item pickup event onGet Avatar Actor). - On pickup:
Collected+ 1 → ifCollected>= 5 →Complete Objective(Mode =Success). - Override
Cleanup→ unbind whatObjective Startedbound.
Key Properties
| Property | Description |
|---|---|
SaveID | Identifier of the objective inside its quest. Can be overridden by the task; generated by the task if empty |
bShouldBeSaved | Whether the objective is saved |
StartIfCompletedAtSave | Which saved results (Stopped, Failure, Success) still start the objective again after loading. Default: Stopped or Failure |
NetMode | ServerAndClient (replicated) or ServerOnly |
DisplayText | Text for the UI (start value). May use {Progress} and {Target}. Blueprint reads return the current text |
TargetProgress | Target of the progress (e.g. 5 herbs, start value). 0 = no progress. Blueprint reads return the current target |
bCompleteOnTargetProgress | Complete with success when the progress reaches the target (default true) |
bOptional / bHidden | UI hints: optional objective, objective not shown |
Read with the getters: Get Objective State (all of it), Get Progress, Get Completion Status, Get Targets, Get Custom State.
The state of an objective
Handle, quest, run, status, progress, text, targets and the own state are one struct, FPulseObjectiveState. While the objective runs, the state belongs to its quest manager: the runtime entry of the objective owns it and copies it into the replicated objective list, the objective reads it from there. Before the objective is registered and after it was removed (also objects created outside a quest manager), the objective keeps the state itself, so code that holds it after On Objective Completed still reads its final state. DisplayText and TargetProgress are the authored start values: their Blueprint variable reads return the current value, C++ reads of the members return the start value (use GetDisplayText / GetTargetProgress for the current one).
Progress, Display Text and Markers
An objective with TargetProgress > 0 counts progress, e.g. “Collect {Progress}/{Target} herbs”. Change it on the authority with Set Progress, Add Progress or Set Target Progress; the values replicate, are saved and raise OnProgressChanged on every machine. When the progress reaches the target and bCompleteOnTargetProgress is set, the objective completes with success.
The rules are pure functions in Pulse::Quest::Progress (Quest/State/PulseObjectiveState.h), the objective only applies their result:
- The progress is never below 0 and, with a target, never above it. Without a target it has no upper bound.
Add Progressadds saturating (no overflow), then the same clamping.Set Target Progressdoes not clamp a progress that is already above the new target.- Setting the same value again changes nothing and fires no event.
Targets (FPulseQuestObjectiveTarget: actor or location, radius) are replicated markers for the UI (compass, map). Set them with Set Targets, Add Target Actor, Add Target Location, Clear Targets, or pass them in the Targets of the Quest Objective task. The view model exposes them.
Save Identifier System
- The save id must be unique inside the quest; other quests can use the same id.
- The Quest Objective task uses, in this order: its
SaveID, theSaveIDof the class, an id generated from its state and the objective class. Generated ids survive renaming and moving states. - The same objective class twice in one state needs explicit save ids; the StateTree validator reports it.
- PulseQuest saves the progress, the target and the own state of the objective (
MakeCustomStatein C++,Get Custom State/Set Custom State, an instanced struct) as versioned state bytes. The timer and the message objective keep their counters there (FPulseQuestTimerObjectiveState,FPulseQuestMessageObjectiveState). Use an own state struct for what your objective counts; variables with theSaveGameflag of your objective classes are still saved next to it. Saved objectives are loaded afterInit Objectiveand beforeObjective Started. - The saved records are read and checked when the load starts (a corrupt record refuses the load). The class of a started objective comes from its task, so a saved record loads into it even when the class was renamed: a class mismatch of the
SaveGamevariables is only a warning. - The quest data remembers finished objectives of the current run by save id. When the quest runs again from a saved state, finished objectives are skipped unless
StartIfCompletedAtSaveallows them.
EPulseObjectiveNetMode
| Mode | Behavior |
|---|---|
ServerAndClient | Replicated to the clients of the manager. The objective can use RPCs (routed through the manager’s actor) |
ServerOnly | Exists only on the authority |
Use Has Authority and Is Locally Controlled inside the objective to split logic.
Blueprint API
| Node | Description |
|---|---|
Complete Objective(Mode) | Completes the objective (authority) |
Set Progress / Add Progress / Set Target Progress / Set Display Text | Authority |
Set Targets / Add Target Actor / Add Target Location / Clear Targets | Authority |
Get Objective State / Get Progress / Get Completion Status / Get Targets / Get Custom State | Read the state |
Set Custom State | Own state of the objective class (authority, saved) |
Get Quest Manager / Get Quest Data | Owner and quest data |
Get Owning Actor / Get Avatar Actor / Get Quest Avatars | Gameplay task owner and avatars (all players of a shared quest) |
Has Authority / Is Locally Controlled | Net helpers (Is Locally Controlled is always false in shared quests) |
Get Unique Save Identifier | The save id |
Blueprint: Start an objective from Blueprint
Make PulseQuestObjectiveAddParams→Objective Class= your objective class,Quest Tag= the running quest. OptionalShould Be Saved.Start Objective(Target = quest manager) →Return Valueis the objective handle (invalid if the quest is not active).- Later:
Get Objective(Handle) →Complete Objective.
Gameplay Tasks
Objectives are gameplay task owners (the tasks component of the manager is used). Tasks end when the objective completes or is cleaned up. UPulseObjectiveTask is a base class for tasks of objectives; create them with UPulseObjectiveTask::NewObjectiveTask<T>(Objective). Wait Input for Gameplay Task waits for an Enhanced Input action.
Blueprint: Wait for an input inside an objective
- In the objective:
Objective Started→Wait Input for Gameplay Task(Input Action = your action, Task Owner = self). On Input Received→Complete Objective(Mode =Success).- The task ends automatically when the objective completes.
Wait For Input Objective (tutorials)
UPulseQuestObjective_WaitForInput (abstract, create a Blueprint subclass) waits until the local player triggers InputAction with TriggerEvent. Each trigger adds 1 progress (TargetProgress defaults to 1); override On Input Received for other rules. The input is bound on the locally controlled machine and sent to the server with a server RPC, so the objective needs NetMode ServerAndClient and a quest manager owned by the player. It does not work with a shared quest host.
FPulseQuestObjectiveAddParams
| Member | Description |
|---|---|
ObjectiveClass | Class of the objective |
SaveID | Overrides the save id of the class |
ShouldBeSaved | Default (use the class), True or False |
DisplayText | Overrides the display text of the class (empty = class value) |
TargetProgress | Overrides the target progress of the class (0 = class value) |
Targets | Marker targets (empty = class value) |
QuestTag | Active quest the objective belongs to |
OnAdded | C++ delegate. Only called if StartObjective returned a valid handle: InProgress when it runs, another status if it did not start |