Scrolling though Party members in Main Menu (More than 4 Members)

Started by Tigurus, May 16, 2010, 05:41:33 pm

Previous topic - Next topic

Tigurus

Hello,

First off, I really have no idea if this should be in Script Request or In troubleshooting. Though I guess request as something must be added but inside of an existing script so it could be Troubleshooting also...Please forgive me if I am in the wrong board D=
As for the question.

In my game project, I have this certain main menu but when I have to equip, for example, party member number 6, I can't see that party member.
I only see the first 4 party members.

Now, My question was if you press the following:
- Equipment
- Skills (Power)
- Status
That you can scroll down all the party members.

I hope that this small screenshot helps making it understand better.

Screenshot: ShowHide




This is Game_Guy's Costumizable Menu Script...I know it's from Game_Guy though, don't know the name really  :'(.
It's an RMXP script btw :)
Menu: ShowHide

$in_game
$choices_item = "Inventory"
$choices_skill = "Power"
$choices_equip = "Equipment"
$choices_status = "Status"
$choices_quest = "Quest Log"
$choices_achieve = "Medals"
$choices_save = "Save"
$choices_load = "Load"
$choices_option = "Options"
$choices_settings = "Settings"
$choices_end = "Exit"
$pic_as_back = "true" # If set to false, map is background
$pic_name = "gradation135" # Picture name for the picture you want to use
$playtime_gamename_window = "On" # Off will turn it off must be spelled Off not off same with On no on
$gold_window = "On" # Above applies here
$steps_window = "On" # Above Applies here
$scenario_window = "On"
$playtime_or_gamename = "_gamename" # Want playtime window or game name window
$gamename = "Version 0.1" # You can display anything besides a game name.
$scenario = "Scenario"
$playtime_gamename_window_opacity = 255 # Opacity for playtime/gamename window the line that goes around the window
$playtime_gamename_window_backopacity = 210 #background opacity for gamename window
$gold_window_opacity = 255 # Same above just gold_window
$gold_window_backopacity = 210 # Same above
$steps_window_opacity = 0 # Same above just steps window
$steps_window_backopacity = 0 # same above
$command_window_opacity = 255 # same above just command window
$command_window_backopacity = 210 # same above
$menustatus_window_opacity = 255 # same above just menustatus window
$menustatus_window_backopacity = 210 # same above
$scenario_window_opacity = 255
$scenario_window_backopacity = 210
$playtime_gamename_x = 480 # playtime/gamename x coordinate
$playtime_gamename_y = 224 # playtime/gamename y coordinate
$gold_window_x = 480  # Same above just gold_window
$gold_window_y = 416 # Same above
$steps_window_x = 480 # Same above just steps window
$steps_window_y = 224 # Same above
$command_window_x = 480 # same above just command window
$command_window_y = 0 # Same above
$menustatus_window_x = 0 # same above just menustatus window
$menustatus_window_y = 0 # Same above
$scenario_window_x = 480
$scenario_window_y = 320
$playtime_gamename_width = 160 # playtime/gamename widht
$playtime_gamename_height = 96 #playtime/gamename height
$gold_window_width = 160 # gold width
$gold_window_height = 64 # gold height
$steps_window_width = 160 # steps width
$steps_window_height = 96 # steps height
$scenario_window_width = 160
$scenario_window_height = 96

#------------------------------------------------------------------------------#
#                                  Windows                                     #
#------------------------------------------------------------------------------#

# For people out there who want to add more options go right ahead as the
# command menu has a scroll function thing.
# Window_Command2 which has scroll functions
class Window_Command2 < Window_Selectable
 def initialize(width, commands)
   super(0, 0, width, 224)
   @item_max = commands.size
   @commands = commands
   self.contents = Bitmap.new(width - 32, @item_max * 32)
   refresh
   self.index = 0
 end
 def refresh
   self.contents.clear
   for i in 0...@item_max
     draw_item(i, normal_color)
   bitmap = RPG::Cache.icon("1-Inventory")
   self.contents.blt(105, 4, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("2-Power")
   self.contents.blt(105, 35, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("3-Equipment")
   self.contents.blt(105, 69, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("4-Status")
   self.contents.blt(105, 100, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("5-Questlog")
   self.contents.blt(105, 132, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("6-Achievements")    
   self.contents.blt(105, 165, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("7-Save")
   self.contents.blt(105, 196, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("8-Load")
   self.contents.blt(105, 227, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("9-Settings")
   self.contents.blt(105, 260, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("10-BattleOption")
   self.contents.blt(105, 290, bitmap, Rect.new(0, 0, 24, 24))
   bitmap = RPG::Cache.icon("11-Quit")
   self.contents.blt(105, 322, bitmap, Rect.new(0, 0, 24, 24))
   end
 end
 def draw_item(index, color)
   self.contents.font.color = color
   rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   self.contents.draw_text(rect, @commands[index])
 end
 def disable_item(index)
   draw_item(index, disabled_color)
 end
end

#window gamename # now displays game name without using an actor slot
class Window_GameName < Window_Base
 
 def initialize
   super(0, 0, $playtime_gamename_width, $playtime_gamename_height)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 
 def refresh
   self.contents.clear
   self.contents.draw_text(0, 0, 130, 64, $gamename.to_s)
 end
 
end

# Altered Window_MenuStatus so it changes height depending on party member count
class Window_MenuStatus < Window_Selectable
 
 def initialize
   super(0, 0, 480, $menu_status)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
   self.active = false
   self.index = -1
 end

 def refresh
   self.contents.clear
   bitmap = RPG::Cache.icon("Medal - Emblem")
   self.contents.blt(12, 0, bitmap, Rect.new(0, 0, 24, 24))    
   @item_max = $game_party.actors.size
   for i in 0...$game_party.actors.size
     x = 64
     y = i * 116
     actor = $game_party.actors[i]
     draw_actor_graphic(actor, x - 40, y + 80)
     draw_actor_name(actor, x, y)
     draw_actor_class(actor, x + 62, y + 32)
     draw_actor_level(actor, x, y + 32)
     draw_actor_exp(actor, x, y + 64)
     draw_actor_hp(actor, x + 236, y + 32)
     draw_actor_sp(actor, x + 236, y + 64)
   end
 end

 def update_cursor_rect
   if @index < 0
     self.cursor_rect.empty
   else
     self.cursor_rect.set(0, @index * 116, self.width - 32, 96)
   end
 end
end

# Window's Steps/Gold/PLaytime Modded for height and width options
class Window_Gold < Window_Base
 def initialize
   super(0, 0, $gold_window_width, $gold_window_height)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 def refresh
   self.contents.clear
   bitmap = RPG::Cache.icon("Gold")
   self.contents.blt(110, 7, bitmap, Rect.new(0, 0, 24, 24))
   cx = contents.text_size($data_system.words.gold).width
   self.contents.font.color = normal_color
   self.contents.draw_text(4, 0, 110-cx-2, 32, $game_party.gold.to_s, 2)
   self.contents.font.color = system_color
   self.contents.draw_text(112-cx, 0, cx, 32, $data_system.words.gold, 2)
 end
end

class Window_PlayTime < Window_Base
 def initialize
   super(0, 0, $playtime_gamename_width, $playtime_gamename_height)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 def refresh
   self.contents.clear
   self.contents.font.color = system_color
   self.contents.draw_text(4, 0, 120, 32, "Play Time")
   @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 = normal_color
   self.contents.draw_text(4, 32, 120, 32, text, 2)
 end
 def update
   super
   if Graphics.frame_count / Graphics.frame_rate != @total_sec
     refresh
   end
 end
end

class Window_Steps < Window_Base
 def initialize
   super(0, 0, $steps_window_width, $steps_window_height)
   self.contents = Bitmap.new(width - 32, height - 32)
   refresh
 end
 def refresh
   self.contents.clear
   bitmap = RPG::Cache.icon("Medal - Emblem")
   self.contents.blt(100, 22, bitmap, Rect.new(0, 0, 24, 24))    
 end
end

class Window_Scenario < Window_Base
 def initialize
   super(0, 0, $scenario_window_width, $scenario_window_height)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = "Monotype Corsiva"
   self.contents.font.size = 24
   self.contents.draw_text(20, 12, 120, 32, "Prologue")  
   self.contents.draw_text(4, 32, 120, 32, "Tutorial")    
   refresh
 end
 def refresh
   bitmap = RPG::Cache.icon("Medal - Emblem")
   self.contents.blt(100, 22, bitmap, Rect.new(0, 0, 24, 24))    
 end
end


#------------------------------------------------------------------------------#
# ** Scene_Menu Modded and Customizable                                        #
#------------------------------------------------------------------------------#
#  This class performs menu screen processing.                                 #
#------------------------------------------------------------------------------#

class Scene_Menu
 
 def initialize(menu_index = 0)
   @menu_index = menu_index
 end

 def main
   # Command Window Setup
   s1 = $choices_item.to_s
   s2 = $choices_skill.to_s
   s3 = $choices_equip.to_s
   s4 = $choices_status.to_s
   s5 = $choices_quest.to_s
   s6 = $choices_achieve.to_s
   s7 = $choices_save.to_s
   s8 = $choices_load.to_s
   s9 = $choices_option.to_s
   s10 = $choices_settings.to_s
   s11 = $choices_end.to_s
   
   
   @command_window = Window_Command2.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11])
   @command_window.index = @menu_index
   @command_window.x = $command_window_x
   @command_window.y = $command_window_y
   @command_window.opacity = $command_window_opacity
   @command_window.back_opacity = $command_window_backopacity
   # If number of party members is 0 disable first four commands
   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)
     @command_window.disable_item(4)
     @command_window.disable_item(5)
     @command_window.disable_item(6)
     @command_window.disable_item(9)
   end
   if $game_system.save_disabled
     @command_window.disable_item(6)
   end
   # Keeps track of party members and alters the MenuStatus height
   if $game_party.actors.size == 0
     $menu_status = 0
   elsif $game_party.actors.size == 1
     $menu_status = 130      
   elsif $game_party.actors.size == 2
     $menu_status = 230
   elsif $game_party.actors.size == 3
     $menu_status = 330
   elsif $game_party.actors.size == 4
     $menu_status = 430
   else
     $menu_status = 555
   end
   # Checks to see if Save is Disabled
   # End Command Setup
   # Checks to see if $pic_as_back is on
   if $pic_as_back == false
     @sprite = Sprite.new
     @sprite.bitmap = RPG::Cache.picture($pic_name)
   else
     @map = Spriteset_Map.new
   end
   
   # Checks the gold window options
   if $gold_window == "On"
     @gold_window = Window_Gold.new
     @gold_window.x = $gold_window_x
     @gold_window.y = $gold_window_y
     @gold_window.opacity = $gold_window_opacity
     @gold_window.back_opacity = $gold_window_backopacity
   end
   
   # Checks the playtime/gamename window options
   if $playtime_gamename_window == "On"
      if $playtime_or_gamename == "_gamename"
        @playtime_gamename_window = Window_GameName.new
      else
        @playtime_gamename_window = WIndow_PlayTime.new
      end
      @playtime_gamename_window.x = $playtime_gamename_x
      @playtime_gamename_window.y = $playtime_gamename_y
      @playtime_gamename_window.opacity = $playtime_gamename_window_opacity
      @playtime_gamename_window.back_opacity = $playtime_gamename_window_backopacity
    end
   
   # Checks the steps window options
   if $steps_window == "On"
     @steps_window = Window_Steps.new
     @steps_window.x = $steps_window_x
     @steps_window.y = $steps_window_y
     @steps_window.opacity = $steps_window_opacity
     @steps_window.back_opacity = $steps_window_backopacity
   end
   
   if $scenario_window == "On"
     @scenario_window = Window_Scenario.new
     @scenario_window.x = $scenario_window_x
     @scenario_window.y = $scenario_window_y
     @scenario_window.opacity = $scenario_window_opacity
     @scenario_window.back_opacity = $scenario_window_backopacity
   end
       
   # checks the menustatus window options
   @status_window = Window_MenuStatus.new
   @status_window.x = $menustatus_window_x
   @status_window.y = $menustatus_window_y
   @status_window.opacity = $menustatus_window_opacity
   @status_window.back_opacity = $menustatus_window_backopacity
   Graphics.transition
   # Main loop
   loop do
     Graphics.update
     Input.update
     update
     if $scene != self
       break
     end
   end
   Graphics.freeze
   # checks to see what windows need to be disposed
   if $pic_as_back == true
     @sprite.dispose
     @sprite.bitmap.dispose
   else
     @map.dispose
   end
   if $gold_window == "On"
     @gold_window.dispose
   end
   if $playtime_gamename_window == "On"
     @playtime_gamename_window.dispose
   end
   if $steps_window == "On"
     @steps_window.dispose
   end
   if $scenario_window == "On"
     @scenario_window.dispose
   end
   @command_window.dispose
   @status_window.dispose
 end

 def update
   # checks to see what windows need to be updated
   if $gold_window == "On"
     @gold_window.update
   end
   if $playtime_gamename_window == "On"
     @playtime_gamename_window.update
   end
   if $steps_window == "On"
     @steps_window.update
   end
   if $scenario_window =="On"
     @scenario_window.update
   end
   @command_window.update
   @status_window.update
   if @command_window.active
     update_command
     return
   end
   if @status_window.active
     update_status
     return
   end
 end

 def update_command
   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 < 7
       $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  #When Items
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 2  # When power
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 3 # When Status
       $game_system.se_play($data_system.decision_se)
       @command_window.active = false
       @status_window.active = true
       @status_window.index = 0
     when 4 # When Quest_log
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Quest.new
     when 5
       $game_system.se_play($data_system.decision_se)
       $scene = Achievements.new
     when 6 #When Save
       if $game_system.save_disabled
          $game_system.se_play($data_system.buzzer_se)
       else  $game_system.se_play($data_system.decision_se)
             $scene = Scene_Save.new
       end
     when 7 # When Load
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Load.new(true)
       return
     when 8 # Battle settings
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Option.new
     when 9 # Battle settings
       $game_system.se_play($data_system.decision_se)
       $scene = Scene_Config.new
     when 10  # When End
      $game_system.se_play($data_system.decision_se)
      $scene = Scene_End.new
     return
   end
 end
end
 def update_status
   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 hope someone can help me :/
Else I need to find a different way to enhance the party equipment in the game :/

If you have a question, please ask. ^^

~Tigurus

Aqua

Don't you want it to just display all 6 of the party members at once instead of having to scroll? D:

Also...
*fixes your code tags*

Tigurus

Ack, I fail at forums today T_T
Sorry.

Well, thing is with this game. Eventually you will get also more than 6 party members.
And if it are more than 6 or 7. It will get very tight in that little main menu.

That's why I would like to have it scrolled :)
Thing is, that window with "Item, Power, Equipment ect..." is scrollable.
However, I can't find anything in the script itself which actually does that. So I don't know what to add at that party member window :(

AresWarrior


Tigurus

oohh god.
Thank you so much AresWarrior!

I tried it to build it in the script and it worked :D
After all those times >.<

Though it still has some little beauty mistakes.
But i will fix that.

Thank you so much ^^  :-*