Annuaire du RPG
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Annuaire du RPG

Répertoire de ressources/scripts[...] pour le logiciel Rpg Maker !
 
AccueilAccueil  PortailPortail  Dernières imagesDernières images  RechercherRechercher  S'enregistrerS'enregistrer  ConnexionConnexion  
-30%
Le deal à ne pas rater :
LEGO Icons 10318 – Le Concorde à 139,99€
139.99 € 198.99 €
Voir le deal

 

 VX - Menu Resident Evil 4

Aller en bas 
AuteurMessage
Neko
Fondateur
Fondateur
Neko


Messages : 184
Date d'inscription : 14/07/2013
Age : 25
Localisation : Ici, la plupart du temps.

VX - Menu Resident Evil 4 Empty
MessageSujet: VX - Menu Resident Evil 4   VX - Menu Resident Evil 4 Icon_minitimeSam 3 Aoû - 20:07

Aucune image n'est nécessaire ...
Si vous l'utilisez, nommez "Alucard_2" dans vos crédit
A placer au-dessus de Main.

Screen :

VX - Menu Resident Evil 4 007-swamp01-16a760f

VX - Menu Resident Evil 4 007-swamp01-16a7636

VX - Menu Resident Evil 4 007-swamp01-16a7653

VX - Menu Resident Evil 4 007-swamp01-16a7671

VX - Menu Resident Evil 4 007-swamp01-16a769e

Script :

Code:


########################################################################################

# Resident Evil 2/3 Menu v. 2.0 by Alucard_2                                          #

########################################################################################

# Feito por Alucard_2                                                                  #

########################################################################################

# Créditos para Alucard_2(criador) e para br_lemes(que me ensinou RGSS2 um pouco mais) #

#--------------------------------------------------------------------------------------#

# IMPORTANTE: Ao colocar este script em outro forum/site/outros, favor dar os créditos!#

########################################################################################



#####################

# Window_MenuStatus #

#####################

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, 112, 544, 248)

    refresh

    self.active = false

    self.index = -1

  end

  #--------------------------------------------------------------------------

  # Atualização

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    @item_max = 1

    draw_actor_state($game_party.members[0], x, y)

    end

  end

  #--------------------------------------------------------------------------

  # Atualização do cursor

  #--------------------------------------------------------------------------

  def update_cursor

    if @index < 0              # Sem cursor

      self.cursor_rect.empty

    elsif @index < @item_max    # Padrão

      self.cursor_rect.set(0, @index * 96, contents.width, 96)

    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

  #--------------------------------------------------------------------------

  # Desenha a experiência

  #--------------------------------------------------------------------------

  def draw_exp_info(actor, x, y)

    s1 = actor.exp_s

    s2 = actor.next_rest_exp_s

    s_next = sprintf(Vocab::ExpNext, Vocab::level)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y + 24 * 0, 180, 24, Vocab::ExpTotal)

    self.contents.draw_text(x, y + 24 * 2, 180, 24, s_next)

    self.contents.font.color = normal_color

    self.contents.draw_text(x, y + 24 * 1, 180, 24, s1, 2)

    self.contents.draw_text(x, y + 24 * 3, 180, 24, s2, 2)

  end





###################

# Window_exp_info #

###################

class Window_exp_info < Window_Selectable

  #--------------------------------------------------------------------------

  # Inicialização do objeto

  #    x : coordenada X da janela

  #    y : coordenada Y da janela

  #--------------------------------------------------------------------------

  def initialize(x, y)

    super(0, 360, 544, 305)

    refresh

    self.active = false

    self.index = -1

  end

  #--------------------------------------------------------------------------

  # Atualização

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    @item_max = 1

      x = 104

      y = actor.index * 96 + WLH / 2

      draw_exp_info($game_party.members[0], 0, 0)

    end

  end

  #--------------------------------------------------------------------------

  # Atualização do cursor

  #--------------------------------------------------------------------------

  def update_cursor

    if @index < 0              # Sem cursor

      self.cursor_rect.empty

    elsif @index < @item_max    # Padrão

      self.cursor_rect.set(0, @index * 96, contents.width, 96)

    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





################

# Window_Actor #

################

