Changing Menu Commands based on variable?

● ARCHIVED · READ-ONLY
Started by Dymdez 7 posts View original ↗
  1. Simple but complicated question. Can I change the name of a menu command based on whether or not a variable is greater than 0?

    Example: if 'variable x' > 0, instead of displaying "Status" display "Level Up!"

    Likewise, could I change which scene is called based on the same variable setup? That is if 'variable x > 0' call this other scene, instead of the regular status screen?
  2. Yeah, it's not too hard.

    Here's a rewrite I did of Window_MenuCommand for a game that I'm making.  In this example, if Switch 1081 is OFF (indicating the player is on a normal map), the command is "trees" (and shows up as 'Sk. Trees'), which takes them to a special Skill Trees map.  If the switch is ON (indicating they're already on the Skill Trees map), the command is "return" (and shows up as 'Return'), which takes them back to where they were when they first chose to visit the Skill Trees map.

    Code:
    class Window_MenuCommand < Window_Command  #--------------------------------------------------------------------------  # * Add Custom Set of Main Commands to List  #--------------------------------------------------------------------------  def add_custom_commands    add_command(Vocab::item,   :item,   main_commands_enabled)    add_command(Vocab::skill,  :equip3, main_commands_enabled)    add_command(Vocab::status, :status, main_commands_enabled)    add_command(Vocab::equip,  :equip,  main_commands_enabled)    add_command("Crests",      :equip2, main_commands_enabled)    if $game_switches[1081] == false      add_command("Sk. Trees",:trees, main_commands_enabled)    else      add_command("Return",    :return, main_commands_enabled)    end  endend
  3. Changing what the menu says is easy. Changing what it DOES is more complicated.


    In your example, it's very easy to make the menu say Level UP if a variable is greater than 0.


    But how are you going to implement that functionality? Just making the menu SAY Level UP is not going to MAKE your character level up when you choose the option.


    I've moved this thread to RGSSx Script Support, where ALL questions about changing menus belong. Please be sure to post your threads in the correct forum next time. Thank you.
  4. @wavelength thank you!

    Shaz- uhm, DUH!!! I already made that functionality with one of Engr. Adik's scripts :)
  5. You didn't say that and we are not mind readers.


    I was fully expecting you'd be posting another thread soon asking how to do it ;)
  6. You're welcome!  Would love to see it in action once you've got it working. :)
  7. Working on it now - It works perfectly, I need one more thing though..

    I need to make a "handle" i think its called

    so in your example you have ":return"

    Where does this come from? How do I make the handle call this scene "SceneManager.call(Scene_CustomParam)."