- Pokémon Essentials Version
- v21 ➖
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 v21. For the version for v19 to v20, click here: Astralneko's Trivia for v19-v20.1
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 v21. For the version for v19 to v20, click here: Astralneko's Trivia for v19-v20.1
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.
- Extract everything in the ZIP file to the root folder of your game.
- Hold CTRL when playtesting Essentials next, to ensure everything compiles correctly.
- Feel free to edit anything in _INTL() tags in the scripts (such as the stuff in the AstralnekoConfig module) to whatever formatting you prefer. Just do not edit TRIVIA_PATH, unless you wish to move default_trivia.txt somewhere else.
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.
- 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.
This plugin comes with four 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.
args are a commented list of either item symbols or an amount of the previous item. This will ask the player how much the set of items costs.
All of the above 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!
root_id is the base id, num_questions is the number of questions to ask, max_id is the number of defined questions for this lightning round in default_trivia.txt. This function, instead of returning true or false, returns the number of questions the player got right in the lightning round.
The example default_trivia.txt comes with 6 questions set up for a LevinciaOrLumiose example for this function. Run it as anLightningRound("LevinciaOrLumiose",x,6) where x is a number between 1 and 6. You may define your own lightning rounds with a similar format.
Ruby:
anTriviaQuestion(id)
Ruby:
anTriviaQuestionToNPC(id,npc_name)
Ruby:
anPriceQuestionEx(*args)
All of the above 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:
anLightningRound(root_id, num_questions, max_id)
The example default_trivia.txt comes with 6 questions set up for a LevinciaOrLumiose example for this function. Run it as anLightningRound("LevinciaOrLumiose",x,6) where x is a number between 1 and 6. You may define your own lightning rounds with a similar format.
You may wish to call on how the player answered earlier in the plugin, in which case you should use code like the following:
This will set game switch 100 (or replace 100 with whatever game switch number you wish) to false if the answer is incorrect, or true if the answer is correct. You can then use that switch in a Conditional Branch, event page, and so on to manipulate event processing.
If you're using this in a trivia game, you may also use some event processing to keep track of score in a similar vein, like so:
View attachment 14854
Ruby:
$game_switches[100] = anTriviaQuestion(id)
If you're using this in a trivia game, you may also use some event processing to keep track of score in a similar vein, like so:
View attachment 14854
- Credits
- Astralneko - code