Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Problem with my CMS

ok, on my cms, when in my menu screen, if i scroll down to my limit breaks and end game, my icons stay in the same place, they never move. I have no idea how to fix this problem. posted below is my cms script.
Code:
#Custom Menu Script written by Shinami
#To change the icons used by the CMS, change the code below
#to the name of the icons you want displayed. 
#-Shinami

#rename the purple text inside the " " marks to change the icons in your command window
$item_icon = "034-Item03" #Be sure to use the graphics FULL item name
$skill_icon = "050-Skill07"
$equip_icon = "013-Body01"
$status_icon = "033-Item02"
$load_icon = "037-Item06"
$end_icon = "046-Skill03"
$limit_icon = "050-Skill07"

#Only change these if the width of the icons you specify are bigger than 24x24
#Default settings are 24 width and 24 height.
$icon_width = 24
$icon_height = 24

#==============================================================================
# ** Bitmap class
#==============================================================================
#Taken from Tsunokiette's post on the crankeye forums. - Shinami
class Bitmap
	def grade(x,y,width,height,start,finish)
		for i in 0..width
			r = start.red * (width - i) / width + finish.red * i / width
			g = start.green * (width - i) / width + finish.green * i / width
			b = start.blue * (width - i) / width + finish.blue * i / width
			a = start.alpha * (width - i) / width + finish.alpha * i / width
			fill_rect(x + i,y,1,height,Color.new(r, g, b, a))
		end
	end
	def draw_gradient(x,y,width,height,colors)
		gradient_width = ((width * 1.0) / (colors.size - 1))
   		if colors.size == 1
        grade(x,y,width,height,colors[0],colors[0])
        return
      end
		for i in 0..(colors.size - 2)
			x_var = (x + (i * gradient_width))
			grade(x_var,y,gradient_width,height,colors[i],colors[i + 1])
		end
	end
end

#==============================================================================
# ** Game_Map class
#==============================================================================
class Game_Map 
  
  def name #adding the method name
    $map_infos[@map_id] #stores the maps name. info is called with $game_map.name
  end 
end
#==============================================================================
# ** Scene_Title class
#==============================================================================
#I used Constance's 2 person script as a reference on this. - Shinami
class Scene_Title
  $map_infos = load_data("Data/MapInfos.rxdata")#This recalls the map names for use when the game starts
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end

#==============================================================================
# ** Dummy_Load
#==============================================================================
#A window class created by copying the Scene_Load script but modifying it to take you back to the menu - Shinami
class Dummy_Load < Scene_File
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Remake temporary object
    $game_temp = Game_Temp.new
    # Timestamp selects new file
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Which file would you like to load?")
  end
  #--------------------------------------------------------------------------
  # * Decision Processing
  #--------------------------------------------------------------------------
  def on_decision(filename)
    # If file doesn't exist
    unless FileTest.exist?(filename)
      # Play buzzer SE
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    # Play load SE
    $game_system.se_play($data_system.load_se)
    # Read save data
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    # Restore BGM and BGS
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    # Update map (run parallel process event)
    $game_map.update
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Cancel Processing
  #--------------------------------------------------------------------------
  def on_cancel
    # Play cancel SE
    $game_system.se_play($data_system.cancel_se)
    # Switch to title screen
    $scene = Scene_Menu.new(4)
  end
  #--------------------------------------------------------------------------
  # * Read Save Data
  #     file : file object for reading (opened)
  #--------------------------------------------------------------------------
  def read_save_data(file)
    # Read character data for drawing save file
    characters = Marshal.load(file)
    # Read frame count for measuring play time
    Graphics.frame_count = Marshal.load(file)
    # Read each type of game object
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    # If magic number is different from when saving
    # (if editing was added with editor)
    if $game_system.magic_number != $data_system.magic_number
      # Load map
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    # Refresh party members
    $game_party.refresh
  end