class Window_Actor < Window_Base

  def initialize(x, y, width, height)

    super(x, y, width, height)

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    @item_max = 1

      draw_actor_face($game_party.members[0], 0, 20, 92)

      draw_actor_name($game_party.members[0], 15, 0)

    end

  end



###################

# Window_Actor_HP #

###################

class Window_Actor_HP < Window_Base

  def initialize(x, y, width, height)

    super(x, y, width, height)

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    @item_max = 1

      draw_actor_hp($game_party.members[0], 15, 0)

      draw_state(80, 0)

    end

  end



###################

# Window_Actor_MP #

###################

class Window_Actor_MP < Window_Base

  def initialize(x, y, width, height)

    super(x, y, width, height)

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    @item_max = 1

      draw_actor_mp($game_party.members[0], 15, 0)

    end

  end



  def draw_state(x, y)

    @item_max = 1

      draw_actor_state($game_party.members[0], 150, 0)

  end





##############

# Scene_Menu #

##############

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_command_window

    @gold_window = Window_Gold.new(0, 360)

    @status2_window = Window_Status.new($game_party.members[0])

    @actor_window = Window_Actor.new(0, 0, 120, 140)

    @hp_window = Window_Actor_HP.new(120, 56, 224, 56)

    @mp_window = Window_Actor_MP.new(344, 56, 200, 56)

  end

  #--------------------------------------------------------------------------

  # Fim do processo

  #--------------------------------------------------------------------------

  def terminate

    super

    @command_window.dispose

    @gold_window.dispose

    @actor_window.dispose

    @hp_window.dispose

    @mp_window.dispose

    @status2_window.dispose

  end

  #--------------------------------------------------------------------------

  # Atualização da tela

  #--------------------------------------------------------------------------

  def update

    super

    @command_window.update

    @gold_window.update

    @hp_window.update

    @mp_window.update

    @actor_window.update

    @status2_window.update

    if @command_window.active

      update_command_selection

    elsif @status_window.active

      update_actor_selection

    end

  end

  #--------------------------------------------------------------------------

  # Criação da janela de comandos

  #--------------------------------------------------------------------------

  def create_command_window

    s1 = Vocab::equip

    s2 = Vocab::skill

    s3 = Vocab::item

    s4 = Vocab::game_end

    @command_window = Window_Command.new(160, [s1, s2, s3, s4])

    @command_window.index = @menu_index

    if $game_party.members.size == 0          # Se não houver membros na equipe

      @command_window.draw_item(0, false)    # Desabilita "Equipamentos"

      @command_window.draw_item(1, false)    # Desabilita "Habilidades"

      @command_window.draw_item(2, false)    # Desabilita "Itens"

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da escolha de comando

  #--------------------------------------------------------------------------

  def update_command_selection

    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      # Equipamentos

        $scene = Scene_Equip.new

      when 1      # Habilidades

        $scene = Scene_Skill.new

      when 2      # Salvar

        $scene = Scene_Item.new

      when 3      # 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

###################

# Window_Actor_LV #

###################

class Window_Actor_LV < Window_Base

    def initialize(x, y, width, height)

    super(x, y, width, height)

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    @item_max = 1

    draw_actor_level($game_party.members[0], 20, 0)

  end

end



#################

# Window_Status #

#################

