The Quest is the interface for a user’s progress in a Quest.
public class Quest : Sansar.Script.InstanceInterfaceRemarks
Each instance of Quest is generated from a QuestDefinition and is associated with a specific user, represented by a SessionId. It can be used to offer the quest to that user, and to track and control their progress through the quest.
Members at a glance
| Kind | Members |
|---|---|
| Properties | Agent · Definition · Objectives · Ready |
| Methods | GetState · Offer · SetState · Subscribe · ToString · Update |
Properties
Agent
public Sansar.Script.SessionId Agent { get; }The session Id for the user on this quest.
Definition
Objectives
public Objective[] Objectives { get; }Returns a list of the objectives for this quest.
Ready
public bool Ready { get; }If the Quest data is ready.
Remarks
Returns false until the data has been fetched from the quest service. Once it returns true it will always return true.
Methods
GetState
public QuestState GetState()The QuestState representing the user’s progress in the quest.
Returns: QuestState
Offer
public void Offer()Offer the quest to a user.
public void Offer(
Action<Sansar.Script.OperationCompleteEvent> handler
)Offer the quest to a user.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
SetState
public void SetState(QuestState state)Set the state of the quest
| Parameter | Type | Description |
|---|---|---|
state | QuestState | The state to transition to. |
public void SetState(
QuestState state,
Action<Sansar.Script.OperationCompleteEvent> handler
)Set the state of the quest
| Parameter | Type | Description |
|---|---|---|
state | QuestState | The state to transition to. |
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Subscribe
public Sansar.Script.IEventSubscription Subscribe(
QuestState State,
Action<QuestData> callback,
bool persistent
)Subscribes to Quest Events.
| Parameter | Type | Description |
|---|---|---|
State | QuestState | The state of the quest |
callback | Action<QuestData> | Callback which is executed when the event completes. |
persistent | bool | Optional, set to false to unsubscribe after one event. |
Returns: Sansar.Script.IEventSubscription — An IEventSubscription that can be used to cancel the subscription.
ToString
public override string ToString()A string representation of this object.
Returns: string — A string representation of this object.
Remarks
The format of this string may change between releases.
Update
public void Update()Update the ObjectiveDefinition data.
Remarks
Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.
public void Update(
Action<Sansar.Script.OperationCompleteEvent> handler
)Update the ObjectiveDefinition data.
| Parameter | Type | Description |
|---|---|---|
handler | Action<Sansar.Script.OperationCompleteEvent> | Handler to be called when the event completes. |
Remarks
Use in a WaitFor to wait for the data for the QuestDefinition to be ready. Once data is retrieved and Ready is true it will never again be false.
Used in examples
- QuestDebugExample.cs
- ScriptLibrary/Quest/QuestCharacter.cs
- ScriptLibrary/Quest/QuestGiver.cs
- ScriptLibrary/Quest/QuestGiverBase.cs
- ScriptLibrary/Quest/QuestGiverInteraction.cs
- ScriptLibrary/Quest/QuestGiverTrigger.cs
- ScriptLibrary/Quest/QuestObject.cs
- ScriptLibrary/Quest/QuestObjectInteraction.cs
- ScriptLibrary/Quest/QuestObjectTrigger.cs
- ScriptLibrary/Quest/QuestVisibility.cs
Generated from the Sansar 47.10.0 client ScriptApi snapshot.