end
#==============================================================================
# ** Dummy_Command
#==============================================================================
#Another custom made Window class for diplaying icons across from the menu commands.
#It took a bit of time to line them up properly. - Shinami
class Dummy_Command < Window_Base
  def initialize 
   super(0, 0, 160, 225) 
   self.contents = Bitmap.new(width - 32, height - 32) 
   self.contents.font.name = "Tahoma" 
   self.contents.font.size = 24 
   refresh
end 
#-------------------------------------------------------------------------- 
# Draws info on the screen 
#-------------------------------------------------------------------------- 
def refresh
    self.contents.clear
    bitmap = RPG::Cache.icon($item_icon) 
self.contents.blt(100, 4, bitmap, Rect.new(0, 0, $icon_width, $icon_height)) 

bitmap = RPG::Cache.icon($skill_icon) 
self.contents.blt(100, 35, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

bitmap = RPG::Cache.icon($equip_icon) 
self.contents.blt(100, 70, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

bitmap = RPG::Cache.icon($status_icon) 
self.contents.blt(100, 100, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

bitmap = RPG::Cache.icon($load_icon) 
self.contents.blt(100, 133, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

bitmap = RPG::Cache.icon($end_icon) 
self.contents.blt(100, 164, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

bitmap = RPG::Cache.icon($limit_icon) 
self.contents.blt(100, 197, bitmap, Rect.new(0, 0, $icon_width, $icon_height))

  end
end
#==============================================================================
# ** Window_Location
#==============================================================================
#While I don't remember where I got this since I pulled the info from another CMS request I did
#I think it came from the 2 person CMS written by Constance. I say that because of how this code was lined out... 
#It definately has Constance's touch to it. - Shinami
class Window_Location < Window_Base 

def initialize 
super(0, 0, 260, 100)
self.contents = Bitmap.new(width - 32, height - 32) 
refresh 
end 

def refresh 
self.contents.clear 

# Map Name 
map = $game_map.name 
self.contents.font.color = system_color 
self.contents.draw_text(4, 0, 220, 32, "Location") 
self.contents.font.color = normal_color 
cx = contents.text_size(map).width
cy = contents.text_size(map).height
self.contents.draw_text(4, 25, cx, cy, map) #280 width
end 
end
#==============================================================================
# ** Window_Gold
#==============================================================================
class Window_Gold2 < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 222, 100)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    cx = contents.text_size($game_party.gold.to_s).width
    self.contents.draw_text(5, 30, cx, 32, $game_party.gold.to_s)
    self.contents.font.color = system_color
    cx = contents.text_size($data_system.words.gold).width
    self.contents.draw_text(30, 5, cx, 32, $data_system.words.gold)
    bitmap = RPG::Cache.icon("032-Item01") 
    self.contents.blt(0, 5, bitmap, Rect.new(0, 0, 32, 32)) 
  end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
#Added a few methods...some of them feel redundant but I don't feel like fixing it...
#I used Constance's 2 person script as a reference on this. 
#Some methods here were pulled from the script mentioned above too.- Shinami
class Game_Actor < Game_Battler 
  
  def exp_now
    return @exp - @exp_list[@level] 
  end 
  
  def exp_next
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  
  def exp_lvl
    return exp_next - exp_now
  end
  
#Past here in this class is my own work. - Shinami  
  def exp #exp that the hero has.
    return @exp_list[@level+1] > 0 ? @exp : 0
  end
  
  def next_exp #amount of exp until next level. unaltered formula.
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  
  def next_rest_exp #amount of exp until next level. displays formula of xp til lvl up minus exp gained.
    return @exp_list[@level+1] > 0 ? (@exp_list[@level+1]- @exp) : 0
  end
end
#==============================================================================
# ** Window_Base class
#==============================================================================
#Just a "few" methods added. The method "draw_actor_exp" was pulled from the 2 person CMS by Constance.
class Window_Base < Window
  
  def draw_actor_exp(actor, x, y)
    self.contents.font.color = system_color
    cx = contents.text_size("Next").width
    self.contents.draw_text(x, y, cx, 32, "Next")
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 40, y, 84, 32, actor.exp_lvl.to_s)
  end
  
  def draw_hp_bar(actor,x,y,width = 140)
    hp = actor.hp
    max_hp = actor.maxhp
    percentage = ((hp * 1.0) / max_hp)
    bar_width = (percentage * width)
    empty_width = (width - bar_width)
    gray = Color.new(50,50,50,255)
    hp1 = Color.new(248,45,30,255)
    hp2 = Color.new(248,116,30,255)
    hp3 = Color.new(247,154,30,255)
    hp4 = Color.new(245,203,30,255)
    hp5 = Color.new(247,231,30,255)
    hp6 = Color.new(243,247,30,255)
    hp7 = Color.new(199,247,30,255)
    hp8 = Color.new(138,247,30,255)
    hp9 = Color.new(111,247,30,255)
    hp10 = Color.new(79,247,30,255)
    hp11 = Color.new(51,247,30,255)
    #draw empty if any
    self.contents.draw_gradient(x + bar_width,y,empty_width - 1,10,[gray])
    #draw gradient
    self.contents.draw_gradient(x,y,bar_width,10,[hp1,hp2,hp3,hp4,hp5,hp6,hp7,hp8,hp9,hp10,hp11])
    #draw border
    self.contents.fill_rect(x,y,width,1,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x + width,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y + 9,width,1,Color.new(0,0,0,255))
  end
  
  def draw_sp_bar(actor,x,y,width = 140)
    sp = actor.sp
    max_sp = actor.maxsp
    percentage = ((sp * 1.0) / max_sp)
    bar_width = (percentage * width)
    empty_width = (width - bar_width)
    gray = Color.new(50,50,50,255)
    hp1 = Color.new(0,67,154,255) #Color variables go like so....red, green, blue, saturation.
    hp2 = Color.new(7,77,164,255)#No idea what saturation does >.>; yet that is...
    hp3 = Color.new(11,87,174,255)#I used Paint to produce the numbers for the pretty colors.
    hp4 = Color.new(11,97,184,255)
    hp5 = Color.new(11,107,194,255)
    hp6 = Color.new(11,117,204,255)
    hp7 = Color.new(11,127,214,255)
    hp8 = Color.new(11,137,224,255)
    hp9 = Color.new(11,147,234,255)
    hp10 = Color.new(11,157,244,255)
    hp11 = Color.new(11,167,255,255)
    #draw empty if any
    self.contents.draw_gradient(x + bar_width,y,empty_width - 1,10,[gray])
    #draw gradient
    self.contents.draw_gradient(x,y,bar_width,10,[hp1,hp2,hp3,hp4,hp5,hp6,hp7,hp8,hp9,hp10,hp11])
    #draw border
    self.contents.fill_rect(x,y,width,1,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x + width,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y + 9,width,1,Color.new(0,0,0,255))
  end
  
  def draw_xp_bar(actor,x,y,width = 140)
    xp = actor.next_rest_exp
    xp_tg = actor.next_exp
    percentage = (((100 * 1.0) / 100) - ((xp * 1.0) / xp_tg))#100 percent - (percentage of exp to lvl gained)
    bar_width = (percentage * width)
    empty_width = (width - bar_width)
    gray = Color.new(50,50,50,255)
    hp1 = Color.new(0,0,0,255)
    hp2 = Color.new(13,13,13,255)
    hp3 = Color.new(26,26,26,255)
    hp4 = Color.new(39,39,39,255)
    hp5 = Color.new(52,52,52,255)
    hp6 = Color.new(65,65,65,255)
    hp7 = Color.new(78,78,78,255)
    hp8 = Color.new(91,91,91,255)
    hp9 = Color.new(104,104,104,255)
    hp10 = Color.new(117,117,117,255)
    hp11 = Color.new(130,130,130,255)
    #draw empty if any
    self.contents.draw_gradient(x + bar_width,y,empty_width - 1,10,[gray])
    #draw gradient
    self.contents.draw_gradient(x,y,bar_width,10,[hp1,hp2,hp3,hp4,hp5,hp6,hp7,hp8,hp9,hp10,hp11])
    #draw border
    self.contents.fill_rect(x,y,width,1,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x + width,y,1,10,Color.new(0,0,0,255))
    self.contents.fill_rect(x,y + 9,width,1,Color.new(0,0,0,255))
  end
end
#==============================================================================
# ** Window_Char classes
#==============================================================================
#The idea of splitting the characters up into their own windows came from Constance's 2 person CMS.
#I still don't think this was the most effective way to set up the menu but it still looks nice. - Shinami
class Window_Char1 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 242, 191)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = 1
    x = 5
    y = 0
    actor = $game_party.actors[0]
    draw_actor_name(actor, x, y - 10)
    draw_actor_class(actor, x + 135, y - 10)
    draw_actor_level(actor, x, y + 10)
    draw_actor_state(actor, x + 130, y + 10, width = 120)
    draw_actor_graphic(actor, x + 180, y + 110)
    draw_actor_exp(actor, x, y + 107)
    draw_xp_bar(actor, x, y + 135, width = 140)
    draw_actor_hp(actor, x, y + 32)
    draw_hp_bar(actor, x, y + 62, width = 140)
    draw_actor_sp(actor, x, y + 70)
    draw_sp_bar(actor, x, y + 100, width = 140)
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
    end
  end
end
#==============================================================================
# ** Window_Char classes
#==============================================================================
#Read the notes in Window_Char1...
class Window_Char2 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 240, 191)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = 1
    x = 5
    y = 0
    if $game_party.actors.size < 2
      self.contents.draw_text(80, 80, 50, 32, "EMPTY")
    else
      actor = $game_party.actors[1]
      draw_actor_name(actor, x, y - 10)
      draw_actor_class(actor, x + 135, y - 10)
      draw_actor_level(actor, x, y + 10)
      draw_actor_state(actor, x + 130, y + 10, width = 120)
      draw_actor_graphic(actor, x + 180, y + 110)
      draw_actor_exp(actor, x, y + 107)
      draw_xp_bar(actor, x, y + 135, width = 140)
      draw_actor_hp(actor, x, y + 32)
      draw_hp_bar(actor, x, y + 62, width = 140)
      draw_actor_sp(actor, x, y + 70)
      draw_sp_bar(actor, x, y + 100, width = 140)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
    end
  end
end
#==============================================================================
# ** Window_Char classes
#==============================================================================
#Read the notes in Window_Char1...
class Window_Char3 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 242, 191)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = 1
    x = 5
    y = 0
    if $game_party.actors.size < 3
      self.contents.draw_text(80, 80, 50, 32, "EMPTY")
    else
      actor = $game_party.actors[2]
      draw_actor_name(actor, x, y - 10)
      draw_actor_class(actor, x + 135, y - 10)
      draw_actor_level(actor, x, y + 10)
      draw_actor_state(actor, x + 130, y + 10, width = 120)
      draw_actor_graphic(actor, x + 180, y + 110)
      draw_actor_exp(actor, x, y + 107)
      draw_xp_bar(actor, x, y + 135, width = 140)
      draw_actor_hp(actor, x, y + 32)
      draw_hp_bar(actor, x, y + 62, width = 140)
      draw_actor_sp(actor, x, y + 70)
      draw_sp_bar(actor, x, y + 100, width = 140)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
    end
  end