class Window_Status < Window_Base

  #--------------------------------------------------------------------------

  # Inicialização do objeto

  #    actor : herói

  #--------------------------------------------------------------------------

  def initialize(actor)

    super(330, 112, 213, 248)

    @actor = actor

    refresh

  end

  #--------------------------------------------------------------------------

  # Atualização

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    @item_max = 1

      draw_equipments(0, 0)

    end

  #--------------------------------------------------------------------------

  # Exibição dos parâmetros

  #    x : exibe na coordenada X

  #    y : exibe na coordenada Y

  #--------------------------------------------------------------------------

  def draw_parameters(actor, x, y)

    @item_max = 1

      x = 0

      y = 10

      draw_actor_parameter($game_party.members[0], x, y, 0)

      draw_actor_parameter($game_party.members[0], x, y+30, 1)

      draw_actor_parameter($game_party.members[0], x, y+60, 2)

      draw_actor_parameter($game_party.members[0], x, y+90, 3)

    end

  #--------------------------------------------------------------------------

  # Exibição da experiência

  #    x : exibe na coordenada X

  #    y : exibe na coordenada Y

  #--------------------------------------------------------------------------

  def draw_exp_info(x, y)

    @actor = $game_party.members[0]

    s1 = @actor.exp_s

    s2 = @actor.next_rest_exp_s

    s_next = sprintf(Vocab::ExpNext, Vocab::level)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)

    self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)

    self.contents.font.color = normal_color

    self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)

    self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)

  end

  #--------------------------------------------------------------------------

  # Exibição de informações básicas

  #    x : exibe na coordenada X

  #    y : exibe na coordenada Y

  #--------------------------------------------------------------------------

  def draw_state(x, y)

    @item_max = 1

      x = 104

      y = actor.index * 96 + WLH / 2

      draw_actor_state($game_party.members[0], 10, 10)

    end

  #--------------------------------------------------------------------------

  # Exibição dos equipamentos

  #    x : exibe na coordenada X

  #    y : exibe na coordenada Y

  #--------------------------------------------------------------------------

  def draw_equipments(x, y)

    self.contents.font.color = system_color

    self.contents.draw_text(x, y, 120, 24, Vocab::equip)

    for i in 0..4

      draw_item_name($game_party.members[0].equips, x + 16, y + WLH * (i + 1))

    end

  end

end



##################

# Window_Command #

##################

class Window_Command < Window_Selectable

  #--------------------------------------------------------------------------

  # Variáveis públicas

  #--------------------------------------------------------------------------

  attr_reader  :commands                # Comandos

  #--------------------------------------------------------------------------

  # Inicialização do objeto

  #    width      : largura da janela

  #    commands  : array de comandos

  #    column_max : número de colunas (2 ou mais)

  #    row_max    : número de linhas (0: número de comandos)

  #    spacing    : espaçamento entre items localizados próximos

  #--------------------------------------------------------------------------

  def initialize(width, commands, column_max = 4, row_max = 0, spacing = 10)

    if row_max == 0

      row_max = (commands.size + column_max - 1) / column_max

    end

    super(240, 0, 300, row_max * WLH + 32, spacing)

    @commands = commands

    @item_max = commands.size

    @column_max = column_max

    refresh

    self.index = 0

  end

  #--------------------------------------------------------------------------

  # Atualização

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    for i in 0...@item_max

      draw_item(i)

    end

  end

  #--------------------------------------------------------------------------

  # Desenho do item

  #    index  : número (ID) do item

  #    enabled : espaço ativo. Quando translúcido significa falso

  #--------------------------------------------------------------------------

  def draw_item(index, enabled = true)

    rect = item_rect(index)

    rect.x += 4

    rect.width -= 8

    self.contents.clear_rect(rect)

    self.contents.font.color = normal_color

    self.contents.font.color.alpha = enabled ? 255 : 128

    self.contents.draw_text(rect, @commands[index])

  end

end

###############

# Scene_Equip #

###############

