Loading...
Searching...
No Matches
PixelCrushers.QuestMachine.Quest Class Reference

Quest object. More...

Inheritance diagram for PixelCrushers.QuestMachine.Quest:
Collaboration diagram for PixelCrushers.QuestMachine.Quest:

Public Member Functions

string GetEditorName ()
 
void Initialize ()
 Initializes a quest to empty starting values.
 
Quest Clone ()
 Returns a new instance of the quest, including new instances of all subassets such as QuestAction, QuestCondition, and QuestContent subassets.
 
void SetRuntimeReferences ()
 Sets sub-objects' runtime references to this quest.
 
void AssignQuestGiver (QuestParticipantTextInfo questGiverTextInfo)
 Assigns a quest giver to the quest.
 
void AssignQuester (QuestParticipantTextInfo questerTextInfo)
 Assigns a quester (e.g., player) to the quest.
 
void RuntimeStartup ()
 Invoke to tell the quest to perform its runtime startup actions.
 
void SetStartChecking (bool enable)
 Begins checking autostart and offer conditions.
 
void ResetStartConditions ()
 
void BecomeOfferable ()
 
void BecomeUnofferable ()
 
void StartCooldown ()
 Starts the cooldown period for this quest.
 
void UpdateCooldown ()
 Checks the current game time and updates the cooldown period.
 
QuestState GetState ()
 Gets the quest state.
 
void SetState (QuestState newState, bool informListeners=true)
 Sets the quest state.
 
void SetStateRaw (QuestState state)
 Sets the internal state value without performing any state change processing.
 
QuestStateInfo GetStateInfo (QuestState state)
 Returns the state info associated with a quest state.
 
void ExecuteStateActions (QuestState state)
 
QuestCounter GetCounter (int index)
 Gets a counter defined in this quest.
 
QuestCounter GetCounter (string counterName)
 Gets a counter defined in this quest.
 
QuestCounter GetCounter (StringField counterName)
 Gets a counter defined in this quest.
 
int GetCounterIndex (string counterName)
 
int GetCounterIndex (StringField counterName)
 
QuestNode GetNode (string questNodeID)
 Looks up a node by its ID.
 
QuestNode GetNode (StringField questNodeID)
 Looks up a node by its ID.
 
bool IsSpeakerQuestGiver (QuestParticipantTextInfo speaker)
 
bool HasContent (QuestContentCategory category, QuestParticipantTextInfo speaker=null)
 Checks if there is any UI content for a specific category.
 
List< QuestContentGetContentList (QuestContentCategory category, QuestParticipantTextInfo speaker=null)
 Gets the UI content for a specific category.
 
void AssignContentID (QuestContent content)
 
QuestContent GetContentByID (int contentID)
 
void SetQuestIndicatorState (string entityID, QuestIndicatorState questIndicatorState)
 
void SetQuestIndicatorState (StringField entityID, QuestIndicatorState questIndicatorState)
 
QuestIndicatorState GetQuestIndicatorState (string entityID)
 
QuestIndicatorState GetQuestIndicatorState (StringField entityID)
 
void ClearQuestIndicatorStates ()
 
void CompressGeneratedContent ()
 If quest is procedurally generated and completed, destroys all content and conditions not needed to show in UIs.
 

Static Public Member Functions

static void DestroyInstance (Quest quest)
 

Protected Member Functions

QuestContent FindContentByID (int contentID)
 
QuestContent FindContentByID (int contentID, List< QuestContent > contentList)
 
QuestContent FindContentByIDInStateInfo (int contentID, QuestStateInfo stateInfo)
 
QuestContent FindContentByIDInMainQuest (int contentID)
 
QuestContent FindContentByIDInNodes (int contentID)
 

Properties

bool isInstance [get, set]
 Quest is a runtime instance, not an asset file.
 
bool isAsset [get, set]
 Quest is an asset, not a runtime instance.
 
Quest originalAsset [get, set]
 If a runtime instance, this is the original asset from which the instance was created.
 