end
#==============================================================================
# ** Window_Char classes
#==============================================================================
#Read the notes in Window_Char1...
class Window_Char4 < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 241, 191)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = 1
    x = 5
    y = 0
    if $game_party.actors.size < 4
      self.contents.draw_text(80, 80, 50, 32, "EMPTY")
    else
      actor = $game_party.actors[3]
      draw_actor_name(actor, x, y - 10)
      draw_actor_class(actor, x + 135, y - 10)
      draw_actor_level(actor, x, y + 10)
      draw_actor_state(actor, x + 130, y + 10, width = 120)
      draw_actor_graphic(actor, x + 180, y + 110)
      draw_actor_exp(actor, x, y + 107)
      draw_xp_bar(actor, x, y + 135, width = 140)
      draw_actor_hp(actor, x, y + 32)
      draw_hp_bar(actor, x, y + 62, width = 140)
      draw_actor_sp(actor, x, y + 70)
      draw_sp_bar(actor, x, y + 100, width = 140)
    end
  end
  #--------------------------------------------------------------------------
  # * Cursor Rectangle Update
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
    end
  end
end
#===================================================
# - CLASS Your_Scene Begins
#===================================================
class Scene_Menu
  
#---------------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
#---------------------------------------------------------------------------------

def main
    @window1 = Window_PlayTime.new
    @window1.x =0
    @window1.y =0
    @window1.height = 100
    @window1.width = 160
    #@window1.z = 200	
   
    @window2 = Window_Location.new
    @window2.x =159
    @window2.y =0
    @window2.height = 100
    @window2.width = 260
    #@window2.z = 200	
   
    @window3 = Window_Gold2.new
    @window3.x =418
    @window3.y =0
    @window3.height = 100
    @window3.width = 222
    #@window3.z = 200	
   
    s1 = $data_system.words.item
    s2 = $data_system.words.skill
    s3 = $data_system.words.equip
    s4 = "Status"
    s5 = "Load"
    s6 = "Limit Break"
    s7 = "End Game"
    @window4 = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    @window4.index = @menu_index
    @window4.x =0
    @window4.y =99
    @window4.height = 240
    @window4.width = 160
    #@window4.z = 200
   
    @window4_2 = Dummy_Command.new
    @window4_2.x =0
    @window4_2.y =99
    @window4_2.height = 240
    @window4_2.width = 160
    
    @window5 = Window_Char1.new
    @window5.x =159
    @window5.y =99
    @window5.height = 191
    @window5.width = 242
    #@window5.z = 200	
   
    @window6 = Window_Char2.new
    @window6.x =400
    @window6.y =99
    @window6.height = 191
    @window6.width = 240
    #@window6.z = 200	
   
    @window7 = Window_Char3.new
    @window7.x =159
    @window7.y =289
    @window7.height = 191
    @window7.width = 242
    #@window7.z = 200	
   
    @window8 = Window_Char4.new
    @window8.x =400
    @window8.y =289
    @window8.height = 191
    @window8.width = 241
   #@window8.z = 200
   
   @window9 = Window_Steps.new
   @window9.x = 0
   @window9.y = 338
   @window9.height = 140
   @window9.width = 160
   
Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
     #update
      if $scene != self
        break
      end
    end

    Graphics.freeze
    @window1.dispose
    @window2.dispose
    @window3.dispose
    @window4.dispose
    @window4_2.dispose
    @window5.dispose    
    @window6.dispose   
    @window7.dispose  
    @window8.dispose 
    @window9.dispose
  end
#---------------------------------------------------------------------------------
  def update
    # Update windows
    @window1.update
    @window2.update
    @window3.update
    @window4.update
    @window4_2.update
    @window5.update
    @window6.update
    @window7.update
    @window8.update
    # If command window is active: call update_command
    if @window4.active
      update_command
      return
    end
    # If status window is active: call update_status
    if @window5.active or @window6.active or @window7.active or @window8.active
      update_status
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      $scene = Scene_Map.new
      return
    end
    # If C button was pressed
    if Input.trigger?(Input::C)
      # If command other than save or end game, and party members = 0
      if $game_party.actors.size == 0 and @command_window.index < 4
        # Play buzzer SE
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      # Branch by command window cursor position
      case @window4.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @window4.active = false
        @window5.active = true
        @window5.index = 0
        @act_index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @window4.active = false
        @window5.active = true
        @window5.index = 0
        @act_index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @window4.active = false
        @window5.active = true
        @window5.index = 0
        @act_index = 0
      when 4  #load
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Dummy_Load.new
        when 5  # limit break
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_LimitBreak.new
        when 6  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when status window is active)
  #--------------------------------------------------------------------------
  def update_status
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Make command window active
      @window4.active = true
      @window5.active = false
      @window5.index = -1
      @window6.active = false
      @window6.index = -1
      @window7.active = false
      @window7.index = -1
      @window8.active = false
      @window8.index = -1
      return
    end
    #This is what I added to Scene_Menu. It was the only thing I could think of... - Shinami
    #When the DOWN key is pushed...
    if Input.repeat?(Input::DOWN)
      if @window5.active
        unless $game_party.actors.size < 3
          $game_system.se_play($data_system.cursor_se)
          @window7.active = true
          @window7.index = 0
          @window5.active = false
          @window5.index = -1
          @act_index = 2
        end
      end
      if @window6.active
        unless $game_party.actors.size < 4
          $game_system.se_play($data_system.cursor_se)
          @window8.active = true
          @window8.index = 0
          @window6.active = false
          @window6.index = -1
          @act_index = 3
        end
      end
    end
    #When the UP key is pushed...
    if Input.repeat?(Input::UP)
      if @window7.active
        $game_system.se_play($data_system.cursor_se)
        @window5.active = true
        @window5.index = 0
        @window7.active = false
        @window7.index = -1
        @act_index = 0
      end
      if @window8.active
        $game_system.se_play($data_system.cursor_se)
        @window6.active = true
        @window6.index = 0
        @window8.active = false
        @window8.index = -1
        @act_index = 1
      end
    end
    #When the RIGHT key is pushed...
    if Input.repeat?(Input::RIGHT)
      if @window5.active
        unless $game_party.actors.size < 2
          $game_system.se_play($data_system.cursor_se)
          @window6.active = true
          @window6.index = 0
          @window5.active = false
          @window5.index = -1
          @act_index = 1
        end
      end
      if @window7.active
        unless $game_party.actors.size < 4
          $game_system.se_play($data_system.cursor_se)
          @window8.active = true
          @window8.index = 0
          @window7.active = false
          @window7.index = -1
          @act_index = 3
        end
      end
    end
    #When the LEFT key is pushed...
    if Input.repeat?(Input::LEFT)
      if @window6.active
        $game_system.se_play($data_system.cursor_se)
        @window5.active = true
        @window5.index = 0
        @window6.active = false
        @window6.index = -1
        @act_index = 0
      end
      if @window8.active
        $game_system.se_play($data_system.cursor_se)
        @window7.active = true
        @window7.index = 0
        @window8.active = false
        @window8.index = -1
        @act_index = 2
      end
    end
    #And this here is the end of my own custom, inefficient solution for 4 seperate windows...
    #Yes...I don't like the solution I used but hell...it got the job done. - Shinami
    # If C button was pressed
    if Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @window4.index
      when 1  # skill
        # If this actor's action limit is 2 or more
        for i in 0...$game_party.actors.size
          if $game_party.actors[i].restriction >= 2
            # Play buzzer SE
            $game_system.se_play($data_system.buzzer_se)
            return
          end
        end
          # Play decision SE
          $game_system.se_play($data_system.decision_se)
          # Switch to skill screen
          $scene = Scene_Skill.new(@act_index)
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to equipment screen
        $scene = Scene_Equip.new(@act_index)
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to status screen
        $scene = Scene_Status.new(@act_index)
      end
      return
    end
  end
end
#===================================================
# - CLASS Your_Scene Ends
#===================================================
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top