Skip to content
Exodia edited this page Jul 17, 2022 · 41 revisions

( in progress )

Quest

Quest

The Quest class is a set of stages, which follow each other in an orderly fashion.

Add a Quest

(code-snippets: DR_QuestAdd)

define quests = {
    "alice"     :   Quest(id = "alice", title = _("Help [a]"), bg="bg alice terrace talk", 
    stages_id = ["talk alice1", "order products", "take products", "talk alice2"], 
    description = _("To learn more about how the repo works, Talk to [a]. \nGoing when she is there will automatically start an \"Event\" (see routine*.rpy to learn more). \nAfter that an action (action*.rpy) will be added to open the pc, in MC room. \n\n(during the quest you can talk to [a] and you will see her talking during the quests of the same Quest)")),

    "ann"       :   Quest(id = "ann", title = _("Help [an]"), stages_id = ["talk al about ann"], development = True),
}

Start a Quest

(code-snippets: DR_QuestStart)

quests["quest_id"].start()

If Quests level

To check which stage number a Quest has arrived at:

if (quests_levels["alice"] == 2):
    # ...

Stage

Is a class necessary for the proper functioning of a quest. (Quests are a list of Stages).

Add a Stage

define quest_stages = {
    # Quest "alice"
    "talk alice1"           :   Stage(idQuestOrTask = "alice", title = _("Talk [a]"), 
    description = _("Talk [a] on the terrace."), label_start="stagestart_talkalice"),
    "order products"        :   Stage(idQuestOrTask = "alice", title = _("Order products"), 
    description = _("Order the products with your PC.")),
    "take products"         :   Stage(idQuestOrTask = "alice", title = _("Take products"), 
    description = _("Take products on the Terrace."), 
    description_request = _("Wait for the products you ordered to arrive (2 day)"), 
    days_late = 2, label_start="add_product"),
    "talk alice2"           :   Stage(idQuestOrTask = "alice", title = _("Talk [a]"), description = _("Talk [a].")),
    # Quest "ann"
    "talk al about ann"     :   Stage(idQuestOrTask = "ann", title = _("Talk [a]"), description = _("Talk [a].")),
    "visit ann"             :   Stage(idQuestOrTask = "ann", title = _("Visit [an]"), 
    description = _("Go to the house of [an].")),
}

Next Stage

current_quest_stages["quest_id"].nextStage()

Next Stage Only it is completed

current_quest_stages["quest_id"].nextStageOnlyIsCompleted()

Task

They are identical to the Quests, except that after completion they are not replaced by the next one, but eliminated.

(in process)

Goal

Goal class, it has been designed to be included in the Stage class. To complete the goals use find()

(in process)

Life cycle of a Quest

First phase (Initialize a Stage)

quests["quest_id"].start():
    quest_stages["stage_id"].addInCurrentQuestStages()
    current_quest_stages["quest_id"].start():
        self.request_check():
            self.active = True

Checking whether it is completed

current_quest_stages["quest_id"].nextStageOnlyIsCompleted():
  if self.isCompleted():
      self.nextStage():
          if: #if it's not the last quest:
              quests["quest_id"].nextStage():
                self.start(number_stages_completed_in_quest[self.id] + 1): # Start the cycle again

Clone this wiki locally