class Scene_Equip < Scene_Base

  #--------------------------------------------------------------------------

  # Constantes

  #--------------------------------------------------------------------------

  EQUIP_TYPE_MAX = 5                      # Número máximo de equipamentos

  #--------------------------------------------------------------------------

  # Inicialização do objeto

  #    actor_index : index do herói

  #    equip_index : index dos equipamentos

  #--------------------------------------------------------------------------

  def initialize(actor_index = 0, equip_index = 0)

    @actor_index = actor_index

    @equip_index = equip_index

  end

  #--------------------------------------------------------------------------

  # Inicialização do processo

  #--------------------------------------------------------------------------

  def start

    super

    @actor = $game_party.members[@actor_index]

    create_item_windows

    @equip_window = Window_Equip.new(120, 112, @actor)

    @equip_window.help_window = @help_window

    @equip_window.index = @equip_index

    @hp_window = Window_Actor_HP.new(120, 56, 224, 56)

    @mp_window = Window_Actor_MP.new(344, 56, 200, 56)

    @actor_window = Window_Actor.new(0, 0, 120, 140)

    @wrong_commands = Window_Wrong_Commands.new(240, 0, 300, 56)

  end

  #--------------------------------------------------------------------------

  # Fim do processo

  #--------------------------------------------------------------------------

  def terminate

    super

    @actor_window.dispose

    @equip_window.dispose

    dispose_item_windows

    @hp_window.dispose

    @mp_window.dispose

    @wrong_commands.dispose

  end

  #--------------------------------------------------------------------------

  # Retornar à tela original

  #--------------------------------------------------------------------------

  def return_scene

    $scene = Scene_Menu.new(0)

  end

  #--------------------------------------------------------------------------

  # Troca para a tela do próximo herói

  #--------------------------------------------------------------------------

  def next_actor

    @actor_index += 1

    @actor_index %= $game_party.members.size

    $scene = Scene_Equip.new(@actor_index, @equip_window.index)

  end

  #--------------------------------------------------------------------------

  # Troca para a tela do herói anterior

  #--------------------------------------------------------------------------

  def prev_actor

    @actor_index += $game_party.members.size - 1

    @actor_index %= $game_party.members.size

    $scene = Scene_Equip.new(@actor_index, @equip_window.index)

  end

  #--------------------------------------------------------------------------

  # Atualização da tela

  #--------------------------------------------------------------------------

  def update

    super

    @actor_window.update

    update_equip_window

    update_item_windows

    @hp_window.update

    @mp_window.update

    @wrong_commands.update

    if @equip_window.active

      update_equip_selection

    elsif @item_window.active

      update_item_selection

    end

  end

  #--------------------------------------------------------------------------

  # Criação das janelas de itens

  #--------------------------------------------------------------------------

  def create_item_windows

    @item_windows = []

    for i in 0...EQUIP_TYPE_MAX

      @item_windows = Window_EquipItem.new(0, 264, 544, 152, @actor, i)

      @item_windows.help_window = @help_window

      @item_windows.visible = (@equip_index == i)

      @item_windows.y = 264

      @item_windows.height = 152

      @item_windows.active = false

      @item_windows.index = -1

    end

  end

  #--------------------------------------------------------------------------

  # Dispose das janelas de itens

  #--------------------------------------------------------------------------

  def dispose_item_windows

    for window in @item_windows

      window.dispose

    end

  end

  #--------------------------------------------------------------------------

  # Atualização das janelas de itens

  #--------------------------------------------------------------------------

  def update_item_windows

    for i in 0...EQUIP_TYPE_MAX

      @item_windows.visible = (@equip_window.index == i)

      @item_windows.update

    end

    @item_window = @item_windows[@equip_window.index]

  end

  #--------------------------------------------------------------------------

  # Atualização da janela de equipamentos

  #--------------------------------------------------------------------------

  def update_equip_window

    @equip_window.update

  end

  #--------------------------------------------------------------------------

  # Atualização da janela de status

  #--------------------------------------------------------------------------

  def update_status_window

    if @equip_window.active

      @status_window.set_new_parameters(nil, nil, nil, nil)

    elsif @item_window.active

      temp_actor = @actor.clone

      temp_actor.change_equip(@equip_window.index, @item_window.item, true)

      new_atk = temp_actor.atk

      new_def = temp_actor.def

      new_spi = temp_actor.spi

      new_agi = temp_actor.agi

      @status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi)

    end

    @status_window.update

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de equipamentos

  #--------------------------------------------------------------------------

  def update_equip_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      return_scene

    elsif Input.trigger?(Input::R)

      Sound.play_cursor

      next_actor

    elsif Input.trigger?(Input::L)

      Sound.play_cursor

      prev_actor

    elsif Input.trigger?(Input::C)

      if @actor.fix_equipment

        Sound.play_buzzer

      else

        Sound.play_decision

        @equip_window.active = false

        @item_window.active = true

        @item_window.index = 0

      end

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de itens

  #--------------------------------------------------------------------------

  def update_item_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      @equip_window.active = true

      @item_window.active = false

      @item_window.index = -1

    elsif Input.trigger?(Input::C)

      Sound.play_equip

      @actor.change_equip(@equip_window.index, @item_window.item)

      @equip_window.active = true

      @item_window.active = false

      @item_window.index = -1

      @equip_window.refresh

      for item_window in @item_windows

        item_window.refresh

      end

    end

  end

end

#########################

# Window_Wrong_Commands #

#########################

