Event scripting and varying choice menus

Discussion in 'RPG Maker MV' started by Kenode, Jun 23, 2018.

  1. Kenode

    Kenode Veteran Veteran

    Messages:
    66
    Likes Received:
    24
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hello, first of all, this is my first time here, so please bear with me if I ask very silly things :blush:

    So far, Googling around helped me with many doubts I had while learning RPG Maker MV, however I stumbled upon this one I can't seem to find anything about. I am trying to create a choice menu with options which vary depending on switches or variables.
    I found this thread which has given me a great start, but I am not sure if it is explained there and I am too dumb to understand, or if I am asking for something completely different to what is explained in there.

    Before you ask, no, I am not a programmer, so I'm sure it is something obvious that I am not seeing, or maybe improper syntax?
    What I am trying is, check if a specific switch is enabled, and if it is, then add the option to a list which will be called later on the choices function, but I'm running out of ideas.
     
    #1
  2. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,591
    Likes Received:
    1,000
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    That method in the code is somewhat confusing, it is actually building the entire choices from scratch through script.

    1.)
    Here are some comments on this process:

    Code:
    var choices;  //Make a variable called 'choices', it has no value yet
    if($gameSwitches.value(0)) choices+=['Switch 1'];  // If Game Switch #0 is ON, add "Switch 1" as a choice
    if($gameSwitches.value(1)) choices+=['Switch 2']; // If Game Switch #1 is ON, add "Switch 2" as a choice
    if($gameSwitches.value(2)) choices+=['Switch 3']; // If Game Switch #2 is ON, add "Switch 3" as a choice
    
    $gameMessage.setChoices(choices, 0, -1); // Create the choice window, with the choices from earlier (between 0-3 choices
                                                                        // depending on the switches
    
    $gameMessage.setChoiceCallback(function(responseIndex) {$gameVariables.setValue(100, (responseIndex+1));} );
    // Record the choice that the player made in Game Variable #100 --> if they picked the first choice then the value of Game Variable //#100 is 1. If they picked the second choice then the value of Game Variable #100 is 2.
    // This part can be made much more complicated to be flexible.
    
    Honestly.... it's pretty confusing. If this was a big part of your game, it would not be easy --> and it has a large chance of making mistakes.

    2.)
    There is an alternative which is using Hime's Hidden Choice Conditions plugin. This is better, but it still involves some scripting, which can cause mistakes.

    3.)
    If you want to wait a few days, I am planning to write a plugin that makes this much easier, and doesn't require any scripting.

    You can easily decide to <<hide,disable>> any choice directly in the choice menu.
    For example:

    Medium Quest<<2,3>>
    --This is hidden if Switch #2 is ON, and disabled if Switch #3 is on
    Here is a screenshot of how easy it would be to set up:
    ChoicesBasedOnSwitch.png

    So if you are interested in that, stay tuned!
     
    #2
  3. Kenode

    Kenode Veteran Veteran

    Messages:
    66
    Likes Received:
    24
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hello, thanks for the answer!

    Yes, that piece of code was written by me, hence why it's a mess. I even wonder if the syntax was even correct to begin with, because I get a really weird choice menu where each choice is a letter from each sentence. I wanted to avoid using plugins because I use a few Yanfly Engine Plugins, which makes me worry about inter-compatibility, plus I've read doing it through scripting would remove the limit of choices you can add in the choice box.

    Would it still be possible doing it through script using your plugin by simply adding the <<x,y>> syntax to the choice string, and perhaps maybe being able to check more than a switch? (Say, maybe two or more switches to make sure all objectives are complete, or perhaps a variable to know if you've gathered X amount of an item)

    If so, it would be perfect for my needs and I'd be looking forward to it! However, with all things said, I do feel, the choice menu in the base engine (what you get without plugins) could use a revision, but that's just me, or perhaps it's just my inexperience with it which is talking.
     
    #3
  4. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,591
    Likes Received:
    1,000
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    It's not your inexperience actually, it's a very reasonable thing that would help developers tremendously. In fact, somebody opened an MV improvement thread with this very topic, but sadly, it was never updated.

    Being able to check more than one switch & variables is certainly possible. I'll be sure to tag you when it's finished and available.
     
    #4
  5. Kenode

    Kenode Veteran Veteran

    Messages:
    66
    Likes Received:
    24
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Cool, thanks! This thing was actually driving me nuts, because I couldn't figure it out. I'll work on other parts of the game in the mean time in that case, and come back to the choices part whenever you get a working version of your plugin.
     
    #5
  6. Aloe Guvner

    Aloe Guvner Walrus Veteran

    Messages:
    1,591
    Likes Received:
    1,000
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    #6
  7. Kenode

    Kenode Veteran Veteran

    Messages:
    66
    Likes Received:
    24
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Thank you a lot, I've just read the post and it looks promising already! I will let you know in your thread how it goes later when I get to test it.
     
    #7

Share This Page