1 small menu edit please

Started by Zexion, October 24, 2010, 05:46:24 pm

Previous topic - Next topic

Zexion

Okay so I'm trying to make a kingdom hearts game using Mog's menu, but each scene has a few problems. Right now i only want the main menu fixed.  Everything wrong with the main menu is easily fixable, but there is 1 thing i can't get. In the demo below press x to open the menu, and the go down to status or stats whatever i named it. You will notice that once you click on it, then the cursor moves to the character, but you have to click up or down to move to the next character, but the characters go right to left! Please someone fix this glitch so that the cursor moves with the left or right arrow/ buttons.

DEMO:
http://uppit.com/5yr9l1tunxda/DEMO.zip

ForeverZer0

October 24, 2010, 06:35:42 pm #1 Last Edit: October 24, 2010, 06:37:43 pm by ForeverZer0
I didn't even look at the script, but just look through the script and look for some lines of code that read "Input.trigger?(Input::DOWN)"
or "Input.trigger?(Input::UP)". Now just make sure that they deal with changing the character index because there might be multiple times that you find them lines. Simply change the "UP" and "DOWN" to "LEFT" and "RIGHT". That will likely solve the issue. If not, let me know and I may check out the script sometime when I get the chance.

EDIT: I just went to download script. Virus protection warning popped up. If you want me to look at it, post it in a spoiler.
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.

Zexion

Its probably from uppit itself, alot of people get that from uppit but not me. anyway, there isn't anything like up or down in the script because i wouldve just changed it to left right and tested it like a noob lol. but here please try to fix it :c

Spoiler: ShowHide
#==============================================================================#
#                          SUPER CMS V 1.0                                     #
#       This script is a modification of Mog's Menu Itigo V1.5           #
#==============================================================================#

module Config
 
    # Main Menu Graphics Used
      MAIN_LAYOUT       = "Main Menu"       # Main Menu Graphics
      MAIN_BACKGROUND   = "Main Menu_bg"    # Animated background graphic
      MAIN_BACKGROUND2  = "Main Menu_bg2"   # Only used when main_fx = 3
                                            # It is mainly for a still transparent pic
    # Menu
      MAIN_FX           = 3                 # BG FX (0, Animated no bg)
                                            #       (1, Still picture)
                                            #       (2, Map as bg)
                                            #       (3, Animated with bg)
                                            # 3 is for picture with transperency
      MAIN_TRAN_TIME    = 20                # Transition Time.
      MAIN_TRAN_TYPE    = ""    # Transition Type (Name)
      MAIN_MAPNAME      = true              # If true, shows the map name
    # Font Used
      MAIN_FONT         = "Eurostile Thin"  # Font used in Main Menu
      MAIN_CURSOR       = "Indicator"       # Cursor graphic
 
  # MENU GAUGE GRAPHICS
    # Empty Bars
      MAIN_BAR_HP_bg    = "HPBG"            # Blank bar for HP
      MAIN_BAR_SP_bg    = "MPBG"            # Blank bar for SP
      MAIN_BAR_XP_bg    = "EXPBG"           # Blank bar for EXP
    # Fill Bars
      MAIN_BAR_HP       = "HP_Bar"          # Fill bar for HP
      MAIN_BAR_SP       = "MP_Bar"          # Fill bar for SP
      MAIN_BAR_XP       = "Exp_Meter"       # Fill bar for EXP
    #Background Box
      BGBox             = "Bg-Box"          # Box behind stats
     
  # MENU BUTTONS
      MENU_TYPE_1       = "MenuButtons1"   # Button layout
      MENU_TYPE_2       = "MenuButtons2"
      MENU_TYPE_3       = "MenuButtons3"
      MENU_TYPE_4       = "MenuButtons4"
      MENU_TYPE_5       = "MenuButtons5"
      MENU_TYPE_6       = "MenuButtons6"
    end
   
