Options Menu Script

Started by Trainer Zydragon, February 21, 2010, 08:49:24 pm

Previous topic - Next topic

Trainer Zydragon

Ok here's the deal, i'm scripting (slowly) an Options menu for my game...

All I would like to know is what kind of options you guys would like in a game :D

Bear in mind this game does NOT have an ABS or ATB/sideview battlers script.

WhiteRose

If you're looking for a bit of a challenge, maybe you could make an option where you can turn battle animations on and off (a la Pokemon.)

Trainer Zydragon

>.< Make it easy why dontcha  :^_^':
I'm only a noob atm  :D

lilbrudder917

February 22, 2010, 12:11:06 am #3 Last Edit: February 22, 2010, 12:21:29 am by Breloom Trainer Brudder
Actually, turning on/off animations in-game is very easy.

Turn this:
Code: Line 320 of Game_Actor
  def animation1_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation1_id : 0
  end

to:
Code: Line 320 of Game_Actor
  def animation1_id
   weapon = $data_weapons[@weapon_id]
   case $NO_ANIMATION
   when true
     return 0
   end
   return weapon != nil ? weapon.animation1_id : 0
 end


and this:
Code: Line 327 of Game_Actor
  def animation2_id
    weapon = $data_weapons[@weapon_id]
    return weapon != nil ? weapon.animation2_id : 0
  end

to:
Code: Line 327 of Game_Actor
  def animation2_id
   weapon = $data_weapons[@weapon_id]
   case $NO_ANIMATION
   when true
     return 0
   end
   return weapon != nil ? weapon.animation2_id : 0
 end


All you would need then is to add something to your menu to turn it on/off, along with Zeriab's Interpreter command_355 fix.

Trainer Zydragon

tbh I think turning animations off would be abit pointless... That would make battles kinda suck, especially without an ABS or ATB system since the animations are fairly short normally anyway  ;)

ForeverZer0

I made an Options menu for my game as well. I included a windowskin changer, font type/size changer, and audio controls. I use a custom Message Window script and I made the fontchanger to allow for settings to the "System" window and the "Message" window independently.