int fileVersion [get, set]
 
bool isProcedurallyGenerated [get]
 Quest was procedurally generated.
 
TextTable textTable [get]
 Default text table used when adding new content.
 
StringField id [get, set]
 Unique identifier for this quest.
 
StringField title [get, set]
 Title shown in UIs.
 
Sprite icon [get, set]
 Optional quest icon shown in UIs.
 
StringField group [get, set]
 Optional group under which to categorize this quest.
 
List< StringFieldlabels [get, set]
 Optional labels to assign to this quest for sorting and filtering.
 
StringField questGiverID [get, set]
 ID of the quest giver that offered this quest.
 
string questerID [get]
 ID of the quester assigned to this quest.
 
string greeterID [get, set]
 ID of the quester who is greeting the quest giver.
 
string greeter [get, set]
 Display name of the quester who is greeting the quest giver.
 
bool isTrackable [get, set]
 Specifies whether the player is allowed to toggle tracking on and off.
 
bool showInTrackHUD [get, set]
 Specifies whether to show in the quest tracking HUD.
 
bool isAbandonable [get, set]
 Specifies whether the player is allowed to abandon the quest.
 
bool rememberIfAbandoned [get, set]
 Specifies whether to keep in quest journal if abandoned.
 
bool deleteWhenComplete [get, set]
 Delete when completed even if Quest Journal specifies Remember Completed Quests.
 
QuestConditionSet autostartConditionSet [get, set]
 If specified, conditions that autostart the quest when true.
 
bool hasAutostartConditions [get]
 If true, the quest has autostart conditions.
 
QuestConditionSet offerConditionSet [get, set]
 Conditions that must be true before the quest can be offered.
 
bool hasOfferConditions [get]
 If true, the quest has offer conditions.
 
bool canOffer [get]
 If true, the giver can offer the quest.
 
List< QuestContentofferConditionsUnmetContentList [get, set]
 Dialogue text to show when the offer conditions are unmet.
 
List< QuestContentofferContentList [get, set]
 Dialogue text to show when offering the quest.
 
bool infinitelyRepeatable [get, set]
 No limit to number of times quest can be accepted.
 
int maxTimes [get, set]
 Max number of times this quest can be accepted.
 
int timesAccepted [get, set]
 The number of times the quest has been accepted.
 
float cooldownSeconds [get, set]
 Minimum duration in seconds that must pass after quest acceptance to offer it again.
 
float cooldownSecondsRemaining [get, set]
 Seconds remaining until cooldown period is over.
 
bool noRepeatIfSuccessful [get, set]
 Do not offer again if quester already has successful completion in its journal.
 
bool saveAllIfWaitingToStart [get, set]
 Save counters, node states, & indicator states if waiting to start.
 
List< QuestStateInfostateInfoList [get, set]
 Info for each state, indexed by the int value of the QuestState enum.
 
List< QuestCountercounterList [get, set]
 Counters defined for this quest.
 
List< QuestNodenodeList [get, set]
 All nodes in this quest.
 
QuestNode startNode [get]
 The quest's start node.
 
string goalEntityTypeName [get, set]
 If this quest was procedurally generated, the goal EntityType's name.
 
int nextContentID [get, set]
 Used by QuestContent to assign a unique ID number usable by LinkQuestContent.
 
TagDictionary tagDictionary [get, set]
 Dictionary of tags defined in this quest and their values.
 
Dictionary< string, QuestIndicatorStateindicatorStates [get, set]
 Current quest state indicator states by entity ID.
 
HashSet< string > speakers [get, set]
 List of all quest node speakers.
 
QuestParticipantTextInfo currentSpeaker [get]
 The current speaker's info, if the speaker is different from the quest giver.
 

Events

QuestParameterDelegate questOfferable = delegate { }
 Raised when the quest has become offerable.
 
QuestParameterDelegate stateChanged = delegate { }
 Raised when the quest's state has changed.
 

Detailed Description

Quest object.

May be saved as an asset file in the project or may be a runtime instance in the scene.