$mogscript = {} if $mogscript == nil
$mogscript["menu_itigo"] = true

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
#  This class handles the map. It includes scrolling and passable determining
#  functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :map_id                   # map id
  #--------------------------------------------------------------------------
  # * Map Name
  #-------------------------------------------------------------------------- 
  def mpname
    $mpname = load_data("Data/MapInfos.rxdata")
    $mpname[@map_id].name
  end
end



#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window

  #--------------------------------------------------------------------------
  # * Draw HP from Image
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #-------------------------------------------------------------------------- 
  def draw_kh_hp(actor, x, y)
    back = RPG::Cache.picture(Config::MAIN_BAR_HP_bg)
    cw = back.width 
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x + 66, y - ch + 30, back, src_rect)
    meter = RPG::Cache.picture(Config::MAIN_BAR_HP)
    cw = meter.width  * actor.hp / actor.maxhp
    ch = meter.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x + 68, y - ch + 30, meter, src_rect)
  end 
  #--------------------------------------------------------------------------
  # * Draw SP from Image
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_kh_mp(actor, x, y)
    back = RPG::Cache.picture(Config::MAIN_BAR_SP_bg )
    cw = back.width 
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x + 66, y - ch + 30, back, src_rect)
    meter = RPG::Cache.picture(Config::MAIN_BAR_SP)   
    cw = meter.width  * actor.sp / actor.maxsp
    ch = meter.height
    src_rect = Rect.new(0, 0, cw, ch)
    self.contents.blt(x + 68, y - ch + 30, meter, src_rect)
  end 
  #--------------------------------------------------------------------------
  # * Draw Box Behind Stats
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_bg_box(actor, x, y)
    back = RPG::Cache.picture(Config::BGBox )
    cw = back.width 
    ch = back.height
    src_rect = Rect.new(0, 0, cw, ch)   
    self.contents.blt(x + 66, y - ch + 30, back, src_rect)
  end 
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 80)
    text = make_battler_state_text(actor, width, true)
    self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
    self.contents.draw_text(x, y, width, 32, text, 2)
  end
end





#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #-------------------------------------------------------------------------- 
  def initialize
    super(0, 0, 640, 280)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin("")
    self.opacity = 0
    self.z = 15
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #-------------------------------------------------------------------------- 
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = i * 135
      y = 150
      actor = $game_party.actors[i]
      draw_bg_box(actor, x - 58, y - 7)
      draw_kh_hp(actor, x - 55, y - 25)
      draw_kh_mp(actor, x - 55, y - 10)
      draw_actor_level(actor, x + 21, y - 35)
      draw_actor_graphic(actor, x + 45, y - 34)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(5, @index * 62, self.width - 32, 50)
    end
  end
end




#==============================================================================
# ** Window_Gold
#------------------------------------------------------------------------------
#  This window displays amount of gold.
#==============================================================================

class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin("")
    self.opacity = 0
    self.z = 15
    refresh
  end
end



#==============================================================================
# ** Window_PlayTime
#------------------------------------------------------------------------------
#  This window displays play time on the menu screen.
#==============================================================================

class Window_PlayTime < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin("")
    self.opacity = 0
    self.z = 15
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @total_sec = Graphics.frame_count / Graphics.frame_rate
    hour = @total_sec / 60 / 60
    min = @total_sec / 60 % 60
    sec = @total_sec % 60
    text = sprintf("%02d:%02d:%02d", hour, min, sec)
    self.contents.font.color = Color.new(81,86,245,255)
    self.contents.draw_text(4, 32, 120, 32, text, 2)
  end
end






#==============================================================================
# ** Window_Map_Name
#------------------------------------------------------------------------------
#  This window displays the map name on the menu screen.
#==============================================================================

class Window_Map_Name < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.windowskin = RPG::Cache.windowskin("")
    self.opacity = 0
    self.z = 15
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = Color.new(195,66,0,255)
    self.contents.draw_text(4, 32, 120, 32, $game_map.mpname.to_s, 1)
  end
end



