Problem with Actors shown in my Custom Menu

Hi, I have the problem that the Status-Window of my CMS only shows 7 actors and not more.

And I can't find what causes the Problem, Probably the Col-Methods which I have taken from Window_HorzCommand.

Maybe someone can help. You can try the Formation Command to see what I mean.

The Code for this Window starts at line 344.

Here is the a Demo:

Project14.rar

And here only the Script:

Spoiler
Code:
#==============================================================================#~  ▼  Tales of Vesperia CMS#~  -- Autor: eugene222#~  -- Version: 1.0a#~  -- Date Created: 27.09.2013#~  -- Credits: eugene222, Valentine if you use his "status_bg.png"#   #   -- Note: Do not use the Icons included in the Demo, make your owns#            I don't know who made these, so I cant give Credit. If somebody#            know, please PM me.##            I don't know who made the Background Picture. I have it from this #            site: [URL="http://hdnaturepictures.com/anime-nature-wild-jungle.html#%23==============================================================================%23"]http://hdnaturepictures.com/anime-nature-wild-jungle.html##==============================================================================#[/URL]   ▼ Changelog#==============================================================================#  Version 1.0a : Fixed a Bug when you Close the Window with no Layout Graphic#  Version 1.0  : Created the Script#==============================================================================#   ▼ Instructions#==============================================================================# To install this script, open up your script editor and copy/paste this script# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.## You need the following files in Graphics/Menu:##  Icons:#   item.png, skill.png equip.png, status.png formation.png, save.png, game_end.png#   custom1-3.png if you use custom scenes and none.png ##  Background:#   menu_bg.jpg, menu.layout.png, status.png##  See in the Demo how big the Pictures have to be.###  Use the Config-Section below to Config the Mini-Icons and the Commands.##  Only edit the the first three elements( enabled?, Name, Helptext)##  For CustomCommands look below.##==============================================================================module Eugene222  module MConfig    #---------------------------------------------------------------------------    #   *CONFIG START*    #    #    #   *Configure Icon Index*    #---------------------------------------------------------------------------        LocationIcon =  231    GoldIcon =      361    StepIcon =      467    BattleIcon =    131    TimeIcon =      280        #---------------------------------------------------------------------------    #  *Do you want to use Custom Facesets?*    #    #   set to true if yes and to false if not    #   the Custom Faceset should be 100x188    #---------------------------------------------------------------------------        CustomFace = false        #---------------------------------------------------------------------------    #   *Default Menu Commands*    #---------------------------------------------------------------------------    DC = { # Don't touch this line!    #---------------------------------------------------------------------------    # Key         enabled?,  Name,         Helptext        #---------------------------------------------------------------------------         :item       => [ true, "Item",     "Choose items",                              :command_item],         :skill      => [ true, "Skill",     "Choose skills",                              :command_personal],        :equip      => [ true, "Equipment",   "Change equipment",                      :command_personal],        :status     => [ true, "Status",    "View your status",                        :command_personal],         :formation  => [ true, "Formation",   "Change formation",                     :command_formation],                            #---------------------------------------------------------------------------    #   *Custom Menu Commands*     # Key         enabled?,  Name, Helptext, :Symbol, Scene_Name      #    #     # The Menu can handle 3 Custom Scenes. You have to set the Classname of     # the Custom Scene after the Symbol. All custom Scenes have to be on top    # of this Script.    #    # Example:    # :custom1   => [ true,  "Example", "Exampletext",       #                :custom_command, Scene_Example],    #    #---------------------------------------------------------------------------        :custom1   => [ true,  "Questlog",  "Exampletext",                     :custom_command, Scene_Item],       :custom2   => [ false,  "", "",                       :custom_command, ],                        :custom3   => [ false,  "", "",                      :custom_command, ],        #---------------------------------------------------------------------------    #   *Save And Game_END Commands*      #---------------------------------------------------------------------------    :save       => [ true,   "Speichern",  "Save your progress",                              :command_save],          :game_end   => [ true,  "Ende",        "End the game",                                :command_game_end],            #---------------------------------------------------------------------------    } # Don't touch this line!    #    #    #   *Config* END    #---------------------------------------------------------------------------  endend#==============================================================================# ** new Window_Menu# methods: initialize, set_text, create_bg, draw_location, refresh, dispose,#          dispose_icons, dispose_bg, dispose_bg1#==============================================================================class Window_Menu < Window_Help  #-----------------------------------------------------------------------------  include Eugene222::MConfig  #-----------------------------------------------------------------------------  # * initialize  #-----------------------------------------------------------------------------  def initialize(*args)    super(*args)    create_bg  end  #-----------------------------------------------------------------------------  # * set_text  #-----------------------------------------------------------------------------  def set_text(line1, line2)    unless line1 == @line1      @line1 = line1      @line2 = line2      refresh    end   end  #-----------------------------------------------------------------------------  # * create_bg  #-----------------------------------------------------------------------------  def create_bg    @bg = Sprite.new    @bg.bitmap = Cache.menu("menu_bg") rescue nil    @bg1 = Sprite.new    @bg1.bitmap = Cache.menu("menu_layout") rescue nil  end  #-----------------------------------------------------------------------------  # * draw_location  #-----------------------------------------------------------------------------  def draw_location    rect = Rect.new(contents.width/2,0, contents.width/2 - 26,line_height)    contents.font.color = hp_gauge_color1    draw_text(rect,$game_map.display_name,2)    draw_icon(LocationIcon, contents_width - 25, 0) unless $game_map.display_name == ""  end    #-----------------------------------------------------------------------------  # * refresh  #-----------------------------------------------------------------------------  def refresh    contents.clear    contents.font.bold = true    contents.font.color = system_color    rect = Rect.new(0,0,contents.width/2, line_height)    draw_text(rect,@line1)    draw_location    reset_font_settings    rect = Rect.new(0,line_height, contents.width, line_height)    draw_text(rect,@line2)  end  #-----------------------------------------------------------------------------  # * dispose  #-----------------------------------------------------------------------------  def dispose    super    dispose_bg    dispose_bg1    dispose_icons  end  #-----------------------------------------------------------------------------  # * dispose_icons  #-----------------------------------------------------------------------------  def dispose_icons    return unless @icon    @icon.dispose  end  #-----------------------------------------------------------------------------  # * dispose_bg  #-----------------------------------------------------------------------------  def dispose_bg    return unless @bg     @bg.bitmap.dispose if @bg.bitmap    @bg.dispose  end  #-----------------------------------------------------------------------------  # * dispose_bg1  #-----------------------------------------------------------------------------  def dispose_bg1    return unless @bg1    @bg1.bitmap.dispose if @bg1.bitmap    @bg1.dispose  end  #-----------------------------------------------------------------------------end#==============================================================================# ** Window_MenuCommand# new methods: init_commands, text#==============================================================================class Window_MenuCommand < Window_Command  #-----------------------------------------------------------------------------  include Eugene222::MConfig  #-----------------------------------------------------------------------------  # * initialize  #-----------------------------------------------------------------------------  def initialize(x,y)    init_commands    super(x,y)    self.width = 24 + item_max * (48+spacing)    self.height = 72    self.opacity = 0    select_last    update  end  #-----------------------------------------------------------------------------  # * Settings  #-----------------------------------------------------------------------------  def contents_width;(item_width + spacing) * item_max - spacing; end;  def contents_height; 0; end;      def item_height; 48; end;  def col_max; item_max;; end;  def spacing; 4; end;  #-----------------------------------------------------------------------------  # * make_command_list  #-----------------------------------------------------------------------------  def make_command_list    DC.each do |k, v|      case k       when :save        add_command(v[1], k, true,v[4]) if save_enabled       when :formation        add_command(v[1], k, true, v[4]) if formation_enabled       else        add_command(v[1], k, true,v[4]) if v[0]       end    end  end  #-----------------------------------------------------------------------------  # * init_commands  #-----------------------------------------------------------------------------  def init_commands    @commands = []    DC.each do |k,v|      case k       when :save        @commands << k if save_enabled       when :formation        @commands << k if formation_enabled       else        @commands << k if v[0]       end          end  end  #-----------------------------------------------------------------------------  # * draw_all_items  #-----------------------------------------------------------------------------  def draw_all_items    @sprite_items = []     @commands.each_with_index do |command,index|      icon = Cache.menu(command.to_s) rescue Cache.menu("none")      sprite = Sprite.new      sprite.bitmap = icon      sprite.x = index * (48 + spacing) + self.x + 12      sprite.y = self.y + 12      sprite.z = self.z + 1      sprite.opacity = 155      @sprite_items << sprite    end  end  #-----------------------------------------------------------------------------  # * item_rect  #-----------------------------------------------------------------------------  def item_rect(index)    rect = super    rect.x = index * (48 + spacing)    rect.y = 0    rect.width = 48    rect.height = 48    rect  end  #-----------------------------------------------------------------------------  # * update  #-----------------------------------------------------------------------------  def update    super    unless @index == @s_index      @s_index == @index      @sprite_items.each {|sprite| sprite.opacity = 155}      @sprite_items[@index].opacity = 255    end  end  #-----------------------------------------------------------------------------  # * update_help  #-----------------------------------------------------------------------------  def update_help; @help_window.set_text(command_name(index),text(index)) end;  #-----------------------------------------------------------------------------  # * text  #-----------------------------------------------------------------------------    def text(index); DC[@list[index][:symbol]][2] end;  #-----------------------------------------------------------------------------  # * dispose  #-----------------------------------------------------------------------------    def dispose    super    return unless @sprite_items    @sprite_items.each {|sprite| sprite.bitmap.dispose; sprite.dispose}    @sprite_items = nil  end  #-----------------------------------------------------------------------------end#==============================================================================# ** new Window_NewMenuStatus# methods: initialize, [...], top_col=, ensure_cursor_visible, item_rect,#          draw_item, draw_actor_simple_status, draw_actor_level, draw_actor_exp#          draw_layout, dispose#==============================================================================class Window_NewMenuStatus < Window_MenuStatus  #-----------------------------------------------------------------------------  attr_reader   :pending_index  #-----------------------------------------------------------------------------  # * initialize  #-----------------------------------------------------------------------------  def initialize(x, y)    @layout = []    @face = []    super(x, y)    self.opacity = 0    @pending_index = -1    draw_layout    refresh    p(item_max)  end  #-----------------------------------------------------------------------------  # * settings  #-----------------------------------------------------------------------------  def window_width; Graphics.width; end;  def window_height; Graphics.height - 72*2.5; end;  def contents_width; (item_width + spacing) * item_max - spacing; end;  def contents_height; item_height; end;    def spacing; 24; end;  def visible_line_number; 0; end;  def item_height; height - standard_padding * 2; end;     def col_max; 4; end;  def top_col; ox / (item_width + spacing); end;  def bottom_col; top_col + col_max - 1; end;  def bottom_col=(col); self.top_col = col - (col_max - 1); end;    #-----------------------------------------------------------------------------  # * top_col=  #-----------------------------------------------------------------------------   def top_col=(col)    col = 0 if col < 0     col = col_max - 1 if col > col_max - 1    self.ox = col * (item_width + spacing)  end  #-----------------------------------------------------------------------------  # * ensure_cursor_visible  #-----------------------------------------------------------------------------  def ensure_cursor_visible    self.top_col = index if index < top_col    self.bottom_col = index if index > bottom_col  end  #-----------------------------------------------------------------------------  # * item_rect  #-----------------------------------------------------------------------------  def item_rect(index)    rect = super    rect.x = index * (item_width + spacing)    rect.y = 0    rect  end  #-----------------------------------------------------------------------------  # * draw_item  #-----------------------------------------------------------------------------  def draw_item(index)    actor = $game_party.members[index]    enabled = $game_party.battle_members.include?(actor)    rect = item_rect(index)    draw_item_background(index)    x = rect.x + (rect.width-96)/2    y = rect.y - 4    color = Color.new(0,0,0,140)    color2 =Color.new(0,0,0,200)    #Fill Rect behind Name    contents.fill_rect(x-4, y + line_height / 3 + 4, 104, 22, color)    #Make Border around Face    contents.fill_rect(x-4, rect.y + line_height * 1 + 8, 104, 100, color2)    contents.clear_rect(x-2, rect.y + line_height * 1 + 10, 100, 96)    #Fill Rect behind the Gauges    contents.fill_rect(x-4, y +line_height * 1.5 + 102, 104, 66, color)     #Draw the things     if Eugene222::MConfig::CustomFace      draw_actor_custom_face(index, actor)     else      draw_actor_face(actor, x, rect.y + line_height * 1 + 10, enabled)     end    draw_actor_simple_status(actor, x , y)  end  def draw_actor_custom_face(index, actor)      @face[index].dispose if @face[index]      @face[index] = Sprite.new      @face[index].bitmap = Cache.menu("#{actor.name}_face")      @face[index].x = index % col_max * (item_width + spacing) + 18      @face[index].y = self.y + index / col_max * item_height + 22      @face[index].z = self.z - 1  end  #-----------------------------------------------------------------------------  # * draw_actor_simple_status  #-----------------------------------------------------------------------------  def draw_actor_simple_status(actor, x, y)    draw_actor_name(actor, x-2, y + line_height / 3 +4, 102)    draw_actor_icons(actor, x, y + line_height* 1.5 + 104, 96)    contents.font.size = 20    draw_actor_hp(actor, x-2, y + line_height * 2.5 + 102, 100)    draw_actor_mp(actor, x-2, y + line_height * 3.25 + 102, 100)    draw_actor_exp(actor,x-2, y + line_height * 1.0 + 90, 100)  end  #-----------------------------------------------------------------------------  # * draw_actor_level  #-----------------------------------------------------------------------------  def draw_actor_level(actor, x, y)    change_color(system_color)    draw_text(x, y, 24, line_height, Vocab::level_a)    change_color(normal_color)    draw_text(x + 24, y, 16, line_height, actor.level, 2)  end  def draw_current_and_max_values(x, y, width, current, max, color1, color2)    change_color(color1)    xr = x + width    draw_text(xr - 84, y, 42, line_height, current, 2)    change_color(color2)    draw_text(xr - 46, y, 12, line_height, "/", 2)    draw_text(xr - 42, y, 42, line_height, max, 2)  end  #-----------------------------------------------------------------------------  # * draw_actor_exp  #-----------------------------------------------------------------------------  def draw_actor_exp(actor, x, y, width = 124)    exp_now = actor.exp-actor.current_level_exp    exp_need  = actor.next_level_exp.to_f-actor.current_level_exp    exp = (exp_now.to_f/100)/(exp_need.to_f/100)    unless actor.max_level?        exp_rate = exp      exp_text = "#{(exp*100).to_i}%"    else      exp_rate = 1       exp_text = "MAX"    end    draw_gauge(x, y, width, exp_rate, tp_gauge_color1, tp_gauge_color2)    draw_actor_level(actor, x, y)    draw_text(x + width - 42, y, 42, line_height, exp_text , 2)  end  def draw_gauge(x, y, width, rate, color1, color2)    fill_w = (width * rate).to_i    gauge_y = y + line_height - 8    contents.fill_rect(x, gauge_y, width, 4, gauge_back_color)    contents.gradient_fill_rect(x, gauge_y, fill_w, 4, color1, color2)  end  #-----------------------------------------------------------------------------  # * draw_layout  #-----------------------------------------------------------------------------  def draw_layout    number = $game_party.members.size    if number > 4; number = 4; end;    number.times do |n|     @layout[n] = Sprite.new     @layout[n].bitmap = Cache.menu("status_bg") rescue nil     @layout[n].x = n % col_max * (item_width + spacing) + 4     @layout[n].y = self.y + n / col_max * item_height + 4     @layout[n].z = self.z - 3    end   end  #-----------------------------------------------------------------------------  # * dispose  #-----------------------------------------------------------------------------  def dispose    super    dispose_face    return unless @layout    @layout.each {|layout| layout.bitmap.dispose; layout.dispose}    @layout = nil  end  def dispose_face    return unless @face    @face.each {|face| face.dispose}  end  #-----------------------------------------------------------------------------end#==============================================================================# ** new Window_Information# methods: initialize, draw_gold, draw_steps, draw_battle_won, draw_time,#          update#==============================================================================class Window_Information < Window_Base  #-----------------------------------------------------------------------------  include Eugene222::MConfig  #-----------------------------------------------------------------------------  # * initialize  #-----------------------------------------------------------------------------  def initialize    super(0,Graphics.height-72,Graphics.width, 72)    self.opacity = 0    update  end  #-----------------------------------------------------------------------------  # * draw_gold  #-----------------------------------------------------------------------------  def draw_gold    draw_text(0, 12, contents_width/4 - 46, line_height, $game_party.gold, 2)    draw_icon(GoldIcon, contents_width/4 - 45, 12)  end  #-----------------------------------------------------------------------------  # * draw_steps  #-----------------------------------------------------------------------------  def draw_steps    draw_text(contents_width/4, 12, contents_width/4-46, line_height, $game_party.steps, 2)    draw_icon(StepIcon, contents_width*2/4 - 45, 12)  end  #-----------------------------------------------------------------------------  # * draw_battle_won  #-----------------------------------------------------------------------------  def draw_battle_won    draw_text(contents_width*2/4, 12, contents_width/4-46, line_height, $game_system.battle_won_count, 2)    draw_icon(BattleIcon, contents_width*3/4 - 45, 12)  end  #-----------------------------------------------------------------------------  # * draw_time  #-----------------------------------------------------------------------------  def draw_time    draw_text(contents_width*3/4, 12, contents_width/4-26, line_height, $game_system.playtime_s, 2)    draw_icon(TimeIcon, contents_width - 25, 12)  end  #-----------------------------------------------------------------------------  # * update  #-----------------------------------------------------------------------------  def update    super    contents.clear    draw_gold    draw_steps    draw_battle_won    draw_time  end  #-----------------------------------------------------------------------------end#==============================================================================# ** Scene_Menu# new_methods: create_information_window, custom_command#==============================================================================class Scene_Menu < Scene_MenuBase  #-----------------------------------------------------------------------------  # * start  #-----------------------------------------------------------------------------  def start    super    @info = Eugene222::MConfig::DC    @help_window = Window_Menu.new(2)    @help_window.opacity = 0    create_command_window    create_status_window    create_information_window  end  #-----------------------------------------------------------------------------  # * create_command_window  #-----------------------------------------------------------------------------  def create_command_window    @command_window = Window_MenuCommand.new(0,@help_window.height-12)    @command_window.help_window = @help_window    @info.each do |k,v|      @command_window.set_handler(k, method(v[3])) if v[0]    end    @command_window.set_handler(:cancel,    method(:return_scene))  end  #-----------------------------------------------------------------------------  # * create_information_window  #-----------------------------------------------------------------------------  def create_information_window    @information_window = Window_Information.new  end  #-----------------------------------------------------------------------------  # * create_status_window  #-----------------------------------------------------------------------------  def create_status_window    @status_window = Window_NewMenuStatus.new(0, @command_window.height*2 - 24 )  end  #-----------------------------------------------------------------------------  # * custom_command  #-----------------------------------------------------------------------------  def custom_command    SceneManager.call(@command_window.current_ext)  end  #-----------------------------------------------------------------------------end#==============================================================================# ** Cache# new method: self.menu#==============================================================================module Cache  #-----------------------------------------------------------------------------  # * self.menu  #-----------------------------------------------------------------------------  def self.menu(filename)    load_bitmap("Graphics/Menu/", filename)  end  #-----------------------------------------------------------------------------end#==============================================================================# ** BattleManager# alias Method: self.process_victory#==============================================================================module BattleManager  class << self    alias eugene222_process_vicotory process_victory    #---------------------------------------------------------------------------    # * self.process_victory    #---------------------------------------------------------------------------    def process_victory    $game_system.battle_won_count += 1    eugene222_process_vicotory    end  end  #-----------------------------------------------------------------------------end#==============================================================================# ** Game_System# alias Method: initialize# new attr_accessor: battle_won_count#==============================================================================class Game_System  #-----------------------------------------------------------------------------  attr_accessor   :battle_won_count  #-----------------------------------------------------------------------------  alias eugene222_game_system_initialize initialize  #-----------------------------------------------------------------------------  # * initialize  #-----------------------------------------------------------------------------  def initialize    @battle_won_count = 0    eugene222_game_system_initialize  end  #-----------------------------------------------------------------------------end#===============================================================================#-------------------------------------------------------------------------------# ** SCRIPT END **#-------------------------------------------------------------------------------#===============================================================================
I don't see where you are overriding the value of item_max.  The item_max method returns the number of items to display in the list.  Add this method to your class and have it return the number of items that you need to show.
Yeah, the problem is, that the all 10 actors are in the party. But only the first 7 are shown. If I press "Right" at the 7th person It will move to the 8th but It wont update.