class Window_Wrong_Commands < Window_Base

  def initialize(x, y, width, heigth)

    super

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  #--------------------------------------------------------------------------

  # Atualização

  #--------------------------------------------------------------------------

  def refresh

    self.contents.clear

    self.contents.draw_text(50, 0, self.width - 32, WLH, "Equipamentos")

    end

  end

class Window_Wrong_Commands_Skill < Window_Base

  def initialize(x, y, width, height)

    super

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    self.contents.draw_text(50, 0, self.width - 32, WLH, "Habilidades")

  end

end

class Window_Wrong_Commands_Itens < Window_Base

  def initialize(x, y, width, height)

    super

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    self.contents.draw_text(50, 0, self.width - 32, WLH, "Inventário")

  end

end

class Window_Wrong_Commands_Sair < Window_Base

  def initialize(x, y, width, height)

    super

    refresh

  end

  def dispose

    super

  end

  def update

    super

  end

  def refresh

    self.contents.clear

    self.contents.draw_text(50, 0, self.width - 32, WLH, "Sair do Jogo")

  end

end





##############

# Scene_Item #

##############

class Scene_Item < Scene_Base

  #--------------------------------------------------------------------------

  # Inicialização do processo

  #--------------------------------------------------------------------------

  def start

    super

    @viewport = Viewport.new(0, 0, 544, 416)

    @help_window = Window_Help.new

    @help_window.y = 360

    @help_window.viewport = @viewport

    @item_window = Window_Item.new(0, 112, 544, 248)

    @item_window.viewport = @viewport

    @item_window.help_window = @help_window

    @item_window.active = false

    @target_window = Window_MenuStatus.new(0, 0)

    hide_target_window

    @Window_Wrong_Commands_Itens = Window_Wrong_Commands_Itens.new(240, 0, 300, 56)

    @hp_window = Window_Actor_HP.new(120, 56, 224, 56)

    @mp_window = Window_Actor_MP.new(344, 56, 200, 56)

    @actor_window = Window_Actor.new(0, 0, 120, 140)

  end

  #--------------------------------------------------------------------------

  # Fim do processo

  #--------------------------------------------------------------------------

  def terminate

    super

    @viewport.dispose

    @help_window.dispose

    @item_window.dispose

    @target_window.dispose

    @Window_Wrong_Commands_Itens.dispose

    @hp_window.dispose

    @mp_window.dispose

    @actor_window.dispose

  end

  #--------------------------------------------------------------------------

  # Retornar à tela original

  #--------------------------------------------------------------------------

  def return_scene

    $scene = Scene_Menu.new(2)

  end

  #--------------------------------------------------------------------------

  # Atualização da tela

  #--------------------------------------------------------------------------

  def update

    super

    @help_window.update

    @item_window.update

    @target_window.update

    @Window_Wrong_Commands_Itens.update

    @hp_window.update

    @mp_window.update

    @actor_window.update

    if @item_window.active

      update_item_selection

    elsif @target_window.active

      update_target_selection

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de items

  #--------------------------------------------------------------------------

  def update_item_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      return_scene

    elsif Input.trigger?(Input::C)

      @item = @item_window.item

      if @item != nil

        $game_party.last_item_id = @item.id

      end

      if $game_party.item_can_use?(@item)

        Sound.play_decision

        determine_item

      else

        Sound.play_buzzer

      end

    end

  end

  #--------------------------------------------------------------------------

  # Decisão de item

  #--------------------------------------------------------------------------

  def determine_item

    if @item.for_friend?

      show_target_window(@item_window.index % 2 == 0)

      if @item.for_all?

        @target_window.index = 99

      else

        if $game_party.last_target_index < @target_window.item_max

          @target_window.index = $game_party.last_target_index

        else

          @target_window.index = 0

        end

      end

    else

      use_item_nontarget

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de alvo

  #--------------------------------------------------------------------------

  def update_target_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      if $game_party.item_number(@item) == 0    # Se usar itens até 0

        @item_window.refresh                    # Atualizar janela

      end

      hide_target_window

    elsif Input.trigger?(Input::C)

      if not $game_party.item_can_use?(@item)

        Sound.play_buzzer

      else

        determine_target

      end

    end

  end

  #--------------------------------------------------------------------------

  # Definição do alvo

  #    Se não houver efeito, tocar SE de erro.

  #--------------------------------------------------------------------------

  def determine_target

    used = false

    if @item.for_all?

      for target in $game_party.members

        target.item_effect(target, @item)

        used = true unless target.skipped

      end

    else

      $game_party.last_target_index = @target_window.index

      target = $game_party.members[@target_window.index]

      target.item_effect(target, @item)

      used = true unless target.skipped

    end

    if used

      use_item_nontarget

    else

      Sound.play_buzzer

    end

  end

  #--------------------------------------------------------------------------

  # Exibição da janela de alvo

  #    right : alinhado à direita (falso se esquerda)

  #--------------------------------------------------------------------------

  def show_target_window(right)

    @item_window.active = false

    width_remain = 544 - @target_window.width

    @target_window.x = right ? width_remain : 0

    @target_window.visible = true

    @target_window.active = true

    if right

      @viewport.rect.set(0, 0, width_remain, 416)

      @viewport.ox = 0

    else

      @viewport.rect.set(@target_window.width, 0, width_remain, 416)

      @viewport.ox = @target_window.width

    end

  end

  #--------------------------------------------------------------------------

  # Ocultar janela de alvo

  #--------------------------------------------------------------------------

  def hide_target_window

    @item_window.active = true

    @target_window.visible = false

    @target_window.active = false

    @viewport.rect.set(0, 0, 544, 416)

    @viewport.ox = 0

  end

  #--------------------------------------------------------------------------

  # Uso de item (sem alvo)

  #--------------------------------------------------------------------------

  def use_item_nontarget

    Sound.play_use_item

    $game_party.consume_item(@item)

    @item_window.draw_item(@item_window.index)

    @target_window.refresh

    if $game_party.all_dead?

      $scene = Scene_Gameover.new

    elsif @item.common_event_id > 0

      $game_temp.common_event_id = @item.common_event_id

      $scene = Scene_Map.new

    end

  end