#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs menu screen processing.
#==============================================================================

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    s1 = ""
    s2 = ""
    s3 = ""
    s4 = ""
    s5 = ""
    s6 = ""
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    @command_window.index = @menu_index
    if $game_party.actors.size == 0
      @command_window.disable_item(0)
      @command_window.disable_item(1)
      @command_window.disable_item(2)
      @command_window.disable_item(3)
    end
    @command_window.visible = false
    @command_window.x = -640
    @mnlay = Sprite.new
    @mnlay.bitmap = RPG::Cache.picture(Config::MAIN_LAYOUT)
    @mnlay.z = 10
    @mnlay.opacity = 0
    @mnlay.x = -100
    @mncom = Sprite.new
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_1)
    @mncom.z = 100
    if Config::MAIN_FX == 0
      @mnback = Plane.new
      @mnback.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND)
      @mnback.blend_type = 0
      @mnback.z = 5
      @mnback2 = Plane.new
      @mnback2.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND)
      @mnback2.blend_type = 0
      @mnback2.z = 5
      @mnback2.opacity = 60
    elsif Config::MAIN_FX == 1
      @mnback = Plane.new
      @mnback.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND)
      @mnback.blend_type = 0
      @mnback.z = 5
    elsif Config::MAIN_FX == 3
      @spriteset = Spriteset_Map.new
      @mnback = Plane.new
      @mnback.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND)
      @mnback.blend_type = 0
      @mnback.z = 5
      @mnback2 = Plane.new
      @mnback2.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND)
      @mnback2.blend_type = 0
      @mnback2.z = 5
      @mnback2.opacity = 60
      @mnback3 = Plane.new
      @mnback3.bitmap = RPG::Cache.picture(Config::MAIN_BACKGROUND2)
      @mnback3.blend_type = 0
      @mnback3.z = 5
      @mnback3.opacity = 255
    else
      @spriteset = Spriteset_Map.new
    end
    @mnsel = Sprite.new
    @mnsel.bitmap = RPG::Cache.picture(Config::MAIN_CURSOR)
    @mnsel.z = 20
    @mnsel.x = 300
    @mnsel.y = 110
    @mnop = 100
    if $game_system.save_disabled
      @command_window.disable_item(4)
    end
    @playtime_window = Window_PlayTime.new
    @playtime_window.x = -38
    @playtime_window.y = 402
    @playtime_window.contents_opacity = 0
    if Config::MAIN_MAPNAME == true
      @mapname_window = Window_Map_Name.new
      @mapname_window.x = 450
      @mapname_window.y = -38
      @mapname_window.contents_opacity = 0
    end
    @gold_window = Window_Gold.new
    @gold_window.x = -44
    @gold_window.y = 383
    @gold_window.contents_opacity = 0
    @status_window = Window_MenuStatus.new
    @status_window.x = 295
    @status_window.y = 110
    @status_window.contents_opacity = 0
    if Config::MAIN_FX == 0
      Graphics.transition(Config::MAIN_TRAN_TIME, "Graphics/Transitions/" +
        Config::MAIN_TRAN_TYPE)
    elsif Config::MAIN_FX == 1
      Graphics.transition(Config::MAIN_TRAN_TIME, "Graphics/Transitions/" +
        Config::MAIN_TRAN_TYPE)
    else
      Graphics.transition 
    end
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    for i in 0..10 
      if Config::MAIN_FX == 0
        @mnback.oy += 1
        @mnback.ox += 1
        @mnback2.oy += 1
        @mnback2.ox -= 1
      elsif Config::MAIN_FX == 3
        @mnback.oy += 1
        @mnback.ox += 1
        @mnback2.oy += 1
        @mnback2.ox -= 1
      end
      @status_window.x += 20
      @status_window.contents_opacity -= 25
      @mnsel.opacity -= 15
      @mnsel.zoom_x += 0.03
      @mnlay.x -= 10
      @mnlay.opacity -= 25
      if Config::MAIN_MAPNAME == true
        @mapname_window.x += 5
        @mapname_window.contents_opacity -= 20
      end
      @gold_window.contents_opacity -= 25
      @playtime_window.contents_opacity -= 25
      Graphics.update   
    end
    Graphics.freeze
    @command_window.dispose
    @playtime_window.dispose
    @gold_window.dispose   
    @status_window.dispose
    @mnlay.dispose
    @mncom.dispose
    if Config::MAIN_FX == 0
      @mnback.dispose
      @mnback2.dispose
    elsif Config::MAIN_FX == 1
      @mnback.dispose
    elsif Config::MAIN_FX == 3
      @mnback.dispose
      @mnback2.dispose
      @mnback3.dispose
      @spriteset.dispose
    else
      @spriteset.dispose
    end
    @mnsel.dispose
    @mapname_window.dispose if Config::MAIN_MAPNAME == true
    Graphics.update
  end
 
 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
     if @mnsel.zoom_x > 1.6
        @mnsel.zoom_x = 1.0
        @mnsel.opacity = 266
      end     
    if @mnlay.x < 0
      @mnlay.opacity += 25
      @mnlay.x += 10
    elsif @mnlay.x >= 0 
      @mnlay.opacity = 255
      @mnlay.x = 0
    end
    @command_window.update if @command_window.active
    @playtime_window.update
    @status_window.update if @status_window.active
    if Config::MAIN_FX == 0
      @mnback.oy += 1
      @mnback.ox += 1
      @mnback2.oy += 1
      @mnback2.ox -= 1
    elsif Config::MAIN_FX == 3
      @mnback.oy += 1
      @mnback.ox += 1
      @mnback2.oy += 1
      @mnback2.ox -= 1

    end
    @mapname_window.contents_opacity += 15 if Config::MAIN_MAPNAME == true
    @playtime_window.contents_opacity += 15
    @gold_window.contents_opacity += 15
    @playtime_window.contents_opacity += 15
    if @status_window.x > 195
      @status_window.x -= 10
      @status_window.contents_opacity += 10
    elsif @status_window.x <= 195
      @status_window.x = 195
      @status_window.contents_opacity = 255
    end
    if @command_window.active
      update_command
      return
    end
    if @status_window.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    case @command_window.index
    when 0 
      @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_1)
    when 1
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_2)
    when 2
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_3)
    when 3
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_4)
    when 4
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_5)
    when 5
    @mncom.bitmap = RPG::Cache.picture(Config::MENU_TYPE_6)
    end   
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      if $game_party.actors.size == 0 and @command_window.index < 4
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      case @command_window.index
      when 0
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Item.new
      when 1
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3
        $game_system.se_play($data_system.decision_se)
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4
        if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
        return
      end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Save.new
      when 5
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status 
    case @status_window.index
    when 0 
      @mnsel.x = 190
      @mnsel.y = 195
    when 1
      @mnsel.x = 323
      @mnsel.y = 195
    when 2
      @mnsel.x = 455
      @mnsel.y = 195
    when 3
      @mnsel.x = 180
      @mnsel.y = 320
    end 
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      @command_window.active = true
      @status_window.active = false
      @status_window.index = -1
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 1
        if $game_party.actors[@status_window.index].restriction >= 2
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Skill.new(@status_window.index)
      when 2 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Equip.new(@status_window.index)
      when 3 
        $game_system.se_play($data_system.decision_se)
        $scene = Scene_Status.new(@status_window.index)
        end
      return
    end
  end
end


I only included a demo because it requires image files or else it gives errors lol.

ForeverZer0

Okay, I see the prob. It is with the Window_Selectable being the superclass for the CMS. It has scroll functions built in that are for up and down movement. You will need to make edits in that, or another option is use a Window_Selectable_H script, which is the same as Window_Selectable, but made for horizontal movement. I believe Blizzard wrote a good one. Just place it in with your scripts, and change the superclass.
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.