• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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.

[Script] Multiple Choice Test

  • 129
    Posts
    12
    Years
    • Seen Dec 9, 2020
    Is it possible to insert a multiple choice test in Emerald in order to receive an item depending on the answers given?
    (eg. the test in Dragon's Den to obtain Dratini)

    My goal is to script a multiple choice test in order to give the player a Firestone/thunderstone/leafstone depending on the score realized with the answers.
     
    You would be looking to use the 'multichoice' scripting command. In Emerald it displays a message with multiple answers that you can choose between with the number of the answer chosen stored in variable 0x800D which can then be compared. It would look something like this:

    Code:
    ...
    multichoice 0x0 0x0 0x2 0x1 // Put's multichoice 0x2 in the top left corner of the screen, the B button cannot be used to exit
    copyvar 0x8000 0x800D // Moving the player's answer from variable 0x800D to 0x8000 as 0x800D will be overwritten automatically by later commands
    compare 0x8000 0x0 // Checking if the value in 0x8000 is 0x0
    if 0x1 goto @ThunderStone // If it is, they chose the first answer and get a Thunder Stone
    compare 0x8000 0x1 // Checking if the value in 0x8000 is 0x1
    if 0x1 goto @FireStone // If it is, they chose the second answer and get a Fire Stone
    compare 0x8000 0x2 // Checking if the value in 0x8000 is 0x2
    if 0x1 goto @LeafStone // If it is, they chose the third answer and get a Leaf Stone
    ...

    This is a very basic write up of how the multichoice system works but I'd suggest reading diegoisawesome's XSE tutorial to properly learn its functions. In addition, if you're using Emerald's binaries rather than the decomps, you can use LSA's multichoice box editor to change the number of available answers/ total boxes.
     
    You would be looking to use the 'multichoice' scripting command. In Emerald it displays a message with multiple answers that you can choose between with the number of the answer chosen stored in variable 0x800D which can then be compared. It would look something like this:

    Code:
    ...
    multichoice 0x0 0x0 0x2 0x1 // Put's multichoice 0x2 in the top left corner of the screen, the B button cannot be used to exit
    copyvar 0x8000 0x800D // Moving the player's answer from variable 0x800D to 0x8000 as 0x800D will be overwritten automatically by later commands
    compare 0x8000 0x0 // Checking if the value in 0x8000 is 0x0
    if 0x1 goto @ThunderStone // If it is, they chose the first answer and get a Thunder Stone
    compare 0x8000 0x1 // Checking if the value in 0x8000 is 0x1
    if 0x1 goto @FireStone // If it is, they chose the second answer and get a Fire Stone
    compare 0x8000 0x2 // Checking if the value in 0x8000 is 0x2
    if 0x1 goto @LeafStone // If it is, they chose the third answer and get a Leaf Stone
    ...

    This is a very basic write up of how the multichoice system works but I'd suggest reading diegoisawesome's XSE tutorial to properly learn its functions. In addition, if you're using Emerald's binaries rather than the decomps, you can use LSA's multichoice box editor to change the number of available answers/ total boxes.

    Thank you very much!
     
    Back
    Top