Member Function Documentation

◆ AssignContentID()

void PixelCrushers.QuestMachine.Quest.AssignContentID ( QuestContent  content)
inline

◆ AssignQuester()

void PixelCrushers.QuestMachine.Quest.AssignQuester ( QuestParticipantTextInfo  questerTextInfo)
inline

Assigns a quester (e.g., player) to the quest.

Parameters
questerTextInfoIdenntifying information about the quester.

◆ AssignQuestGiver()

void PixelCrushers.QuestMachine.Quest.AssignQuestGiver ( QuestParticipantTextInfo  questGiverTextInfo)
inline

Assigns a quest giver to the quest.

Parameters
questGiverTextInfoIdentifying information about the quest giver.

◆ BecomeOfferable()

void PixelCrushers.QuestMachine.Quest.BecomeOfferable ( )
inline

◆ BecomeUnofferable()

void PixelCrushers.QuestMachine.Quest.BecomeUnofferable ( )
inline

◆ ClearQuestIndicatorStates()

void PixelCrushers.QuestMachine.Quest.ClearQuestIndicatorStates ( )
inline

◆ Clone()

Quest PixelCrushers.QuestMachine.Quest.Clone ( )
inline

Returns a new instance of the quest, including new instances of all subassets such as QuestAction, QuestCondition, and QuestContent subassets.

◆ CompressGeneratedContent()

void PixelCrushers.QuestMachine.Quest.CompressGeneratedContent ( )
inline

If quest is procedurally generated and completed, destroys all content and conditions not needed to show in UIs.

◆ DestroyInstance()

static void PixelCrushers.QuestMachine.Quest.DestroyInstance ( Quest  quest)
inlinestatic

◆ ExecuteStateActions()

void PixelCrushers.QuestMachine.Quest.ExecuteStateActions ( QuestState  state)
inline

◆ FindContentByID() [1/2]

QuestContent PixelCrushers.QuestMachine.Quest.FindContentByID ( int  contentID)
inlineprotected

◆ FindContentByID() [2/2]

QuestContent PixelCrushers.QuestMachine.Quest.FindContentByID ( int  contentID,
List< QuestContent contentList 
)
inlineprotected

◆ FindContentByIDInMainQuest()

QuestContent PixelCrushers.QuestMachine.Quest.FindContentByIDInMainQuest ( int  contentID)
inlineprotected

◆ FindContentByIDInNodes()

QuestContent PixelCrushers.QuestMachine.Quest.FindContentByIDInNodes ( int  contentID)
inlineprotected

◆ FindContentByIDInStateInfo()

QuestContent PixelCrushers.QuestMachine.Quest.FindContentByIDInStateInfo ( int  contentID,
QuestStateInfo  stateInfo 
)
inlineprotected

◆ GetContentByID()

QuestContent PixelCrushers.QuestMachine.Quest.GetContentByID ( int  contentID)
inline

◆ GetContentList()

List< QuestContent > PixelCrushers.QuestMachine.Quest.GetContentList ( QuestContentCategory  category,
QuestParticipantTextInfo  speaker = null 
)
inline

Gets the UI content for a specific category.

Parameters
categoryThe content category (Dialogue, Journal, etc.).
speakerThe speaker whose content to get, or blank for the quest giver.
Returns
A list of content items based on the current state of the quest and all of its nodes.

◆ GetCounter() [1/3]

QuestCounter PixelCrushers.QuestMachine.Quest.GetCounter ( int  index)
inline

Gets a counter defined in this quest.

Parameters
indexThe index of the counter defined in the quest.
Returns
The counter, or null if there is no counter with the specified name.

◆ GetCounter() [2/3]

QuestCounter PixelCrushers.QuestMachine.Quest.GetCounter ( string  counterName)
inline

Gets a counter defined in this quest.

Parameters
counterNameThe name of the counter defined in the quest.
Returns
The counter, or null if there is no counter with the specified name.

◆ GetCounter() [3/3]