It worked very well, but I ended up scrapping the entire thing and doing something different.
I used "Blizzard's Custom Controls" and assigned buttons configurations so that if the "1" button is held down, it displays a window on screen and the "System" font text/size can be changed with
  • ,[-],[<], and [>]. The same goes with the "2" button for the "Message" window. I use the "3" button for altering the windowskin and window opacity. The script is dependent on a couple other scripts, but if you I'll post you a copy of it to see if you can learn anything off of it.

    The current script also has the beginnings of text color changer, but isn't yet complete. To use it, hold the "4" button and toggle the colors with the assigned buttons.

    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
    # Ultimate Text/Window Customizer
    # Author: ForeverZero
    # Version: 1.00
    # Date: 2.23.2010
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
    #
    # Explanation:
    #
    #   This system will allow you to change the font type/size at any point in
    #   the game. The player change the system font (i.e. menus, etc.) seperately
    #   from the message window used for speech, etc. It will also allow the
    #   player to just as easily change the windowskin and window opacity.
    #
    # Instructions:
    #
    #  - Hold [1], press [<] and [>] to change system font, [+] and [-] for size.
    #  - Hold [2], press [<] and [>] to change message font, [+] and [-] for size.
    #  - Hold [3], press [<] and [>] to change skin, [+] and [-] for window opacity.
    #
    # Warnings:
    #
    #   Now, obviously making the text to big/small will cause graphical errors
    #   and cause text to be cut-off, crammed together, etc., so use this with
    #   a little common sense.
    #
    # Requirements:
    #   
    #   Need 'Blizzard's Custom Controls', else you will need to edit and create
    #   your own button configuration, which will require a small bit of know-how
    #   on scripting.
    #
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=                                 
    # BEGIN CONFIGURATION                                   
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
    #
    #
    #==============================================================================
    # ** Window_Base
    #------------------------------------------------------------------------------
    #  This class is for all in-game windows.
    #==============================================================================

                                     
    class Window_Base  < Window
     
      alias zero_norm_color normal_color
      def normal_color   
        zero_norm_color
        case $game_system.textshade
        when 0 then Color.new(255,255,255,255)
        when 1 then Color.new(0,0,0,255)
        when 2 then Color.new(255,64,64,255)
        when 3 then Color.new(64,255,64,255)
        when 4 then Color.new(255,200,0,255)
        when 5 then Color.new(128,0,255,255)
        when 6 then Color.new(0,0,255,255)
        end
      end
     
        def skinchanger_check
        $game_system.windowskin_name =
        case $game_system.skintype

        when 0 then "Black"           # Must be in Game Folder's Windowskin
        when 1 then "Black 2"         # file. Exact spelling and case sensitive.
        when 2 then "Thorns"
        when 3 then "Gold Leaf"
        when 4 then "Charcoal"
        when 5 then "Curtain"
        when 6 then "Parchment"
        when 7 then "Curtain 2"
        when 8 then "Sand"
        when 9 then "Purple"
        when 10 then "Black Pearl"
        when 11 then "Clover"
        when 12 then "Darkness"
        when 13 then "Simple Blue"
        when 14 then "XP Default"
        when 15 then "Black 3"
        when 16 then "Fire"
        when 17 then "Lufia01"
        when 18 then "Lufia02"
        when 19 then "Hell Breath"
        when 20 then "Simple White"
        when 21 then "Green"
        end
      end
    end
              TOTAL_SKINS = 22 # Be sure to adjust this to the total number
                               # of windowskins used, including zero.
    #==============================================================================
    # ** Game_System
    #==============================================================================

    class Game_System
     
      attr_accessor :system_font_changer
      attr_accessor :system_size_changer
      attr_accessor :message_font_changer
      attr_accessor :message_size_changer
      attr_accessor :window_opacity
      attr_accessor :skintype
      attr_accessor :textshade
     
      alias zero_ultimate_option_window_init initialize
      def initialize
        zero_ultimate_option_window_init
        @system_font_changer = 0      # Default System Font Type (see below)
        @system_size_changer = 15     # Default System Font Size
        @message_font_changer = 0     # Default Message Font Type (see below)
        @message_size_changer = 24    # Default Message Font Size
        @window_opacity = 160         # Default Window Opacity
        @skintype = 0                 # Default Windowskin (see above)
        @textshade = 0
        check_for_window_change
      end
     
      def check_for_window_change
        Font.default_size = @system_size_changer
        @message.font_size = @message_size_changer
       
        # System Fonts
        # Add or remove as many as needed, just follow the pattern.
        Font.default_name = case @system_font_changer
            when 0 then "Calibri"                         # **KEY GLOSSARY**
            when 1 then "Comic Sans MS"                   # [1] = SYSTEM_FONT
            when 2 then "Times New Roman"                 # [2] = MESSAGE_FONT
            when 3 then "Candara"                         # [3] = WINDOW
            when 4 then "Arial"                           # [<] = OPTIONLEFT
            when 5 then "Estrangelo Edessa"               # [>] = OPTIONRIGHT
            when 6 then "Tahoma"                          # [-] = OPTIONDOWN
            when 7 then "Tempus Sans ITC"                 # [+] = OPTIONUP
            when 8 then "Verdana"
            when 9 then "Century Gothic"
            when 10 then "Corbel"
            when 11 then "Kristen ITC"
            when 12 then "Segoe Print"
        end
                    @SYSTEM_FONTS = 13  # Be sure to adjust this to the total number
                                        # of system fonts used, including zero.

         
        # Message Fonts
        # Add or remove as many as needed, just follow the pattern.
        @message.font_name = case @message_font_changer
            when 0 then "Segoe Print"                     # "Komika Slick"?
            when 1 then "Nyala"                           # "Komika Slim"?
            when 2 then "Kristen ITC"                     # "Mistral"?
            when 3 then "Tempus Sans ITC"                 # "French Script MT"?
            when 4 then "Andalus"                     
            when 5 then "Calibri"
            when 6 then "Narkisim"
            when 7 then "Comic Sans MS"
            when 8 then "Papyrus"
            when 9 then "Maiandra GD"
        end
                    @MESSAGE_FONTS = 10  # Be sure to adjust this to the total number
                                         # of message fonts used, including zero.
                                           
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=                                 
    # END CONFIGURATION                                   
    #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

      end # End check_for_window_change
                                                           
      alias zero_ultimate_option_window_upd update           
      def update                                           
        zero_ultimate_option_window_upd                           
           
        # To make 'decision' sound when window is initialized
        if Input.trigger?(Input::SYSTEM_FONT) or Input.trigger?(Input::WINDOW) or Input.trigger?(Input::MESSAGE_FONT)
          $game_system.se_play($data_system.decision_se)
        end
       
        # All the input buttons were keys I assigned in Blizz's Custom Controls
       
        if Input.press?(Input::SYSTEM_FONT)                 
          if Input.trigger?(Input::OPTIONLEFT)             
              @system_font_changer -= 1                 
              @system_font_changer %= @SYSTEM_FONTS
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change                     
          elsif Input.trigger?(Input::OPTIONRIGHT) 
              @system_font_changer += 1
              @system_font_changer %= @SYSTEM_FONTS
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change 
          elsif Input.trigger?(Input::OPTIONDOWN) 
              @system_size_changer -= 1
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change
          elsif Input.trigger?(Input::OPTIONUP) 
              @system_size_changer += 1
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change
            end
          end
                                   
        if Input.press?(Input::MESSAGE_FONT)                     
          if Input.trigger?(Input::OPTIONLEFT)         
              @message_font_changer -= 1               
              @message_font_changer %= @MESSAGE_FONTS
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change                         
          elsif Input.trigger?(Input::OPTIONRIGHT) 
              @message_font_changer += 1
              @message_font_changer %= @MESSAGE_FONTS
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change 
          elsif Input.trigger?(Input::OPTIONDOWN) 
              @message_size_changer -= 1
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change
          elsif Input.trigger?(Input::OPTIONUP) 
              @message_size_changer += 1
              $game_system.se_play($data_system.cursor_se)
              check_for_window_change
            end
          end
         
          if Input.press?(Input::WINDOW)
            if Input.trigger?(Input::OPTIONDOWN) 
              @window_opacity -= 5                  # Opacity: 0 - 255 (Loops)
              @window_opacity %= 255
              $game_system.se_play($data_system.cursor_se)
            elsif Input.trigger?(Input::OPTIONUP) 
              @window_opacity += 5
              @window_opacity %= 255
              $game_system.se_play($data_system.cursor_se)
            elsif Input.trigger?(Input::OPTIONLEFT) 
              @skintype -= 1
              @skintype %= TOTAL_SKINS
              $game_system.se_play($data_system.cursor_se)
            elsif Input.trigger?(Input::OPTIONRIGHT) 
              @skintype += 1
              @skintype %= TOTAL_SKINS
              $game_system.se_play($data_system.cursor_se)
            end
          end   
         
          if Input.press?(Input::FONTCOLOR)
            if Input.trigger?(Input::OPTIONDOWN) 
              @textshade -= 1                  # Opacity: 0 - 255 (Loops)
              @textshade %= 7
              $game_system.se_play($data_system.cursor_se)
            elsif Input.trigger?(Input::OPTIONUP) 
              @textshade += 1
              @textshade %= 7
              $game_system.se_play($data_system.cursor_se)
            end
          end
         
         
         
         
         
        end
      end
    #==============================================================================
    # ** Window_Dummy
    #==============================================================================

    class Window_Dummy < Window_Base
      #--------------------------------------------------------------------------
      # * Object Initialization
      #--------------------------------------------------------------------------
      def initialize
        super(0, 0, 416, 200) 
        self.opacity = $game_system.window_opacity
        self.contents = Bitmap.new(width - 32, height - 32)
        refresh
      end

      #--------------------------------------------------------------------------
      # * Refresh
      #--------------------------------------------------------------------------
      def refresh  # Shows message window.
        if Input.press?(Input::MESSAGE_FONT) or Input.trigger?(Input::MESSAGE_FONT)
        self.contents.clear
        self.windowskin = RPG::Cache.windowskin("white-windowskin_speech")
        self.contents.font.name = $game_system.message.font_name
        self.contents.font.size = $game_system.message.font_size
        self.opacity = 255
        self.contents.font.color = Color.new(0,0,0)
      else   
        skinchanger_check  # Shows system window
        self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
        self.contents.clear
        self.contents.font.name = Font.default_name
        self.contents.font.size = Font.default_size
        self.opacity = $game_system.window_opacity
        self.contents.font.color = normal_color
      end
     
        abctext = "The quick brown fox jumped over the lazy dog."
        numtext = "0 1 2 3 4 5 6 7 8 9"
        helptext = "(Use [+], [-], [<], and [>] to customize)"
        aw = contents.text_size(abctext).width
        nw = contents.text_size(numtext).width
        hw = contents.text_size(helptext).width
       
        a = contents.text_size("System Font").width
        b = contents.text_size("Message Font").width
        c = contents.text_size("System Window Base").width
     
        if Input.press?(Input::SYSTEM_FONT)
          self.contents.font.color = system_color
          self.contents.draw_text(4, 0, a, 32, "System Font", 2)
          self.contents.draw_text(4, 128, hw, 32, helptext, 2)
          self.contents.font.color = normal_color
          self.contents.draw_text(4, 32, aw, 32, abctext, 2)
          self.contents.draw_text(4, 64, nw, 32, numtext, 2)
        elsif Input.press?(Input::MESSAGE_FONT)
          self.contents.font.color = Color.new(0,64,128)
          self.contents.draw_text(4, 0, b, 32, "Message Font", 2)
          self.contents.draw_text(4, 128, hw, 32, helptext, 2)
          self.contents.font.color = Color.new(0,0,0) # Diff. color for whiteback
          self.contents.draw_text(4, 32, aw, 32, abctext, 2)
          self.contents.draw_text(4, 64, nw, 32, numtext, 2)
        elsif Input.press?(Input::WINDOW)
          self.contents.font.color = system_color
          self.contents.draw_text(4, 0, c, 32, "System Window Base", 2)
          self.contents.draw_text(4, 128, hw, 32, helptext, 2)
          self.contents.font.color = normal_color
          self.contents.draw_text(4, 32, aw, 32, abctext, 2)
          self.contents.draw_text(4, 64, nw, 32, numtext, 2)
        end
      end
    end

    #==============================================================================
    # ** Scene_Map
    #==============================================================================
    class Scene_Map
     
      alias dummy_window_main initialize
      def initialize
        dummy_window_main
        @dummy_window = Window_Dummy.new
        @dummy_window.x, @dummy_window.y = 112, 140
        @dummy_window.visible = false
      end
     
      alias dummy_window_upd update
      def update
        dummy_window_upd
        @dummy_window.update
          # Make window visible if 1, 2, or 3 button is being held down.
        if Input.press?(Input::SYSTEM_FONT) or Input.press?(Input::WINDOW) or Input.press?(Input::MESSAGE_FONT)
            @dummy_window.visible = true
        else
            @dummy_window.visible = false
        end
        # If window is visible, update
        if @dummy_window.visible == true
          update_dummy
        end

        # This is so the window refreshes as soon as the button is pressed.
        if Input.trigger?(Input::SYSTEM_FONT) or Input.trigger?(Input::WINDOW) or Input.trigger?(Input::MESSAGE_FONT)
          @dummy_window.refresh
        end
      end

      def update_dummy   # Refreshes window if any change is applied
        if Input.trigger?(Input::OPTIONUP)
          @dummy_window.refresh
        elsif Input.trigger?(Input::OPTIONDOWN)
          @dummy_window.refresh
        elsif Input.trigger?(Input::OPTIONLEFT)
          @dummy_window.refresh
        elsif Input.trigger?(Input::OPTIONRIGHT)
          @dummy_window.refresh
        end
      end
     
    end
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

ForeverZer0

Come to think of it, I might do a few edits and post this in the Script Database... Feel free to use use any part in your game if you need to, though. Hope that helped!
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Trainer Zydragon

Yeah cheers, I'll credit you if or when I get it finished.

I'm working on a number of scripts at the moment, and I've gotta make them all compatible for the same game.

ForeverZer0

Yeah, I know the feeling. I have a few other scripts, but I can't even post them because they all kind of work of of each other and would require someone else to have the same exact game setup...

I know the code above is a little screwy, it wasn't quite ready to be posted as it's own independent script.
Good luck, though.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Trainer Zydragon

Haha yeah, theyre all kinda started and left too...

Im scripting my own in-game trophy system too, and possibly an item-synth sorta thing  :^_^':