- Pokémon Essentials Version
- v20.1 ➖
So I wanted to make a trivia minigame for my fangame, and realized it'd be far easier to just edit a PBS-like file whenever I wanted to add more questions. These are the fruits of my labor, and I figured I'd share this with the world.
NOTE: This plugin was made for v19.1. There is no separate version for v19.1 vs v20.1, as none of the functions used don't work in v20.1, and it has been tested there to confirm this. Essentials may get mad at you because the plugin "may not work with Essentials v20", but it will.
NOTE 2: Due to updates to the translation module in v21, this plugin will not work in v21. Click here for that one: Astralneko's Trivia for v21
Accordingly, my other resource is not required for this plugin to work, as nothing is saved to the save file. If this changes in a future version, then it will be noted.
NOTE: This plugin was made for v19.1. There is no separate version for v19.1 vs v20.1, as none of the functions used don't work in v20.1, and it has been tested there to confirm this. Essentials may get mad at you because the plugin "may not work with Essentials v20", but it will.
NOTE 2: Due to updates to the translation module in v21, this plugin will not work in v21. Click here for that one: Astralneko's Trivia for v21
Accordingly, my other resource is not required for this plugin to work, as nothing is saved to the save file. If this changes in a future version, then it will be noted.
- Download the plugin with the above link.
- Follow the instructions in the README file.
- Hold CTRL when playtesting Essentials next, to ensure everything compiles correctly.
Trivia questions are created in default_trivia.txt. There are example questions in there, to show what the plugin can do. Feel free to delete any existing questions and replace them.
A question is constructed using three values:
A question is constructed using three values:
- Id: The ID value of the question. Usually it should be a shorthand for the gist of the question.
- Question: The question itself. Write it as you would write a Show Message command. This will be translated by Essentials's translation plugin, and will be in section 200 of intl.txt. The example questions will require Mr. Gela's animated Portraits and Name Windows to work correctly (they use \xn), but this plugin doesn't require that one.
- Answer: An answer to the above question. The first answer listed will be the "correct" answer, while the next 1 or more will be incorrect answers. Don't worry about this, because in the example functions, the answers displayed to the player will be shuffled around. Like questions, answers will be translated and will appear in section 201 of intl.txt.
This plugin comes with two example functions:
id is the value you placed in the Id field above.
npc_name is the name of the character in question. You may wish to use Astralneko's Miscellaneous Scripts to fill npc_name with a random one from the plugin - just call the function with anRandomName in place of npc_name.
Both functions return true if the answer given is correct, and false if the answer given is incorrect. Run these scripts in your event or other code to ask the player questions!
Ruby:
anTriviaQuestion(id)
Ruby:
anTriviaQuestionToNPC(id,npc_name)
Both functions return true if the answer given is correct, and false if the answer given is incorrect. Run these scripts in your event or other code to ask the player questions!
You may wish to call on how the player answered earlier in the plugin, in which case you should use the following code:
This will set game variable 1 to 0 if the answer is incorrect, and 1 if the answer is correct. You can then use these values in a Conditional Branch to manipulate event processing.
If you're using this in a trivia game, you may also replace 1 and 0 with score values and use a Set Variable script to keep track of score, like so:
Ruby:
pbSet(1,anTriviaQuestion(id) ? 1 : 0)
If you're using this in a trivia game, you may also replace 1 and 0 with score values and use a Set Variable script to keep track of score, like so:
- Credits
- Astralnekomimi