QuestCounter PixelCrushers.QuestMachine.Quest.GetCounter ( StringField  counterName)
inline

Gets a counter defined in this quest.

Parameters
counterNameThe name of the counter defined in the quest.
Returns
The counter, or null if there is no counter with the specified name.

◆ GetCounterIndex() [1/2]

int PixelCrushers.QuestMachine.Quest.GetCounterIndex ( string  counterName)
inline

◆ GetCounterIndex() [2/2]

int PixelCrushers.QuestMachine.Quest.GetCounterIndex ( StringField  counterName)
inline

◆ GetEditorName()

string PixelCrushers.QuestMachine.Quest.GetEditorName ( )
inline

◆ GetNode() [1/2]

QuestNode PixelCrushers.QuestMachine.Quest.GetNode ( string  questNodeID)
inline

Looks up a node by its ID.

◆ GetNode() [2/2]

QuestNode PixelCrushers.QuestMachine.Quest.GetNode ( StringField  questNodeID)
inline

Looks up a node by its ID.

◆ GetQuestIndicatorState() [1/2]

QuestIndicatorState PixelCrushers.QuestMachine.Quest.GetQuestIndicatorState ( string  entityID)
inline

◆ GetQuestIndicatorState() [2/2]

QuestIndicatorState PixelCrushers.QuestMachine.Quest.GetQuestIndicatorState ( StringField  entityID)
inline

◆ GetState()

QuestState PixelCrushers.QuestMachine.Quest.GetState ( )
inline

Gets the quest state.

Returns
The current quest state. Each quest node also has its own state.

◆ GetStateInfo()

QuestStateInfo PixelCrushers.QuestMachine.Quest.GetStateInfo ( QuestState  state)
inline

Returns the state info associated with a quest state.

◆ HasContent()

bool PixelCrushers.QuestMachine.Quest.HasContent ( QuestContentCategory  category,
QuestParticipantTextInfo  speaker = null 
)
inline

Checks if there is any UI content for a specific category.

Parameters
categoryThe content category (Dialogue, Journal, etc.).
speakerThe speaker whose content to check, or blank for the quest giver.
Returns
True if GetContentList would return anything.

◆ Initialize()

void PixelCrushers.QuestMachine.Quest.Initialize ( )
inline

Initializes a quest to empty starting values.

Invoked when object is created by ScriptableObjectUtility.CreateInstance.

◆ IsSpeakerQuestGiver()

bool PixelCrushers.QuestMachine.Quest.IsSpeakerQuestGiver ( QuestParticipantTextInfo  speaker)
inline

◆ ResetStartConditions()

void PixelCrushers.QuestMachine.Quest.ResetStartConditions ( )
inline

◆ RuntimeStartup()

void PixelCrushers.QuestMachine.Quest.RuntimeStartup ( )
inline

Invoke to tell the quest to perform its runtime startup actions.

◆ SetQuestIndicatorState() [1/2]

void PixelCrushers.QuestMachine.Quest.SetQuestIndicatorState ( string  entityID,
QuestIndicatorState  questIndicatorState 
)
inline

◆ SetQuestIndicatorState() [2/2]

void PixelCrushers.QuestMachine.Quest.SetQuestIndicatorState ( StringField  entityID,
QuestIndicatorState  questIndicatorState 
)
inline

◆ SetRuntimeReferences()

void PixelCrushers.QuestMachine.Quest.SetRuntimeReferences ( )
inline

Sets sub-objects' runtime references to this quest.

◆ SetStartChecking()

void PixelCrushers.QuestMachine.Quest.SetStartChecking ( bool  enable)
inline

Begins checking autostart and offer conditions.

◆ SetState()

void PixelCrushers.QuestMachine.Quest.SetState ( QuestState  newState,
bool  informListeners = true 
)
inline

Sets the quest state.

This may also affect the states of the quest's nodes.

Parameters
newStateThe new quest state.

◆ SetStateRaw()

void PixelCrushers.QuestMachine.Quest.SetStateRaw ( QuestState  state)
inline