You can use the "Formation" Command and you can switch positions of all 10 persons, but the last 3 are out of screen.

The Menu shows 4 persons and then you can scroll horizontally, but it only updates to the 7th person and I dont understand why.

How you can see on line 358 i had the same though how you at first. But It will print me "10", so there is no problem with item_max.

Im so bad at explaining, but if you try the Demo you will see what I mean.

But anyway, thank you for trying to help me^^
Ok, the problem lies in the way you are calculating the "top_col" value... that "bottom_col" value you created is just adding confusion.  I would suggest factoring it out.

When you set the "self.ox" in the top_col=() method, you need to take into account the number of items already shown.  Your code will currently only scroll for one set of images (4 items).  You need to scroll more than that since you need to show more than two pages.

You can remove the "bottom_col" member and then change the top_col=() and ensure_cursor_visible methods as follows:

#----------------------------------------------------------------------------- # * settings #----------------------------------------------------------------------------- def window_width; Graphics.width; end; def window_height; Graphics.height - 72*2.5; end; def contents_width; (item_width + spacing) * item_max - spacing; end; def contents_height; item_height; end; def spacing; 24; end; def visible_line_number; 0; end; def item_height; height - standard_padding * 2; end; def col_max; 4; end; def top_col; ox / (item_width + spacing); end; #----------------------------------------------------------------------------- # * top_col= #----------------------------------------------------------------------------- def top_col=(col) col = 0 if col < 0 col = col_max - 1 if col > col_max - 1 self.ox = (index / col_max).ceil * (item_width + spacing) * col_max end #----------------------------------------------------------------------------- # * ensure_cursor_visible #----------------------------------------------------------------------------- def ensure_cursor_visible self.top_col = ((index + 1) / col_max).floor * col_max endYou will still need to modify your background drawing routine to not draw empty backgrounds...

The one difference to what you had is that the scrolling now occurs a full page at a time, rather than one actor at a time.  You could modify the calculation in ensure_cursor_visible to change this if you really want it to scroll one actor at a time.
I will try, thanks, i just copied the methods from Window_HorzCommand without understanding what they do..., this is a mistake, which I shouldn't repeat.

*edit*

Ok that worked, thank you very much. I will try to understand now what exactly this calculations do. And the Background drawing won't be a big problem.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-actors-shown-in-my-custom-menu.18536/