QuestCreator - Create a quest

Feb 12, 2018
QuestCreator - Create a quest
  • [​IMG]

    Table of contents :

    Commands and permissions
    Plugin storage
    > Create a quest
    Basics : variables
    Basics : preconditions
    Basics : quest settings
    Basics : quest requirements
    Basics : quest rewards
    Basics : quest flow
    Basics : quest flow - tasks
    Basics : quest flow - objectives
    Developpers API

    Create a quest


    Note : this page and the following are explaining how to configure quests from files. Remember that there is an in-game GUI editor if you don't like typing YAML. It depends on what you prefear !
    If you don't plan to use the files, you should definitely read pages about variables and preconditions though.

    The quests configuration system has been made much simplier in update 1.4.0. Let's take a look at it !

    As said upper, all your quest configuration files will be in /plugins/PyrCore/questcreator_quests/.
    Every file that you create in this folder, ending with .yml, will be considered as a quest (you can organize your quests into subfolders if you want). The name of the file, without extension (.yml), will be the quest id, it's better not to put non-alphanumerical characters in it, and definitely no spaces.

    Good : my_quest_1.yml, the id will be my_quest_1
    Not good : quest n°1.yml

    Now we're going to see what parameters we can set and how you can create objectives and stuff like that, in this file. I'll start this tutorial by assuming you know how YAML works and that you master its formatting and indentation :rolleyes:


    Example quest

    This is the default quest generated when the plugin launches for the first time. Everything is detailed below, but this is so you can have an overview.

    Code (Text):
    #----------------------------------------------------------------------------------------------------
    # Quest 'example' (file name without the extension is the quest identifier)
    #----------------------------------------------------------------------------------------------------
    # |!!!| Refer to the plugin's wiki to have more details about how creating a quest. |!!!|
    # |!!!| There are some tips in this file but most explanations (including variables, preconditions, etc) are in the wiki. |!!!|
    #----------------------------------------------------------------------------------------------------

    # --------------------------------------------------
    # Quest settings
    # --------------------------------------------------

    settings:
      # name
      name: '&aExample'
      # description : can be either a single line or a list
      description: 'Just a sample quest'
      # enabled : if the quest is enabled or not
      enabled: false
      # auto_start : will the quest auto_start when the player connects
      auto_start: false
      # max_simultaneous_players : maximum players that can do this quest at the same time
      max_simultaneous_players: 1
      # max_coop_players : maximum additionnal players (don't count the guy that starts the quest) that can do the quest with him
      max_coop_players: 0
      # max_completions : maximum times the player can complete the quest
      max_completions: 1
      # cooldown : time (in minutes) the player will have to wait between completions (will be effective if max_completions is greater than 1)
      cooldown: 5
      # apply_cooldown_if_fail : if the player fails the quest (task QUEST_CANCEL), do we still apply the cooldown ?
      apply_cooldown_if_fail: true
      # show_actionbar : display the current objective name (you can customize its look in the questcreator_config.yml, settings.action_bar)
      show_actionbar: true
      # send_success_message : display the success/fail message when the player ends the quest
      send_success_message: true
      # only_in_worlds : the quest can only be started/influenced in those worlds (optional)
      only_in_worlds: []
      # permission : the player will need this permission to start the quest (optional)
      permission: questcreator.quest.example

    # --------------------------------------------------
    # GUI
    # --------------------------------------------------

    gui:
      # enabled : if the quest can be seen in the GUI /quests
      enabled: true
      # item_available : will be showed when the quest status is 'available'
      item_available:
        type: DIAMOND_SWORD
        name: '&a$NAME &a- AVAILABLE'
        lore:
          - '&7$DESCRIPTION'
          - '&7left click to follow this quest'
      # item_progress : will be showed when the quest status is 'in progress'
      item_progress:
        type: DIAMOND_SWORD
        name: '&6$NAME &6- IN PROGRESS'
        lore:
          - '&7$DESCRIPTION'
          - '&7Objective : $OBJECTIVE'
      # item_cooldown : will be showed when the quest status is 'completed' and the player hasn't reached max_completions and the cooldown is not over
      item_cooldown:
        type: DIAMOND_SWORD
        name: '&7$NAME &7- COOLDOWN'
        lore:
          - '&7$DESCRIPTION'
          - '&7You have completed this quest $COMPLETIONS time$PLURAL.'
          - '&7$COOLDOWN remaining before you can start this quest again.'
      # item_completed : will be showed when the quest status is 'completed' and the player has reached max_completions
      item_completed:
        type: DIAMOND_SWORD
        name: '&7$NAME &7- COMPLETED'
        lore:
          - '&7$DESCRIPTION'
          - '&7You have completed this quest $COMPLETIONS time$PLURAL.'

    # --------------------------------------------------
    # Requirements
    # The things that the player needs to start the quest
    # Types : ITEM, MONEY, PERMISSION, PRECONDITION
    # --------------------------------------------------

    requirements:
      1:
        type: MONEY
        money: 100.5

    # --------------------------------------------------
    # Quest flow
    # What's going to happen in this quest
    # --------------------------------------------------

    flow:

      # first objective, walk on 30 blocs
      1:
        task:
          type: PLAYER_CLEAR
      2:
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aHello, $PLAYER&a. I''m here to ensure that your motor skills are functionnals.'
      3:
        wait: 2
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aFirst of all, let''s check your ability to walk. Please, &6walk on 30 blocs&a.'
      4:
        name: 'walk on 30 blocs'
        objective:
          type: WALK
          distance: 30.0
      5:
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aGood job !'

      # then ask him if he wants to do the jump objective
      6:
        wait: 1
        task:
          type: CHOICE
          message: '&2[AI] &aDo you want to execute the jump test or are you too lazy ?'
          choices:
            1:
              - '&bOf course !'
              - var quest_example_jump set yes
            2:
              - '&bNo, I don''t.'
              - var quest_example_jump set no

      # if he denied, fail the quest. it's better to do things that cancel the quest before the rest of the things
      7:
        # the preconditions are used to
        preconditions: var quest_example_jump different yes
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aIt''s ok, I''m not even frustrated.'
      8:
        preconditions: var quest_example_jump different yes
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aYou''ll have to do it one day !'
      9:
        preconditions: var quest_example_jump different yes
        task:
          type: QUEST_CANCEL

      # if he accepted, let's start the jump objective. we don't need preconditions about the previous choice
      #  because we know that if the quest has not been cancelled at this points it's because 'quest_example_jump'
      #  was never equals to 'no'.
      10:
        task:
          type: SEND_MESSAGE
          message: '&2[AI] &aOk, let''s jump. I''ll ask you to &6jump 5 times&a.'
      11:
        name: 'jump 5 times'
        objective:
          type: JUMP
          amount: 5
      # this is just a quick tip, you can shorten the SEND_MESSAGE in one line as it's the most used one
      11:
        task: 'SEND_MESSAGE &2[AI] &aWonderful ! Now everything is in order. Well played, $PLAYER ! Here are some rewards.'

    # --------------------------------------------------
    # Rewards
    # When the player ends the quest (and only if he succeeds), he'll receive this
    # Types : COMMAND, ITEM, MONEY, VARIABLE, XP
    # --------------------------------------------------

    rewards:
      1:
        type: MONEY
        money: 15
      2:
        type: XP
        xp: 100
      3:
        type: COMMAND
        command: 'say $PLAYER completed the example quest !'
      4:
        type: ITEM
        item:
          type: STONE
          amount: 64
      5:
        type: ITEM
        item:
          type: DIAMOND
          name: '&6This is an awesome diamond, yes ?
     
  • Loading...
  • Loading...