• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Astralneko's Trivia for v21

v21.1 Astralneko's Trivia for v21 1.1.0

This resource pertains to version 21.1 of Pokémon Essentials.
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.

  • 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:
  • 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.
These are then compiled by Essentials at runtime.
This plugin comes with four example functions:
Ruby:
anTriviaQuestion(id)
id is the value you placed in the Id field above.

Ruby:
anTriviaQuestionToNPC(id,npc_name)
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.

Ruby:
anPriceQuestionEx(*args)
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!

Ruby:
anLightningRound(root_id, num_questions, max_id)
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.
You may wish to call on how the player answered earlier in the plugin, in which case you should use code like the following:
Ruby:
$game_switches[100] = anTriviaQuestion(id)
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
Credits
Astralneko - code
Author
Astralneko
Downloads
279
Views
1,464
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from Astralneko

Back
Top