Non-Combat Menu

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by mjshi, Sep 13, 2015.

    Tags:
  1. Akatori

    Akatori Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    French
    Thanks. I don't know why, when I did that it didn't work (even when I retried ^^") it kept showing an error message, but I guess I kept making the same mistake ? Anyway, it works now so thanks. Your menu is great, it would've killed me to have to take the default one knowing there was better...
     
    #41
  2. Reapergurl

    Reapergurl Drummer Extraordinaire! xD Veteran

    Messages:
    534
    Likes Received:
    552
    Location:
    Mordhaus, Germany
    First Language:
    British English
    Primarily Uses:
    Other
    @mjshi Here's some helpful tips.


    I just want to make people aware of this.


    If you're using Yanfly's Core Script, this will overwrite the menu methods for showing items, Status, etcetera.


    Also, if you use Yanfly's Ace Save Engine, you won't need to display 'Load' with this script because Ace Save Engine has that functionality already.


    If you use Victor Sant's Materia Script, if you want that menu option you must do the following:


    Add this under configuration:


      ['Materia', :Materia],


    And this must be added:


    def command_Materia
        SceneManager.call(Scene_MateriaEquip)
      end


    I don't believe this script will require anything for (Scene_MateriaShop) but it might...


    Just adding my little helping hands here. No thanks necessary.
     
    #42
  3. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Reapergurl I will thank you anyway xD


    And yes, this script overwrites Yanfly Core-- of course it does, it is an alternate menu script and will overwrite all other menu scripts, along with possibly even the item/status menu because it provides some modifications to the base item/status menus.


    To everyone in general:


    For Victor Sant's Materia script, and all other scripts with custom scenes, if you want to add it to the menu, and I cannot repeat this enough-- you just have to follow the instructions in the main post. Heck, if you wanted to add a shop tab to the menu screen (for whatever reason) you can do that! Just use Scene_Shop and the appropriate keyword (that's the :SCENE and the command_SCENE thing).


    You could even add a debug tab to the menu if you so choose. The possibilities are endless.


    The important things are that the :SCENE and the command_SCENE things match, otherwise, SceneManager.call(Scene_SCENE) could be anything, really.

     
    #43
    Reapergurl likes this.
  4. Reapergurl

    Reapergurl Drummer Extraordinaire! xD Veteran

    Messages:
    534
    Likes Received:
    552
    Location:
    Mordhaus, Germany
    First Language:
    British English
    Primarily Uses:
    Other
    @mjshi Ummm...


    No. I meant that the scripts by Yanfly and others will overwrite this script.


    Any menus customized by Yanfly or Victor's scripts will display as those scripts intended.


    Like, with Victor Engine - Item Command, all item tabs will be displayed instead of the tabs defined in this script.


    I also discovered some missing pieces, like Exit to Main menu, and for those who may want to see their current skills.


    For skills:


    Under Configuration:


    ['Skills', :nskills],


    And then add this:


    def command_nskills
        SceneManager.call(Scene_Skill)
      end


    Then, for Exit to Main Menu:


    Under Configuration:


    ['Main', :to_title],


    However, I will mention that a defining handler is not necessary; this is already handled in Scene_End.


    For the Record, some people may want to skip your helpful advice and/or don't understand enough about RubyScript and just want something that's more user friendly. I know, I've been there as I am a novice scripter and always ask for help.


    Also, I'll note that when starting up, if you have a common event call the menu after a choice option, it will not necessarily show the new menu.
     
    Last edited by a moderator: Jan 18, 2017
    #44
  5. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Reapergurl It depends on what order the scripts are in. Scripts towards the bottom will overwrite those on the top. Victor's item command can just as easily overwrite this menu script as this menu script could overwrite Victor's.


    In the script instructions I say to put this script above other scripts is because that way custom item scenes or equip scenes or status scenes will overwrite whatever things I have done to them, allowing for better compatibility with extended equip or items or other menus that other people have created.


    I purposefully left those things you described out. Initially, this noncombat menu had no equip or formation screen either-- after all, it was designed for a single player, non-combat game, specifically, those horror or murder-mystery type games. Over the years, people have come to like the menu for its aesthetic, and so I obliged to support the things specifically requested from me in the official script. 


    I never got the point of that to title command. There's an X button right there? MV ended up removing it, too. I don't know, it's probably just personal preference.


    --


    I was a novice scripter when I wrote this, too. This is the first script I wrote that wasn't an addon or edit of someone else's. If you read through the code, you'll notice a number of comments. Those weren't there for anyone else to read-- mostly, it was for the me of the past to comprehend what the heck my code was doing.


    I really do think that other people without any scripting knowledge can follow the instructions and CTRL+F a couple things or copy/paste a bit of code. It may seem daunting, yes, especially when they've never touched code in their life and are scared of messing up, but I want people to know that they can do it, that it really is that simple, and hopefully inspire some of them to try out changing more things, bigger things, and maybe even write something of their own.


    And when people are configuring stuff with the options? They're (technically) modifying code. That's what I think VX Ace has over RPGMaker MV. With the addition of the plugin manager-- while there is less risk of people accidentally deleting something important-- there now is a wall between the program writer and the program user. The program user no longer needs to worry about strings or numbers or arrays or hashes or boolean values but because of that they will never find out how a program works, the base data upon which its functionality sits.


    As for that last thing you mentioned, that may possibly be a bug (but also may be just how the VX Ace loads things), could you either send me a test project that shows the behavior or list steps on how I, on a new project, may reproduce what you're seeing there?
     
    #45
  6. Reapergurl

    Reapergurl Drummer Extraordinaire! xD Veteran

    Messages:
    534
    Likes Received:
    552
    Location:
    Mordhaus, Germany
    First Language:
    British English
    Primarily Uses:
    Other
    @mjshi The 'To_Title' function basically makes an exit of the game, but NOT of the application that handles it (game.exe).


    It goes to the startup menu/Title Screen/whatever you may call it.


    Actually, I see the aesthetic use for the genres mentioned, but I also like the simplicity of it; be even better if the whole menu could be moved to one corner or the side of the screen (or even make it a scrolling menu at the top or bottom much like the HUD)...


    I've not been able to get MV to work on my computer so I cannot really test out the differences myself (I think my graphics card is to blame), but oh well.


    I'm fine with VX Ace.


    Hmm, yes, I put the script at the top. Actually, I figured that to make the most sense to do.


    I'll have to upload my current project before I can give you the link. I hope it isn't too bothersome that I use MEGA.


    I don't know if I can directly attach my project folder to the post, but I'll try...


    Nope, it's too big. I'll upload it to MEGA.
     
    #46
  7. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Reapergurl I know what to title does. I mean that if you have a save option and a load option why would you need the title screen? The only other things the title would have is the actual exit game option and maybe new game. But for most games that new game option is used precisely once-- to start a new game. All the rest, if your game has branches or something, the player can just load an earlier save.


    Send me the link via PM when you're done ^^
     
    #47
    Reapergurl likes this.
  8. Reapergurl

    Reapergurl Drummer Extraordinaire! xD Veteran

    Messages:
    534
    Likes Received:
    552
    Location:
    Mordhaus, Germany
    First Language:
    British English
    Primarily Uses:
    Other
    @mjshi Good point. Although, to be honest, some games have a title screen with an awesome BGM and/or an eye candy background image (mine for example has a really sweet BGM and a decent background for now).
     
    #48
  9. Ookami Gin

    Ookami Gin Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    Spanish
    Primarily Uses:
    N/A
    how can i change the position and the size of the menu?
    ['Items', :item],
    ['Status', :status],
    ['Save', :save],
    ['Exit', :shutdown],
    well, i tried with "@command_window" and it work, but only in the gold window ^-^'
     
    #49
  10. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Ookami Gin Just re-order the commands. For example:

    ['Items', :item],
    ['Save', :save],
    ['Status', :status],
    ['Exit', :shutdown],

    I'm not sure what you mean by "size", though. If you meant that you wanted to add new commands, simply uncomment the other listed commands in the configuration. ("Uncomment" means to remove the # sign in front of the line of code)
     
    #50
  11. Ookami Gin

    Ookami Gin Warper Member

    Messages:
    2
    Likes Received:
    0
    First Language:
    Spanish
    Primarily Uses:
    N/A
    I refer to the position of the window in the screen, for example, with the script the window is in de middle, but i want that is in the upper right corner
     
    Last edited: Apr 17, 2017
    #51
  12. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Ookami Gin

    Find this part: (should be around line 221 or so)
    Code:
    def create_command_window
        @command_window = Window_GameEnd.new
      
        NonCombatMenu::MENU.each do |i|
          next if i[1].to_s == "cancel"
          @command_window.set_handler(i[1], method(("command_" + i[1].to_s).to_sym))
        end
      
        @command_window.set_handler(:cancel,   method(:return_scene))
      end
    
    And change it to:
    Code:
    def create_command_window
        @command_window = Window_GameEnd.new
      
        NonCombatMenu::MENU.each do |i|
          next if i[1].to_s == "cancel"
          @command_window.set_handler(i[1], method(("command_" + i[1].to_s).to_sym))
        end
      
        @command_window.set_handler(:cancel,   method(:return_scene))
        @command_window.x = 0
        @command_window.y = 0
      end
    
     
    #52
  13. johnnyuser

    johnnyuser Villager Member

    Messages:
    8
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    Nice script mjshi! Do you know if there is any way to get the disable save menu option (on page 3 of event commands) to work with this? If you set it to disable, it will not grey it out and you can still save. I am thinking it can be fixed with a copy and paste of some of the command window script?
     
    #53
  14. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @johnnyuser Find these lines:

    Code:
    # Overwrites Window_End to show tabs depending on configured values
    class Window_GameEnd
      def make_command_list
       NonCombatMenu::MENU.each do |i|
         i[1].to_s == "none" ? add_command(i[0], i[1], enabled = false) : add_command(i[0], i[1])
       end
      end
    end
    
    and change them to this:

    Code:
    # Overwrites Window_End to show tabs depending on configured values
    class Window_GameEnd
      def make_command_list
       NonCombatMenu::MENU.each do |i|
          if i[1].to_s == "none"
            add_command(i[0], i[1], enabled = false)
          elsif i[1].to_s == "save"
            add_command(i[0], i[1], !$game_system.save_disabled)
          else
            add_command(i[0], i[1])
          end
        end
      end
    end
    
     
    #54
    johnnyuser likes this.
  15. johnnyuser

    johnnyuser Villager Member

    Messages:
    8
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMVXA
    That's perfect! Thanks mjshi, this script is awesome:)
     
    #55
  16. Swafer

    Swafer Gremlin Member

    Messages:
    29
    Likes Received:
    0
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    So I tried this
    6.3.19.1.PNG

    End up with this

    6.3.19.2.PNG


    I don't really know how to make it work. What i was trying to do is add the Basic Options Menus script to the Non-Combat script.
     
    Last edited: Jun 4, 2019
    #56
  17. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    Line #2 should be in the normal menu list. So:
    Code:
    module NonCombatMenu
      MENU = [
      #-----------------------------------------------------------------------------
      # **CONFIGURATION**
      #-----------------------------------------------------------------------------
      # What should the actual menu show?
      # Put a # in front of the ones you don't want to show, and you can reorder
      # this list to change the order in the menu.
      # **Don't remove the comma after each []!**
      #
      ['Items',   :item],
      ['Status', :status],
      ['Save', :save],
      ['Exit', :shutdown],
      ['Options', :Options],
    
      # Other possible commands:
      ]
    
    Then, put this script under Non Combat Menu:
    Code:
    class Scene_End
      def command_Options
       SceneManager.call(Scene_Options)
      end
    end
     
    #57
  18. Swafer

    Swafer Gremlin Member

    Messages:
    29
    Likes Received:
    0
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    #58
  19. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    903
    Likes Received:
    717
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Swafer Where did you paste the first block? Did you replace the 1st block of code with the entire menu script?

    It's just an example, so you should just insert this line
    Code:
      ['Options', :options],
    between the other things, like items or save.
     
    Last edited: Jun 4, 2019
    #59
  20. Swafer

    Swafer Gremlin Member

    Messages:
    29
    Likes Received:
    0
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    I did exactly that in my version
    #-------------------------------------------------------------------------------
    # Non-Combat Menu v1.04a
    #-- Fully customizable menu geared toward less battle-oriented games.
    #-- By mjshi
    #-------------------------------------------------------------------------------
    # Installation: Put above Main, preferably also above other custom scripts.
    #-------------------------------------------------------------------------------
    # Update notes:
    #- Added support for most quest log scripts.
    #- Added support for separators.
    # Bugfixes:
    #- Fixed the gold window bug
    #- Forced the ingame menu command to call the Non-Combat Menu rather than the
    # regular one.
    #-------------------------------------------------------------------------------
    $imported = {} if $imported.nil?
    $imported["NonCombatMenu"] = true
    module NonCombatMenu
    MENU = [
    #-----------------------------------------------------------------------------
    # **CONFIGURATION**
    #-----------------------------------------------------------------------------
    # What should the actual menu show?
    # Put a # in front of the ones you don't want to show, and you can reorder
    # this list to change the order in the menu.
    # **Don't remove the comma after each []!**
    #
    ['Items', :item],
    ['Status', :status],
    #['Options', :options]
    ['Save', :save],
    ['Load', :load],
    ['Exit', :shutdown],
    # Other possible commands:
    #['Equipment', :nequip],
    #['Quest Log', :quests],
    #['Formation', :nform],
    #['Load', :load],
    #['Cancel', :cancel],
    #[' ', :none],
    # :none does nothing, so it's ideal for spacers or separators.
    ]
    #-----------------------------------------------------------------------------
    # Should the gold window be shown in the item menu?
    #
    SHOW_GOLD_WINDOW = true
    #
    # Where should it be shown (to the left? set to false. right? set to true)
    GOLD_WINDOW_ALIGN_RIGHT = false
    #
    # How wide should the window be (in pixels)? 160 is the default.
    GOLD_WINDOW_WIDTH = 160
    #
    #-----------------------------------------------------------------------------
    # How many tabs are you showing? (add up the # of true values below)
    #
    TABS_SHOWN = 2
    #
    # What should the item menu show?
    SHOW_CONSUMABLES = true # i.e. normal items
    SHOW_KEY_ITEMS = true
    SHOW_WEAPONS = false
    SHOW_ARMORS = false
    #
    # Where should the item description window be?
    # 0 = top
    # 1 = between the tabs and the item selection
    # 2 = at the bottom
    DESCR_PLACEMENT = 2
    #
    #-----------------------------------------------------------------------------
    end
    #--------------------------------------------------------------------#
    # !!! Beware of crashes and errors if you edit beyond this point !!! #
    #--------------------------------------------------------------------#
    # Overwrites the old, boring menu to use the cooler-looking Game End menu
    class Scene_Map
    def call_menu
    Sound.play_ok
    SceneManager.call(Scene_End)
    end
    end
    # Overwrites how the tabs are shown in the Items Menu
    class Window_ItemCategory
    # Changes width to allow placement of gold window.
    # If gold window doesn't exist, revert to default width.
    def window_width
    NonCombatMenu::SHOW_GOLD_WINDOW ? Graphics.width - NonCombatMenu::GOLD_WINDOW_WIDTH : Graphics.width
    end
    # Changes columns to fit tabs shown
    def col_max
    return NonCombatMenu::TABS_SHOWN
    end
    # Makes a list of commands that will be shown/hidden depending on config
    def make_command_list
    add_command(Vocab::item, :item) if NonCombatMenu::SHOW_CONSUMABLES
    add_command(Vocab::key_item, :key_item) if NonCombatMenu::SHOW_KEY_ITEMS
    add_command(Vocab::weapon, :weapon) if NonCombatMenu::SHOW_WEAPONS
    add_command(Vocab::armor, :armor) if NonCombatMenu::SHOW_ARMORS
    end
    end
    #Makes it so the user can change the gold window width
    class Window_Gold
    def window_width
    return NonCombatMenu::GOLD_WINDOW_WIDTH
    end
    end
    # Adds a gold window to the item menu & determines placement
    class Scene_Item
    def start
    super
    create_help_window

    # Checks if the gold menu should be shown
    create_gold_window if NonCombatMenu::SHOW_GOLD_WINDOW

    create_category_window
    create_item_window
    end
    def create_category_window
    @category_window = Window_ItemCategory.new
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window

    # Set Tab Menu's X depending on Gold existing or not
    if NonCombatMenu::SHOW_GOLD_WINDOW
    @category_window.x = NonCombatMenu::GOLD_WINDOW_WIDTH unless NonCombatMenu::GOLD_WINDOW_ALIGN_RIGHT
    end

    # Set description, tab menu, gold Y
    if NonCombatMenu::DESCR_PLACEMENT == 1
    @help_window.y = @category_window.height
    elsif NonCombatMenu::DESCR_PLACEMENT == 2
    @help_window.y = Graphics.height - @help_window.height
    else
    @gold_window.y = @help_window.height if NonCombatMenu::SHOW_GOLD_WINDOW
    @category_window.y = @help_window.height
    end

    @category_window.set_handler:)ok, method:)on_category_ok))
    @category_window.set_handler:)cancel, method:)return_scene))
    end
    def create_item_window

    # Changes where the item window is displayed
    if NonCombatMenu::DESCR_PLACEMENT == 1
    wy = @category_window.y + @category_window.height + @help_window.height
    elsif NonCombatMenu::DESCR_PLACEMENT == 2
    wy = @category_window.height + @help_window.height
    else
    wy = @category_window.y + @category_window.height
    end

    wh = Graphics.height - wy
    @item_window = Window_ItemList.new(0, wy, Graphics.width, wh)
    @item_window.y = @category_window.height if NonCombatMenu::DESCR_PLACEMENT == 2
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @item_window.set_handler:)ok, method:)on_item_ok))
    @item_window.set_handler:)cancel, method:)on_item_cancel))
    @category_window.item_window = @item_window
    end
    def create_gold_window
    @gold_window = Window_Gold.new
    # Makes the gold window (if aligned right) be under any new windows
    @gold_window.viewport = @viewport
    @gold_window.x = Graphics.width - NonCombatMenu::GOLD_WINDOW_WIDTH if NonCombatMenu::GOLD_WINDOW_ALIGN_RIGHT
    end
    end
    # Strips down the status menu to the very basics
    class Window_Status
    def initialize(actor)
    super((Graphics.width - 300)/2, (Graphics.height - 120)/2, 300, 120)
    @actor = actor
    refresh
    activate
    end
    def refresh
    contents.clear
    draw_block2(line_height * 0)
    end
    def draw_basic_info(x, y)
    draw_actor_name(@actor, x, y + line_height * 0.5)
    draw_actor_hp(@actor, x, y + line_height * 1.5)
    draw_actor_mp(@actor, x, y + line_height * 2.5)
    end
    end
    # Dims the Status window's background as well~
    class Scene_Status
    def create_background
    super
    @background_sprite.tone.set(0, 0, 0, 128)
    end
    end
    # Overwrites Scene_End to use Save/Load/Items
    class Scene_End
    def start
    super
    create_command_window
    create_invisible_formation_window
    end
    def create_command_window
    @command_window = Window_GameEnd.new

    NonCombatMenu::MENU.each do |i|
    next if i[1].to_s == "cancel"
    @command_window.set_handler(i[1], method(("command_" + i[1].to_s).to_sym))
    end

    @command_window.set_handler:)cancel, method:)return_scene))
    end
    def create_invisible_formation_window
    @status_window = Window_MenuStatus.new(@command_window.width, 0)
    @status_window.x = (Graphics.width - @status_window.width)/2
    @status_window.hide.deactivate
    end
    def command_item
    SceneManager.call(Scene_Item)
    end
    def command_status
    SceneManager.call(Scene_Status)
    end
    def command_save
    SceneManager.call(Scene_Save)
    end
    # Defines the load command
    def command_load
    SceneManager.call(Scene_Load)
    end
    def command_nequip
    SceneManager.call(Scene_Equip)
    end
    def command_quests
    SceneManager.call(Scene_Quest)
    end
    def command_none
    SceneManager.call(Scene_End)
    end
    def command_nform
    @command_window.hide.deactivate
    @status_window.select_last
    @status_window.show.activate
    @status_window.set_handler:)ok, method:)on_formation_ok))
    @status_window.set_handler:)cancel, method:)on_formation_cancel))
    end
    def on_formation_ok
    if @status_window.pending_index >= 0
    $game_party.swap_order(@status_window.index,
    @status_window.pending_index)
    @status_window.pending_index = -1
    @status_window.redraw_item(@status_window.index)
    else
    @status_window.pending_index = @status_window.index
    end
    @status_window.activate
    end
    def on_formation_cancel
    if @status_window.pending_index >= 0
    @status_window.pending_index = -1
    @status_window.activate
    else
    @status_window.unselect
    @status_window.hide.deactivate
    @command_window.show.activate
    end
    end
    end
    # Overwrites Window_End to show tabs depending on configured values
    class Window_GameEnd
    def make_command_list
    NonCombatMenu::MENU.each do |i|
    i[1].to_s == "none" ? add_command(i[0], i[1], enabled = false) : add_command(i[0], i[1])
    end
    end
    end
    #Call the Non-Combat Menu with event commands
    class Game_Interpreter
    def command_351
    return if $game_party.in_battle
    SceneManager.call(Scene_End)
    Window_MenuCommand::init_command_position
    Fiber.yield
    end
    end

    I don't know what you mean by first block.
     
    #60

Share This Page