Objectives
Table of Contents
- Overview
- Lifecycle
- Key Properties
- Save Identifier System
EPulseObjectiveNetMode- Blueprint API
UPulseObjectiveTaskEPulseObjectiveCompletionStatusFPulseQuestObjectiveAddParams
Overview
UPulseQuestObjective is the base class for all quest objectives. Each objective is a UObject subobject whose outer is the quest-manager object (UPulseQuestManager component or APulseSharedQuestHost actor).
Objectives exist only while active. They are destroyed when stopped.
Lifecycle
StartObjective (server)
↓
Init(QuestManager, QuestData, Params)
– Load save record if bLoadedFromSaveGame
– Bind to QuestData.OnStopped
– Create ViewModel if class is set
↓
Start()
– Server: ActivateGameplayTask if task class is set
– Client: OnClientStart()
↓
[ Running – game logic calls Progress / Complete ]
↓
Finish(EPulseObjectiveCompletionStatus) [server or client with authority]
– Notify QuestData
– Deactivate task
– OnCompleted / OnFailed / OnStopped Blueprint event
↓
StopObjective → removed from manager
Key Properties
| Property | Type | Description |
|---|---|---|
UniqueSaveIdentifier | FName | Must be unique within the quest. Used as save/load key. |
ObjectiveClass | TSubclassOf<UPulseQuestObjective> | Concrete type to instantiate |
NetMode | EPulseObjectiveNetMode | How this objective is replicated |
ObjectiveTaskClass | TSubclassOf<UPulseObjectiveTask> | Optional Gameplay Task class |
ViewModelClass | TSubclassOf<UMVVMPulseObjective> | Optional MVVM ViewModel class |
StartIfCompletedAtSave | bitmask | Which completion statuses allow restart on load |
Save Identifier System
The UniqueSaveIdentifier must be unique within a single quest (not globally). Internally the system builds a combined key:
CombinedID = QuestTag.GetTagName() + "." + UniqueSaveIdentifier
EPulseObjectiveNetMode
| Value | Behavior |
|---|---|
ServerOnly | Created and ticked only on the server |
ServerAndOwner | Created on server; replicated via subobject to the owning client |
ServerAndAll | Created on server; replicated to all relevant clients (Shared quest) |
Blueprint API
UPulseQuestObjective overridable events
K2_OnInit() – Implement custom initialization
K2_OnStart() – Called when the objective starts
K2_OnStop(Status) – Called when the objective finishes
K2_OnLoadedFromSave(Record) – Restore progress from a save record
K2_OnClientStart() – Client-only start notification
K2_OnClientStop(Status) – Client-only stop notification
Query helpers
GetQuestManager() → TScriptInterface<IPulseQuestManagerInterface>
GetQuestData() → UPulseQuestData*
GetQuestTag() → FGameplayTag
GetSaveIdentifier() → FName
IsFinished() → bool
GetFinishStatus() → EPulseObjectiveCompletionStatus
IsLoadedFromSave() → bool
GetObjectiveViewModel() → UMVVMPulseObjective*
UPulseObjectiveTask
Extends UGameplayTask. Attach one per objective to drive progression with Gameplay Task machinery.
| Override | Purpose |
|---|---|
Activate() | Start task logic (subscribe to delegates, timers…) |
OnDestroy(bInOwnerFinished) | Clean up before task is GC’d |
TickTask(DeltaTime) | Per-frame update (opt-in: bTickingTask = true) |
Inside your Task:
void UMyObjectiveTask::Activate()
{
Super::Activate();
// Register delegates, start timers, etc.
}
// When the player satisfies the objective:
void UMyObjectiveTask::CompleteTask()
{
if (UPulseQuestObjective* Outer = GetObjective())
{
Outer->CompleteObjective(); // Finishes with EPulseObjectiveCompletionStatus::Completed
}
EndTask();
}
EPulseObjectiveCompletionStatus
| Value | Meaning |
|---|---|
None | Objective is still active |
Completed | Objective succeeded |
Failed | Objective failed |
Stopped | Objective was stopped externally |
FPulseQuestObjectiveAddParams
Used internally by StateTree tasks or C++ code to start objectives:
FPulseQuestObjectiveAddParams Params;
Params.ObjectiveClass = UMyObjective::StaticClass();
Params.QuestTag = MyQuestTag;
Params.SaveID = FName("CollectSamples");
Params.NetMode = EPulseObjectiveNetMode::ServerAndOwner;
FPulseObjectiveHandle Handle = Manager->StartObjective(Params);