Sets the internal state value without performing any state change processing.

◆ StartCooldown()

void PixelCrushers.QuestMachine.Quest.StartCooldown ( )
inline

Starts the cooldown period for this quest.

◆ UpdateCooldown()

void PixelCrushers.QuestMachine.Quest.UpdateCooldown ( )
inline

Checks the current game time and updates the cooldown period.

Property Documentation

◆ autostartConditionSet

QuestConditionSet PixelCrushers.QuestMachine.Quest.autostartConditionSet
getset

If specified, conditions that autostart the quest when true.

◆ canOffer

bool PixelCrushers.QuestMachine.Quest.canOffer
get

If true, the giver can offer the quest.

◆ cooldownSeconds

float PixelCrushers.QuestMachine.Quest.cooldownSeconds
getset

Minimum duration in seconds that must pass after quest acceptance to offer it again.

◆ cooldownSecondsRemaining

float PixelCrushers.QuestMachine.Quest.cooldownSecondsRemaining
getset

Seconds remaining until cooldown period is over.

◆ counterList

List<QuestCounter> PixelCrushers.QuestMachine.Quest.counterList
getset

Counters defined for this quest.

◆ currentSpeaker

QuestParticipantTextInfo PixelCrushers.QuestMachine.Quest.currentSpeaker
get

The current speaker's info, if the speaker is different from the quest giver.

If the quest giver is speaking, this property will be null.

◆ deleteWhenComplete

bool PixelCrushers.QuestMachine.Quest.deleteWhenComplete
getset

Delete when completed even if Quest Journal specifies Remember Completed Quests.

◆ fileVersion

int PixelCrushers.QuestMachine.Quest.fileVersion
getset

◆ goalEntityTypeName

string PixelCrushers.QuestMachine.Quest.goalEntityTypeName
getset

If this quest was procedurally generated, the goal EntityType's name.

◆ greeter

string PixelCrushers.QuestMachine.Quest.greeter
getset

Display name of the quester who is greeting the quest giver.

For quests that can be accepted by quester A and turned in by quester B, this is the name of quester B.

◆ greeterID

string PixelCrushers.QuestMachine.Quest.greeterID
getset

ID of the quester who is greeting the quest giver.

For quests that can be accepted by quester A and turned in by quester B, this is the ID of quester B.

◆ group

StringField PixelCrushers.QuestMachine.Quest.group
getset

Optional group under which to categorize this quest.

◆ hasAutostartConditions

bool PixelCrushers.QuestMachine.Quest.hasAutostartConditions
get

If true, the quest has autostart conditions.

The quest will start automatically when the conditions are met.

◆ hasOfferConditions

bool PixelCrushers.QuestMachine.Quest.hasOfferConditions
get

If true, the quest has offer conditions.

The giver should not offer the quest until the conditions are met.

◆ icon

Sprite PixelCrushers.QuestMachine.Quest.icon
getset

Optional quest icon shown in UIs.

◆ id

StringField PixelCrushers.QuestMachine.Quest.id
getset

Unique identifier for this quest.

◆ indicatorStates

Dictionary<string, QuestIndicatorState> PixelCrushers.QuestMachine.Quest.indicatorStates
getset

Current quest state indicator states by entity ID.

◆ infinitelyRepeatable

bool PixelCrushers.QuestMachine.Quest.infinitelyRepeatable
getset

No limit to number of times quest can be accepted.

◆ isAbandonable

bool PixelCrushers.QuestMachine.Quest.isAbandonable
getset

Specifies whether the player is allowed to abandon the quest.

◆ isAsset

bool PixelCrushers.QuestMachine.Quest.isAsset
getset

Quest is an asset, not a runtime instance.

◆ isInstance

bool PixelCrushers.QuestMachine.Quest.isInstance
getset

Quest is a runtime instance, not an asset file.

◆ isProcedurallyGenerated

bool PixelCrushers.QuestMachine.Quest.isProcedurallyGenerated
get

Quest was procedurally generated.

◆ isTrackable

