GameQuest is the in-game, runtime object to use, representing a Quest made with the Quest module.
GameQuest.cs
// View GameQuest.cs for all the methods (There are more!!)// Get the IHaveQuests owner of thispublic IHaveQuests Owner// Get the "Quest" Scriptable ObjectpublicQuestParent() // Get the in-game unique GameId of thispublic virtual string GameId(bool forceNew =false)// Get the name and type of thispublic string ObjectName()public string ObjectType()// Get the QuestStepStatus statuspublic QuestStep.QuestStepStatus status
Creating a GameQuest
Generally a GameQuest will live inside a GameQuestList.
Get List<QuestStep>
Each Quest will have a list of QuestStep objects.
// All of the QuestStepspublic List<QuestStep> questSteps// List of QuestSteps based on statuspublic List<QuestStep> QuestStepsInProgresspublic List<QuestStep> QuestStepsSucceededpublic List<QuestStep> QuestStepsFailed
Custom Rewards
You can add custom QuestReward objects at runtime, enabling customization of quests based on in game behavior or player choices.
Quests can optionally expire, and you can check the status. CheckExpiration() will return false if the Quest either does not expire, or has not expired. Otherwise it will return true, and do additional actions based on the Quest settings.
privateboolCheckExpiration(){if (!Parent().hasEndTime) returnfalse; // This has no end timeif (endTime >Now()) returnfalse; // We have not yet reached the end time // We've reached the end time. Options are to simply expire, or to auto succeed or fail.if (Parent().succeedOnExpiration) {SetStepsSucceeded(true);returntrue; }if (Parent().failOnExpiration) {SetStepsFailed(true);returntrue; } // We will remove on expiration, without succeeding or failing...simply removing.RemoveQuestOperations();gameQuestList.RemoveGameId(GameId());returntrue;}
You can also extend the time, or reduce it by adding a negative value:
publicfloatExtendEndTime(float valueAdd)
Force Quest Completion
You can for the GameQuest to complete as succeeded or failed. The rewards and all "end" operations will trigger.
// Run the GiveRewardS() method, which you can do outside of the automation// if you'd likeGiveRewards(Parent().failureRewards);GiveRewards(Parent().successRewards);GiveCustomRewards(customFailureRewards);GiveCustomRewards(customSuccessRewards);