The PokéCommunity Forums Fan Games Game Development Scripts & Tutorials
Essentials Script Simple Quest System + UI

Scripts & Tutorials This forum is for scripts and code, as well as all kinds of tutorials, software, tools and so forth. Remember to give credit!
The thread revival limit does not apply here.


Reply
 
Thread Tools
  #1    
Old May 25th, 2017 (10:26 PM). Edited June 13th, 2017 by mej71.
mej71's Avatar
mej71 mej71 is offline
     
    Join Date: Mar 2014
    Location: Omnipresence
    Gender: Male
    Posts: 1,226

    A fairly comprehensive, yet easy to use system + UI for managing quests in your fangame

    Features
    • Support for up to 10 stages per quest
    • Complex rewards
    • Very detailed compiler errors, tells you exactly what you've messed up
    • Doesn't save quest data for player (similar to how other objects are handled in Essentials, non-specific data is stored in a separate data file so that quest info is updated for old saves)
    • Plug and play
    • Won't break old save files by adding this script
    • Easy to edit and create new quests


    How to Use
    1. Download .rar file
    2. Add quests.txt to your PBS folder
    3. Add the 'Quest UI' folder to Graphics/Pictures (be sure to include the folder itself, not just the contents)
    4. Add the text from questScript.txt into a new section above the Main but below the Compiler section
    5. And that's all there is to the installation

    There's a few methods you will need to know to use the quest system (you will activate/complete/fail quests within your events, only you know in which context to do so)
    Code:
    activateQuest(id)
    completeQuest(id)
    failQuest(id)
    advanceQuestToStage(questID, stageNum)
    In all of these, 'id' and 'questID' refer to the ID of the desired quest, which is defined in quests.txt, the file you added to your PBS folder. The name of the quest can also be used in as the 'id' for these methods, since quest names are unique. The 'stageNum' refers to the desired stage number of that quest. Be sure the id you input exists, as there is currently no check against it

    To open the quest menu, use the script
    Code:
    pbViewQuests

    Editing the Quest PBS file
    There's only 8 types of lines in the PBS that you need to know
    • Name - This is the name of the quest that will be displayed. Names must be unique (two quests cannot share a name)
    • Stage1 - This is the description of the current task of the quests. Each quest can have up to 10 stages (so Stage2, Stage9, etc are also valid). Stages must be listed in order, no skipping numbers.
    • Reward - This is the reward given to the player upon completion. When completion is triggered, it will read the string assigned and evaluate it as code. So if you make your reward "Kernel.pbMessage('Hello')", upon completion it will display a message saying "Hello". This reward is fairly simple, but keep in mind any type of code can be run here, so you can give items, set variables, or pretty much anything else you can code. Note that this code is not tested, so test all your rewards to ensure you didn't make errors. (Pro tip: semi-colons can be used to separate multiple instructions in a single line of code)
    • RewardDescription - A description of the reward, so they player may determine whether or not to pursue
    • QuestDescription - A description of the quest
    • StageLocation1 - Same as with Stage1, there are up to 10 locations supported. This tells the player where to go for the next task. Can either be the desired map name or map id. These are checked upon compile time to ensure the map exists. "nil" can be used if you don't want to specify a map
    • CompleteMessage - The "Result" description displayed in the UI for a completed quest.
    • FailedMessage - The "Result" description displayed in the UI for a failed quest.

    What the default UI looks like



    FAQ
    • Can you use '\b', images, or other text formatting?: No, these are currently not supported
    • More questions will appear as they are asked
    Reply With Quote

    Relevant Advertising!

      #2    
    Old May 26th, 2017 (12:33 AM).
    Marin's Avatar
    Marin Marin is online now
    Not Bored
     
    Join Date: Nov 2016
    Age: 16
    Gender: Other
    Posts: 709
    Looks very interesting! I especially like the "next stage" feature.
    Reply With Quote
      #3    
    Old June 13th, 2017 (5:10 AM).
    Pikapoo9000's Avatar
    Pikapoo9000 Pikapoo9000 is offline
    dank memes make dank dreams.
       
      Join Date: May 2017
      Location: idfk.
      Gender: Male
      Nature: Jolly
      Posts: 1
      How do you open the Quest menu where you can see all the quests?
      __________________
      allwaiys travellieng...
      Reply With Quote
        #4    
      Old June 13th, 2017 (11:41 PM).
      mej71's Avatar
      mej71 mej71 is offline
         
        Join Date: Mar 2014
        Location: Omnipresence
        Gender: Male
        Posts: 1,226
        Quote:
        Originally Posted by Pikapoo9000 View Post
        How do you open the Quest menu where you can see all the quests?
        I meant to add that and completely forgot
        Code:
        pbViewQuests
        Just this quick line. It checks if you have any quests for you before opening
        Reply With Quote
          #5    
        Old June 14th, 2017 (7:19 AM).
        JustKenneth's Avatar
        JustKenneth JustKenneth is offline
        Developer Pokemon The Kingdom of Meralas
           
          Join Date: Oct 2009
          Location: Belgium
          Gender: Male
          Nature: Calm
          Posts: 8
          this looks a lot like Mobius' Quest Journal (maker).
          I tried to implement something like this in Essentials some time ago.
          I added this to the start menu:
          http://provenk.deviantart.com/art/Pausemenu-620214364
          http://provenk.deviantart.com/art/Quest-log-620214370

          it was quite buggy and not as complete as yours though.

          nice work!
          __________________
          "And as the sails arrived, the forest vanished and the city fell. Meralas is king now."
          - Xhicco - Pokemon: The Kingdom of Meralas
          Reply With Quote
            #6    
          Old June 14th, 2017 (1:06 PM).
          mej71's Avatar
          mej71 mej71 is offline
             
            Join Date: Mar 2014
            Location: Omnipresence
            Gender: Male
            Posts: 1,226
            Quote:
            Originally Posted by JustKenneth View Post
            this looks a lot like Mobius' Quest Journal (maker).
            I tried to implement something like this in Essentials some time ago.
            I added this to the start menu:
            http://provenk.deviantart.com/art/Pausemenu-620214364
            http://provenk.deviantart.com/art/Quest-log-620214370

            it was quite buggy and not as complete as yours though.

            nice work!
            I originally did a small edit of that script for Essentials, it's in this section somewhere. This script was from scratch, but I kept a similar format of the text files, and tried to make it more complete and easy to use.
            Reply With Quote
              #7    
            Old June 24th, 2017 (3:01 PM).
            hanamir hanamir is offline
               
              Join Date: Feb 2017
              Posts: 15
              Thanks for this! I really wanted to use this but I keep getting this error after installing it. I really wanted to check it out and I followed all the directions but this error keeps popping up. I hope you are still willing to help on this thread.

              Script 'mej71 Quest System' line 402: RuntimeError
              occured.

              Invalid map id for quest , at stage 0

              Thats all it gave me, I can screenshot if necessary, however. Hope you can help. Thanks.
              Attached Thumbnails
              Screen Shot 2017-06-24 at 7.02.08 PM.png‎  
              Reply With Quote
                #8    
              Old July 6th, 2017 (2:01 PM).
              The_Don The_Don is offline
                 
                Join Date: Jul 2017
                Posts: 13
                Click image for larger version

Name:	questprob.png
Views:	662
Size:	322.6 KB
ID:	82398

                How come it tells me that?
                Reply With Quote
                  #9    
                Old July 7th, 2017 (12:50 AM).
                Marin's Avatar
                Marin Marin is online now
                Not Bored
                 
                Join Date: Nov 2016
                Age: 16
                Gender: Other
                Posts: 709
                Quote:
                Originally Posted by The_Don View Post
                Attachment 82398

                How come it tells me that?
                Do you have any quests?
                Reply With Quote
                  #10    
                Old July 7th, 2017 (3:29 AM).
                The_Don The_Don is offline
                   
                  Join Date: Jul 2017
                  Posts: 13
                  Quote:
                  Originally Posted by M3rein View Post
                  Do you have any quests?
                  Weren't there some quest in yet? I tought i read that in the description?
                  Reply With Quote
                    #11    
                  Old July 7th, 2017 (11:55 AM).
                  mej71's Avatar
                  mej71 mej71 is offline
                     
                    Join Date: Mar 2014
                    Location: Omnipresence
                    Gender: Male
                    Posts: 1,226
                    Quote:
                    Originally Posted by The_Don View Post
                    Weren't there some quest in yet? I tought i read that in the description?
                    The journal only shows discovered quests. Even if they're defined, you need to activate at least one to open the journal
                    Reply With Quote
                      #12    
                    Old July 8th, 2017 (2:37 AM).
                    dgeneratio dgeneratio is offline
                    Dgeneratio
                       
                      Join Date: Sep 2012
                      Age: 29
                      Gender: Male
                      Nature: Relaxed
                      Posts: 4
                      Hi Mej, where do these lines of code go? Sorry i'm new to Scripting so don't want to do an error.

                      There's a few methods you will need to know to use the quest system (you will activate/complete/fail quests within your events, only you know in which context to do so)
                      Code:
                      activateQuest(id)
                      completeQuest(id)
                      failQuest(id)
                      advanceQuestToStage(questID, stageNum)

                      In all of these, 'id' and 'questID' refer to the ID of the desired quest, which is defined in quests.txt, the file you added to your PBS folder. The name of the quest can also be used in as the 'id' for these methods, since quest names are unique. The 'stageNum' refers to the desired stage number of that quest. Be sure the id you input exists, as there is currently no check against it

                      To open the quest menu, use the script
                      Code:
                      pbViewQuests

                      Cheers :)
                      __________________
                      Reply With Quote
                        #13    
                      Old November 8th, 2017 (12:41 AM).
                      HarmonyConcept HarmonyConcept is offline
                         
                        Join Date: Sep 2015
                        Gender: Female
                        Posts: 207
                        Thank you for this! It works just fine. Some small remarks:

                        1. I believe there is a small mistake in the script at line 523 that will prevent you from running the game (just remove a parenthesis):

                        def getMaxStagesForQuest(questID))

                        2. I had a "Invalid map id for quest" error message on first launch and fixed it by clearing the quests.txt file;

                        3. There are two different "quest_bg" files in the graphics package, you may want to replace the first one (in Quest UI folder) by the second one (which is in Quest UI\Quest UI)
                        Reply With Quote
                          #14    
                        Old November 8th, 2017 (6:00 PM). Edited November 8th, 2017 by SolarLegacy.
                        SolarLegacy SolarLegacy is offline
                           
                          Join Date: Sep 2015
                          Gender: Male
                          Posts: 9
                          ---------------------------
                          Pokemon Essentials
                          ---------------------------
                          Exception: RuntimeError

                          Message: Script error within event 3, map 33 (M's House):

                          Exception: TypeError

                          Message: Section041:559:in `[]'no implicit conversion from nil to integer

                          ***Full script:

                          pbViewQuests


                          Interpreter:243:in `pbExecuteScript'

                          Intl_Messages:559:in `get'

                          Intl_Messages:670:in `get'

                          Intl_Messages:707:in `pbGetMessage'

                          Quests:792:in `pbDrawQuestInfo'

                          Quests:751:in `each'

                          Quests:751:in `pbDrawQuestInfo'

                          Quests:735:in `pbDrawQuestsList'

                          Quests:681:in `pbDrawSections'

                          Quests:625:in `pbStartScene'



                          Interpreter:276:in `pbExecuteScript'

                          Interpreter:1606:in `command_355'

                          Interpreter:494:in `execute_command'

                          Interpreter:193:in `update'

                          Interpreter:106:in `loop'

                          Interpreter:198:in `update'

                          Scene_Map:103:in `follow_update'

                          Scene_Map:101:in `loop'

                          Scene_Map:114:in `follow_update'

                          PokemonFollowing:1551:in `update'



                          This exception was logged in

                          C:\Users\Michael\Saved Games/Pokemon Essentials/errorlog.txt.

                          Press Ctrl+C to copy this message to the clipboard.
                          ---------------------------
                          OK
                          ---------------------------

                          I am getting this error when ever I try and open the quest menu after accepting a quest.
                          Reply With Quote
                            #15    
                          Old December 1st, 2017 (2:43 AM).
                          Diego Mertens Diego Mertens is offline
                             
                            Join Date: Aug 2017
                            Posts: 10
                            And, the quest is just go to a map and nothing else? How can I put a quest where we have to go to a map, and pick an Hidden Object in a certain time and if you can't pick the object you just fail the mission?
                            Reply With Quote
                              #16    
                            Old January 6th, 2018 (1:37 PM).
                            Feark's Avatar
                            Feark Feark is offline
                               
                              Join Date: Nov 2017
                              Posts: 5
                              Can I add something catch a pokemon in the quests?
                              Reply With Quote
                                #17    
                              Old January 6th, 2018 (10:31 PM).
                              mej71's Avatar
                              mej71 mej71 is offline
                                 
                                Join Date: Mar 2014
                                Location: Omnipresence
                                Gender: Male
                                Posts: 1,226
                                Quote:
                                Originally Posted by Diego Mertens View Post
                                And, the quest is just go to a map and nothing else? How can I put a quest where we have to go to a map, and pick an Hidden Object in a certain time and if you can't pick the object you just fail the mission?
                                No quest objectives get completed automatically, you add the completion of quest stages programmatically in your events or in the code. So in the event where you have the hidden object, just use a conditional branch.
                                Quote:
                                Originally Posted by Feark View Post
                                Can I add something catch a pokemon in the quests?
                                You'd need to add a check in the code that triggers after battle. I'm pretty sure there are a few examples already in Essentials
                                Reply With Quote
                                  #18    
                                Old January 8th, 2018 (4:49 AM).
                                Kaito123 Kaito123 is offline
                                   
                                  Join Date: Jul 2012
                                  Gender: Male
                                  Posts: 62
                                  Is it possible to have rewards for each stage?
                                  Reply With Quote
                                    #19    
                                  Old January 8th, 2018 (1:38 PM).
                                  mej71's Avatar
                                  mej71 mej71 is offline
                                     
                                    Join Date: Mar 2014
                                    Location: Omnipresence
                                    Gender: Male
                                    Posts: 1,226
                                    Quote:
                                    Originally Posted by Kaito123 View Post
                                    Is it possible to have rewards for each stage?
                                    Not programmed into it, no. But you could have multiple related quests
                                    Reply With Quote
                                      #20    
                                    Old January 13th, 2018 (9:25 AM).
                                    Feark's Avatar
                                    Feark Feark is offline
                                       
                                      Join Date: Nov 2017
                                      Posts: 5
                                      About the stage location? The name of my map is Redwood Forest then I used the name name on stage location description and there was na error in the line 414. It didnt recognize the map. What I did wrong?
                                      Reply With Quote
                                        #21    
                                      Old January 14th, 2018 (9:41 PM). Edited January 14th, 2018 by DHMPGA.
                                      DHMPGA DHMPGA is offline
                                         
                                        Join Date: Jun 2016
                                        Posts: 2
                                        I have a problem. I can not select the quest section, that is, I can not see completed or failed missions. Help me please!

                                        Edit: In the version of Essentials 17.2 the commands X, Y and Z were deactivated, that is, the keys A, S and D. (PSystem_Controls, lines 91, 92 and 93).
                                        I solved it by replacing the following Quest script commands
                                        line 823 approximately ---> (Input :: X) by (Input :: LEFT)
                                        and Line 838 -----> (Input :: Y) by (Input :: RIGHT)

                                        I hope it helps someone else this correction :)
                                        Reply With Quote
                                          #22    
                                        Old January 20th, 2018 (6:25 AM).
                                        khkramer's Avatar
                                        khkramer khkramer is offline
                                           
                                          Join Date: Apr 2010
                                          Gender: Male
                                          Posts: 321
                                          Found a bug that prevents Quests from advancing in stage.
                                          In the class Quest, method 'stage=' the last line of code is
                                          Code:
                                          stage = value
                                          , this should be
                                          Code:
                                          @stage = value
                                          __________________


                                          Lurking for 8 years..
                                          Reply With Quote
                                            #23    
                                          Old January 22nd, 2018 (9:50 AM).
                                          jklinger410 jklinger410 is offline
                                             
                                            Join Date: Sep 2016
                                            Location: Wichita, KS
                                            Gender: Male
                                            Posts: 2
                                            This is great!

                                            Could anyone help me work this into the default menu? Like under a new menu option "Quests?"
                                            Reply With Quote
                                              #24    
                                            Old January 24th, 2018 (11:30 PM). Edited January 26th, 2018 by Bowlstir.
                                            Bowlstir's Avatar
                                            Bowlstir Bowlstir is offline
                                            Media Arts and Game Development
                                               
                                              Join Date: Apr 2008
                                              Location: USA
                                              Gender: Male
                                              Nature: Adamant
                                              Posts: 199
                                              Quote:
                                              Originally Posted by jklinger410 View Post
                                              This is great!

                                              Could anyone help me work this into the default menu? Like under a new menu option "Quests?"
                                              I'd like help with this too. Right now I'm just using a button input to bring up the script, but i forgot how to add another option to the pause menu.

                                              Side note: This mod does not work with v13. I'm running Essentials GS on that version and I get a quests screen with unaligned text and graphics.
                                              __________________


                                              Reply With Quote
                                                #25    
                                              Old January 26th, 2018 (11:41 PM).
                                              Jol the Hedgehog Jol the Hedgehog is offline
                                                 
                                                Join Date: Dec 2015
                                                Posts: 29
                                                I follow the instructions and pasted the script right above main but I ger that error
                                                Reply With Quote
                                                Reply

                                                Quick Reply

                                                Join the conversation!

                                                Create an account to post a reply in this thread, participate in other discussions, and more!

                                                Create a PokéCommunity Account

                                                Sponsored Links
                                                Thread Tools

                                                Posting Rules
                                                You may not post new threads
                                                You may not post replies
                                                You may not post attachments
                                                You may not edit your posts

                                                BB code is On
                                                Smilies are On
                                                [IMG] code is On
                                                HTML code is Off

                                                Forum Jump


                                                All times are GMT -8. The time now is 9:52 AM.