end

###############

# Scene_Skill #

###############

class Scene_Skill < Scene_Base

  #--------------------------------------------------------------------------

  # Inicialização do objeto

  #    actor_index : índex do herói

  #--------------------------------------------------------------------------

  def initialize(actor_index = 0, equip_index = 0)

    @actor_index = actor_index

  end

  #--------------------------------------------------------------------------

  # Inicialização do processo

  #--------------------------------------------------------------------------

  def start

    super

    @actor = $game_party.members[@actor_index]

    @viewport = Viewport.new(0, 0, 544, 416)

    @help_window = Window_Help.new

    @help_window.y = 360

    @help_window.viewport = @viewport

    @skill_window = Window_Skill.new(0, 112, 544, 248, @actor)

    @skill_window.viewport = @viewport

    @skill_window.help_window = @help_window

    @target_window = Window_MenuStatus.new(0, 0)

    @Window_Wrong_Commands_Skill = Window_Wrong_Commands_Skill.new(240, 0, 300, 56)

    @hp_window = Window_Actor_HP.new(120, 56, 224, 56)

    @mp_window = Window_Actor_MP.new(344, 56, 200, 56)

    @actor_window = Window_Actor.new(0, 0, 120, 140)

    hide_target_window

  end

  #--------------------------------------------------------------------------

  # Fim do processo

  #--------------------------------------------------------------------------

  def terminate

    super

    @help_window.dispose

    @skill_window.dispose

    @target_window.dispose

    @Window_Wrong_Commands_Skill.dispose

    @hp_window.dispose

    @mp_window.dispose

    @actor_window.dispose

  end

  #--------------------------------------------------------------------------

  # Retornar à tela original

  #--------------------------------------------------------------------------

  def return_scene

    $scene = Scene_Menu.new(1)

  end

  #--------------------------------------------------------------------------

  # Troca para tela do próximo herói

  #--------------------------------------------------------------------------

  def next_actor

    @actor_index += 1

    @actor_index %= $game_party.members.size

    $scene = Scene_Skill.new(@actor_index)

  end

  #--------------------------------------------------------------------------

  # Trocar para tela do herói anterior

  #--------------------------------------------------------------------------

  def prev_actor

    @actor_index += $game_party.members.size - 1

    @actor_index %= $game_party.members.size

    $scene = Scene_Skill.new(@actor_index)

  end

  #--------------------------------------------------------------------------

  # Atualização da tela

  #--------------------------------------------------------------------------

  def update

    super

    @help_window.update

    @skill_window.update

    @target_window.update

    @Window_Wrong_Commands_Skill.update

    @hp_window.update

    @mp_window.update

    @actor_window.update

    if @skill_window.active

      update_skill_selection

    elsif @target_window.active

      update_target_selection

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de habilidade

  #--------------------------------------------------------------------------

  def update_skill_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      return_scene

    elsif Input.trigger?(Input::R)

      Sound.play_cursor

      next_actor

    elsif Input.trigger?(Input::L)

      Sound.play_cursor

      prev_actor

    elsif Input.trigger?(Input::C)

      @skill = @skill_window.skill

      if @skill != nil

        @actor.last_skill_id = @skill.id

      end

      if @actor.skill_can_use?(@skill)

        Sound.play_decision

        determine_skill

      else

        Sound.play_buzzer

      end

    end

  end

  #--------------------------------------------------------------------------

  # Decisão de habilidade

  #--------------------------------------------------------------------------

  def determine_skill

    if @skill.for_friend?

      show_target_window(@skill_window.index % 2 == 0)

      if @skill.for_all?

        @target_window.index = 99

      elsif @skill.for_user?

        @target_window.index = @actor_index + 100

      else

        if $game_party.last_target_index < @target_window.item_max

          @target_window.index = $game_party.last_target_index

        else

          @target_window.index = 0

        end

      end

    else

      use_skill_nontarget

    end

  end

  #--------------------------------------------------------------------------

  # Atualização da seleção de alvo

  #--------------------------------------------------------------------------

  def update_target_selection

    if Input.trigger?(Input::B)

      Sound.play_cancel

      hide_target_window

    elsif Input.trigger?(Input::C)

      if not @actor.skill_can_use?(@skill)

        Sound.play_buzzer

      else

        determine_target

      end

    end

  end

  #--------------------------------------------------------------------------

  # Definição do alvo

  #    Se não houver efeito, tocar SE de erro.

  #--------------------------------------------------------------------------

  def determine_target

    used = false

    if @skill.for_all?

      for target in $game_party.members

        target.skill_effect(@actor, @skill)

        used = true unless target.skipped

      end

    elsif @skill.for_user?

      target = $game_party.members[@target_window.index - 100]

      target.skill_effect(@actor, @skill)

      used = true unless target.skipped

    else

      $game_party.last_target_index = @target_window.index

      target = $game_party.members[@target_window.index]

      target.skill_effect(@actor, @skill)

      used = true unless target.skipped

    end

    if used

      use_skill_nontarget

    else

      Sound.play_buzzer

    end

  end

  #--------------------------------------------------------------------------

  # Exibição da janela de alvo

  #    right : alinhado à direita (falso se esquerda)

  #--------------------------------------------------------------------------

  def show_target_window(right)

    @skill_window.active = false

    width_remain = 544 - @target_window.width

    @target_window.x = right ? width_remain : 0

    @target_window.visible = true

    @target_window.active = true

    if right

      @viewport.rect.set(0, 0, width_remain, 416)

      @viewport.ox = 0

    else

      @viewport.rect.set(@target_window.width, 0, width_remain, 416)

      @viewport.ox = @target_window.width

    end

  end

  #--------------------------------------------------------------------------

  # Ocultação da janela de alvo

  #--------------------------------------------------------------------------

  def hide_target_window

    @skill_window.active = true

    @target_window.visible = false

    @target_window.active = false

    @viewport.rect.set(0, 0, 544, 416)

    @viewport.ox = 0

  end

  #--------------------------------------------------------------------------

  # Uso de habilidade (sem alvo)

  #--------------------------------------------------------------------------

  def use_skill_nontarget

    Sound.play_use_skill

    @actor.mp -= @actor.calc_mp_cost(@skill)

    @status_window.refresh

    @skill_window.refresh

    @target_window.refresh

    if $game_party.all_dead?

      $scene = Scene_Gameover.new

    elsif @skill.common_event_id > 0

      $game_temp.common_event_id = @skill.common_event_id

      $scene = Scene_Map.new

    end

  end

