GameQuest

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 this
public IHaveQuests Owner

// Get the "Quest" Scriptable Object
public Quest Parent() 

// Get the in-game unique GameId of this
public virtual string GameId(bool forceNew = false)

// Get the name and type of this
public string ObjectName()
public string ObjectType()

// Get the QuestStepStatus status
public 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 QuestSteps
public List<QuestStep> questSteps

// List of QuestSteps based on status
public List<QuestStep> QuestStepsInProgress
public List<QuestStep> QuestStepsSucceeded
public 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.

// Custom Rewards
public List<CustomQuestReward> customSuccessRewards
public List<CustomQuestReward> customFailureRewards

// Add Custom Rewards
public void AddCustomRewardSuccess(QuestReward questReward)
public void AddCustomRewardFailure(QuestReward questReward)

// Remove Custom Rewards
public void RemoveCustomRewardSuccess(QuestReward questReward)
public void RemoveCustomRewardFailure(QuestReward questReward)

Quest Expiration

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.

private bool CheckExpiration()
{
    if (!Parent().hasEndTime) return false; // This has no end time
    if (endTime > Now()) return false; // 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);
        return true;
    }

    if (Parent().failOnExpiration)
    {
        SetStepsFailed(true);
        return true;
    }
            
    // We will remove on expiration, without succeeding or failing...simply removing.
    RemoveQuestOperations();
    gameQuestList.RemoveGameId(GameId());
    return true;
}

You can also extend the time, or reduce it by adding a negative value:

public float ExtendEndTime(float valueAdd)

Force Quest Completion

You can for the GameQuest to complete as succeeded or failed. The rewards and all "end" operations will trigger.

public bool CompleteQuestSuccess()
public bool CompleteQuestFail()

Other methods

// Run the GiveRewardS() method, which you can do outside of the automation
// if you'd like
GiveRewards(Parent().failureRewards);
GiveRewards(Parent().successRewards);
GiveCustomRewards(customFailureRewards);
GiveCustomRewards(customSuccessRewards);

Last updated