bool PixelCrushers.QuestMachine.Quest.isTrackable
getset

Specifies whether the player is allowed to toggle tracking on and off.

◆ labels

List<StringField> PixelCrushers.QuestMachine.Quest.labels
getset

Optional labels to assign to this quest for sorting and filtering.

◆ maxTimes

int PixelCrushers.QuestMachine.Quest.maxTimes
getset

Max number of times this quest can be accepted.

◆ nextContentID

int PixelCrushers.QuestMachine.Quest.nextContentID
getset

Used by QuestContent to assign a unique ID number usable by LinkQuestContent.

◆ nodeList

List<QuestNode> PixelCrushers.QuestMachine.Quest.nodeList
getset

All nodes in this quest.

◆ noRepeatIfSuccessful

bool PixelCrushers.QuestMachine.Quest.noRepeatIfSuccessful
getset

Do not offer again if quester already has successful completion in its journal.

◆ offerConditionSet

QuestConditionSet PixelCrushers.QuestMachine.Quest.offerConditionSet
getset

Conditions that must be true before the quest can be offered.

◆ offerConditionsUnmetContentList

List<QuestContent> PixelCrushers.QuestMachine.Quest.offerConditionsUnmetContentList
getset

Dialogue text to show when the offer conditions are unmet.

◆ offerContentList

List<QuestContent> PixelCrushers.QuestMachine.Quest.offerContentList
getset

Dialogue text to show when offering the quest.

◆ originalAsset

Quest PixelCrushers.QuestMachine.Quest.originalAsset
getset

If a runtime instance, this is the original asset from which the instance was created.

◆ questerID

string PixelCrushers.QuestMachine.Quest.questerID
get

ID of the quester assigned to this quest.

If this is an asset or it hasn't been accepted yet, questerID will be empty;

◆ questGiverID

StringField PixelCrushers.QuestMachine.Quest.questGiverID
getset

ID of the quest giver that offered this quest.

Typically set on the quester's runtime instance of the quest when the quester accepts a quest. If this is an asset or it hasn't been accepted yet, questGiverID will be empty.

◆ rememberIfAbandoned

bool PixelCrushers.QuestMachine.Quest.rememberIfAbandoned
getset

Specifies whether to keep in quest journal if abandoned.

◆ saveAllIfWaitingToStart

bool PixelCrushers.QuestMachine.Quest.saveAllIfWaitingToStart
getset

Save counters, node states, & indicator states if waiting to start.

Normally omitted to reduce save file size/time.

◆ showInTrackHUD

bool PixelCrushers.QuestMachine.Quest.showInTrackHUD
getset

Specifies whether to show in the quest tracking HUD.

◆ speakers

HashSet<string> PixelCrushers.QuestMachine.Quest.speakers
getset

List of all quest node speakers.

◆ startNode

QuestNode PixelCrushers.QuestMachine.Quest.startNode
get

The quest's start node.

◆ stateInfoList

List<QuestStateInfo> PixelCrushers.QuestMachine.Quest.stateInfoList
getset

Info for each state, indexed by the int value of the QuestState enum.

◆ tagDictionary

TagDictionary PixelCrushers.QuestMachine.Quest.tagDictionary
getset

Dictionary of tags defined in this quest and their values.

◆ textTable

TextTable PixelCrushers.QuestMachine.Quest.textTable
get

Default text table used when adding new content.

◆ timesAccepted

int PixelCrushers.QuestMachine.Quest.timesAccepted
getset

The number of times the quest has been accepted.

◆ title

StringField PixelCrushers.QuestMachine.Quest.title
getset

Title shown in UIs.

Event Documentation

◆ questOfferable

QuestParameterDelegate PixelCrushers.QuestMachine.Quest.questOfferable = delegate { }

Raised when the quest has become offerable.

◆ stateChanged

QuestParameterDelegate PixelCrushers.QuestMachine.Quest.stateChanged = delegate { }

Raised when the quest's state has changed.


The documentation for this class was generated from the following file: