• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Simple Quest System + UI

1,224
Posts
10
Years

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
971fcad7c9752a6f7759a41082445925.gif



FAQ
  • Can you use '\b', images, or other text formatting?: No, these are currently not supported
  • More questions will appear as they are asked
 
Last edited:
1,224
Posts
10
Years
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.
 
15
Posts
7
Years
  • Age 25
  • Seen Mar 30, 2018
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.
 

Attachments

  • Screen Shot 2017-06-24 at 7.02.08 PM.png
    Screen Shot 2017-06-24 at 7.02.08 PM.png
    12.6 KB · Views: 73

dgeneratio

Dgeneratio
4
Posts
11
Years
  • Age 35
  • Seen Nov 22, 2017
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 :)
 
226
Posts
8
Years
  • Age 32
  • Seen Jul 19, 2023
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)
 
9
Posts
8
Years
  • Age 29
  • Seen Sep 8, 2018
---------------------------
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.
 
Last edited:
180
Posts
6
Years
  • Age 20
  • Seen yesterday
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?
 
1,224
Posts
10
Years
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.
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
 
5
Posts
6
Years
  • Age 28
  • Seen Mar 31, 2019
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?
 
Back
Top