end

#############

# Scene_End #

#############

class Scene_End < Scene_Base

  #--------------------------------------------------------------------------

  # Inicialização do processo

  #--------------------------------------------------------------------------

  def start

    super

    create_menu_background

    create_command_window

    @Window_Wrong_Commands_Sair = Window_Wrong_Commands_Sair.new(240, 0, 300, 56)

  end

  #--------------------------------------------------------------------------

  # Processo pós-inicialização

  #--------------------------------------------------------------------------

  def post_start

    super

    open_command_window

  end

  #--------------------------------------------------------------------------

  # Preparação para finalização

  #--------------------------------------------------------------------------

  def pre_terminate

    super

    close_command_window

  end

  #--------------------------------------------------------------------------

  # Fim do processo

  #--------------------------------------------------------------------------

  def terminate

    super

    dispose_command_window

    dispose_menu_background

    @Window_Wrong_Commands_Sair.dispose

  end

  #--------------------------------------------------------------------------

  # Retornar à tela original

  #--------------------------------------------------------------------------

  def return_scene

    $scene = Scene_Menu.new(3)

  end

  #--------------------------------------------------------------------------

  # Atualização da tela

  #--------------------------------------------------------------------------

  def update

    super

    update_menu_background

    @command_window.update

    @Window_Wrong_Commands_Sair.update

    if Input.trigger?(Input::B)

      Sound.play_cancel

      return_scene

    elsif Input.trigger?(Input::C)

      case @command_window.index

      when 0  # ?????

        command_to_title

      when 1  # ???????

        command_shutdown

      when 2  # ???

        command_cancel

      end

    end

  end

  #--------------------------------------------------------------------------

  # Atualização do background do menu

  #--------------------------------------------------------------------------

  def update_menu_background

    super

    @menuback_sprite.tone.set(0, 0, 0, 128)

  end

  #--------------------------------------------------------------------------

  # Criação da janela de comandos

  #--------------------------------------------------------------------------

  def create_command_window

    s1 = Vocab::to_title

    s2 = Vocab::shutdown

    s3 = Vocab::cancel

    @command_window = Window_Command.new(172, [s1, s2, s3])

    @command_window.x = (544 - @command_window.width) / 2

    @command_window.y = (416 - @command_window.height) / 2

    @command_window.openness = 0

  end

  #--------------------------------------------------------------------------

  # Dispose da janela de comandos

  #--------------------------------------------------------------------------

  def dispose_command_window

    @command_window.dispose

  end

  #--------------------------------------------------------------------------

  # Abre a janela de comandos

  #--------------------------------------------------------------------------

  def open_command_window

    @command_window.open

    begin

      @command_window.update

      Graphics.update

    end until @command_window.openness == 255

  end

  #--------------------------------------------------------------------------

  # Fecha a janela de comandos

  #--------------------------------------------------------------------------

  def close_command_window

    @command_window.close

    begin

      @command_window.update

      Graphics.update

    end until @command_window.openness == 0

  end

  #--------------------------------------------------------------------------

  # Processo ao selecionar "Tela Título"

  #--------------------------------------------------------------------------

  def command_to_title

    Sound.play_decision

    RPG::BGM.fade(800)

    RPG::BGS.fade(800)

    RPG::ME.fade(800)

    $scene = Scene_Title.new

    close_command_window

    Graphics.fadeout(60)

  end

  #--------------------------------------------------------------------------

  # Processo ao selecionar "Sair"

  #--------------------------------------------------------------------------

  def command_shutdown

    Sound.play_decision

    RPG::BGM.fade(800)

    RPG::BGS.fade(800)

    RPG::ME.fade(800)

    $scene = nil

  end

  #--------------------------------------------------------------------------

  # Processo ao cancelar

  #--------------------------------------------------------------------------

  def command_cancel

    Sound.play_decision

    return_scene

  end

end
Revenir en haut Aller en bas
https://annuairedurpg.1fr1.net
 
VX - Menu Resident Evil 4
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» VX - Menu de MogHunter ( MOG - Scene Menu )
» VX - Zoli Menu
» ACE - Inversion du menu
» Ace - Menu Simple
» Main Menu Evo II

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Annuaire du RPG :: RPG maker & co :: Scripts :: RGSS 2 :: Menu-
Sauter vers: