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.

Need to change this script so it fits a "special window"

Hello, i'm using a script that shows up to 16 characters, but I do need one special "thing" here, I do need one "special window" just like the "time display" but one that displays the day, month and the year, each one is designated by a variable (each).

Something like a window displaying [ex.]

8/12/2009
(var month/var day/var year)


Code:
#==============================================================================
# Window_MenuStatus
#------------------------------------------------------------------------------
#
#==============================================================================
class Window_Base < Window
  def draw_actor_level(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 32, WLH, Vocab::level_a)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + 16, y, 24, WLH, actor.level, 2)
  end
end

class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # Inicialização do objeto
  #     x : coordenada X da janela
  #     y : coordenada Y da janela
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(0, y, 544, 416)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # Atualização
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      if actor.index < 4
      x = 0
      y = actor.index * 96 + WLH / 2
      @sari = (actor.index) * 96
      elsif actor.index >= 4 and actor.index < 8
      x = 130
      y = (actor.index - 4) * 96 + WLH / 2
      @sari = (actor.index - 4) * 96
      elsif actor.index >= 8 and actor.index < 12
      x = 260
      y = (actor.index - 8) * 96 + WLH / 2
      @sari = (actor.index - 8) * 96
      elsif actor.index >= 12 and actor.index < 16
      x = 390
      y = (actor.index - 12) * 96 + WLH / 2
      @sari = (actor.index - 12) * 96
    else
      x = 0
      y = actor.index * 96 + WLH / 2
    end
    draw_actor_face(actor, x + 2, @sari , 92)
      self.contents.font.size = 14
      self.contents.font.bold = true
      draw_actor_name(actor, x, y - 18)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x, y + WLH * 2)
      draw_actor_mp(actor, x, y + WLH * 2.5)
    end
  end
  #--------------------------------------------------------------------------
  # Atualização do cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if Input.trigger?(Input::RIGHT) 
      if @index == @item_max - 1
        @index = 0
      elsif @index < @item_max - 4
        @index += 4
      else
        @index -= @item_max - 5
      end
    elsif Input.trigger?(Input::LEFT)
      if @index == 0
        @index = @item_max - 1
      elsif @index >= 4
        @index -= 4
      else
        @index += @item_max - 5
      end
      end
      
    if @index < 0               # Sem cursor
      self.cursor_rect.empty
    elsif @index < @item_max    # Padrão
      if @index < 4
        self.cursor_rect.set(0, @index * 96, contents.width / 4, 96)
      elsif @index >= 4 and @index < 8
        self.cursor_rect.set(contents.width / 4, (@index - 4) * 96, contents.width / 4, 96)
      elsif @index >= 8 and @index < 12
        self.cursor_rect.set(contents.width / 2, (@index - 8) * 96, contents.width / 4, 96)
      elsif @index >= 12 and @index < 16
        self.cursor_rect.set(contents.width * 3 / 4, (@index - 12) * 96, contents.width / 4, 96)
        else
      self.cursor_rect.set(0, @index * 96, contents.width, 96)
      end
    elsif @index >= 100         # Si
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                        # O todo
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
  end
end

#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Classe de operações na tela do menu.
#
# A janela de Comandos do Menu se torna invisível 
#     quando você segura a tecla "Shift".
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # Inicialização do objeto
  #     menu_index : posição inicial do cursor
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # Inicialização do processo
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_command_window
    @status_window = Window_MenuStatus.new(160, 0)
  end
  #--------------------------------------------------------------------------
  # Fim do processo
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # Atualização da tela
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @command_window.update
    @status_window.update
    if @command_window.active
      @command_window.visible = true
      update_command_selection
    elsif @status_window.active
      @command_window.visible = false
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # Criação da janela de comandos
  # A janela de Dinheiro está dentro dessa janela
  #--------------------------------------------------------------------------
  def create_command_window
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6], 1, 7)
    @command_window.x = Graphics.width - 160
    @command_window.z = 200
    @command_window.index = @menu_index
    @command_window.draw_currency_value($game_party.gold, 4, 24 * @command_window.row_max, 120)
    if $game_party.members.size == 0          # Se não houver membros na equipe
      @command_window.draw_item(0, false)     # Desabilita "Items"
      @command_window.draw_item(1, false)     # Desabilita "Habilidades"
      @command_window.draw_item(2, false)     # Desabilita "Equipamentos"
      @command_window.draw_item(3, false)     # Desabilita "Status"
    end
    if $game_system.save_disabled             # Se salvar for proibido
      @command_window.draw_item(4, false)     # Desabilita "Salvar"
    end
  end
  #--------------------------------------------------------------------------
  # Atualização da escolha de comando
  #--------------------------------------------------------------------------
  def update_command_selection
    if Input.press?(Input::A)
      @command_window.visible = false
    else
      @command_window.visible = true
      end
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = Scene_Map.new
    elsif Input.trigger?(Input::C)
      if $game_party.members.size == 0 and @command_window.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @command_window.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @command_window.index
      when 0      # Item
        $scene = Scene_Item.new
      when 1,2,3  # Habilidades, equipamento, status
        start_actor_selection
      when 4      # Salvar
        $scene = Scene_File.new(true, false, false)
      when 5      # Fim de jogo
        $scene = Scene_End.new
      end
    end
  end
  #--------------------------------------------------------------------------
  # Início da seleção de herói
  #--------------------------------------------------------------------------
  def start_actor_selection
    @command_window.active = false
    @status_window.active = true
    if $game_party.last_actor_index < @status_window.item_max
      @status_window.index = $game_party.last_actor_index
    else
      @status_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # Fim da seleção de herói
  #--------------------------------------------------------------------------
  def end_actor_selection
    @command_window.active = true
    @status_window.active = false
    @status_window.index = -1
  end
  #--------------------------------------------------------------------------
  # Atualização da seleção de herói
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when 1  # Habilidades
        $scene = Scene_Skill.new(@status_window.index)
      when 2  # Equipamento
        $scene = Scene_Equip.new(@status_window.index)
      when 3  # Status
        $scene = Scene_Status.new(@status_window.index)
      end
    end
  end
end
 

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