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.

[VX] Ring Menu

OK, here's the deal. Y'all knows that this script is old as hell and this should be originally planned for the RMXP, as it uses the RPG::Cache.icon - something not anymore available for the RMVX (At least, it wouldn't work, and was buggin' all the time).
Some brazilian scripter (not me) got so damn pissed off and rewrote parts of the original XRXS script and made it available for RMVX.

All credits still goes to the original creators AND to DouglasMF.

Note: I'm no expert scripter, so I cannot guarantee if it'll work with 3215 scripts at once. Tested it with the Professions script and the Sozai-WTF-it's called-anyway.
Note2: BTW: He took all the work of translating the comments of the script to Portuguese. I'll translate it back to English if that's needed.

Cy'all.

Code:
#==============================================================================
#  Ring_Menu
#==============================================================================
#  By:  XRXS, Dubealex, and Hypershadow180
#  Converted to RMVX By DouglasMF (RPG Maker Brasil)
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Esta classe controla o conjunto de objetos que forma o RingMenu
#==============================================================================

class Scene_Menu < Scene_Base
  #--------------------------------------------------------------------------
  # Inicializa
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # Inicia os objetos do menu
  #--------------------------------------------------------------------------
  def start
    super
    @spriteset = Spriteset_Map.new
    @gold_window = Window_Gold.new(0, 360)
    @win_local = Window_Local.new(0,0)
    @status_window = Window_MenuStatus.new(160, 0)
    px = $game_player.screen_x - 16
    py = $game_player.screen_y - 28
    @ring_menu = Window_RingMenu_Comando.new(px,py)
    @status_window.z = @ring_menu.z + 20
    @status_window.visible = false
  end
  #--------------------------------------------------------------------------
  # Fexa os objetos do menu
  #--------------------------------------------------------------------------
  def terminate
    super
    @spriteset.dispose
    @ring_menu.dispose
    @gold_window.dispose
    @win_local.dispose
    @status_window.dispose
  end
  #--------------------------------------------------------------------------
  # Atualiza os objetos do menu
  #--------------------------------------------------------------------------
  def update
    super
    @ring_menu.update
    @gold_window.update
    @win_local.update
    @spriteset.update
    @status_window.update
    if @ring_menu.active
      update_command_selection
    elsif @status_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # Atualiza o comando e a seleção do menu
  #--------------------------------------------------------------------------
  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 @ring_menu.index < 4
        Sound.play_buzzer
        return
      elsif $game_system.save_disabled and @ring_menu.index == 4
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      case @ring_menu.indice
      when 0
        $scene = Scene_Item.new
      when 1,2,3
        start_actor_selection
      when 4
        $scene = Scene_File.new(true, false, false)
      when 5
        $scene = Scene_End.new
      end
    end
    if Input.trigger?(Input::UP) or  Input.trigger?(Input::LEFT)
      Sound.play_cursor
      @ring_menu.girar(3)
      return
    end
    if Input.trigger?(Input::DOWN) or  Input.trigger?(Input::RIGHT)
      Sound.play_cursor
      @ring_menu.girar(4)
      return
    end
  end
  #--------------------------------------------------------------------------
  # Inicia a seleção de personagem
  #--------------------------------------------------------------------------
  def start_actor_selection
    @ring_menu.active = false
    @status_window.visible = true
    @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
  #--------------------------------------------------------------------------
  # Finaliza a seleção de personagens
  #--------------------------------------------------------------------------
  def end_actor_selection
    @ring_menu.active = true
    @status_window.active = false
    @status_window.visible = false
    @status_window.index = -1
  end
  #--------------------------------------------------------------------------
  # Atualiza a seleção de personagens
  #--------------------------------------------------------------------------
  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 @ring_menu.indice
      when 1
        $scene = Scene_Skill.new(@status_window.index)
      when 2
        $scene = Scene_Equip.new(@status_window.index)
      when 3
        $scene = Scene_Status.new(@status_window.index)
      end
    end
  end
end

#==============================================================================
# Window_RingMenu_Comando
#------------------------------------------------------------------------------
# Esta classe cria o ring menu.
#==============================================================================

class Window_RingMenu_Comando < Window_Base
  
  DurIni = 30
  DurMov = 15
  RaioAnel = 64
  ModoIni = 1
  ModoEsp = 2
  ModoMD = 3
  ModoME = 4
  SE_Inicio = ""
  
  attr_accessor :indice
  #--------------------------------------------------------------------------
  # Inicia o objeto
  #--------------------------------------------------------------------------
  def initialize(centro_x,centro_y)
    super(0, 0, 544, 416)
    self.opacity = 0
    self.contents.font.size = 16
    s1 = Vocab::item
    s2 = Vocab::skill
    s3 = Vocab::equip
    s4 = Vocab::status
    s5 = Vocab::save
    s6 = Vocab::game_end
    @item_name = [s1,s2,s3,s4,s5,s6]
    @item_max = 6
    @item_icon = [144,128,40,137,149,112]
    @item_hab = [true,true,true,true,true,true]
    @indice = 0
    @cx = centro_x - 12
    @cy = centro_y - 12
    inicia_menu
    refresh
  end
  #--------------------------------------------------------------------------
  # Atualiza o objeto
  #--------------------------------------------------------------------------
  def update
    super
    refresh
  end
  #--------------------------------------------------------------------------
  # Atualiza o objeto
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @modo
    when ModoIni
      refresh_inicio
    when ModoEsp
      refresh_espera
    when ModoMD
      refresh_mover(1)
    when ModoME
      refresh_mover(0)
    end
    sw = self.contents.width
    rect = Rect.new((@cx - ((sw-32)/2))+12, @cy - 40, sw-32, 32)
    self.contents.draw_text(rect, @item_name[@indice],1)
  end
  #--------------------------------------------------------------------------
  # Abre o menu
  #--------------------------------------------------------------------------
  def refresh_inicio
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / DurIni
    r = RaioAnel - 1.0 * RaioAnel * @passos / DurIni
    for i in 0...@item_max
      j = i - @indice
      d = d1 * j + d2 * @passos
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      desenha_item(x, y, i)
    end
    @passos -= 1
    if @passos < 1
      @modo = ModoEsp
    end
  end
  #--------------------------------------------------------------------------
  # Atualiza o menu
  #--------------------------------------------------------------------------
  def refresh_espera
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @indice
      x = @cx + ( RaioAnel * Math.sin( d * j ) ).to_i
      y = @cy - ( RaioAnel * Math.cos( d * j ) ).to_i
      desenha_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # Movimenta o menu
  #--------------------------------------------------------------------------
  def refresh_mover(modo)
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / DurMov
    d2 *= -1 if modo != 0
    for i in 0...@item_max
      j = i - @indice
      d = d1 * j + d2 * @passos
      x = @cx + ( RaioAnel * Math.sin( d ) ).to_i
      y = @cy - ( RaioAnel * Math.cos( d ) ).to_i
      desenha_item(x, y, i)
    end
    @passos -= 1
    if @passos < 1
      @modo = ModoEsp
    end
  end
  #--------------------------------------------------------------------------
  # Desenha o icone
  #--------------------------------------------------------------------------
  def desenha_item(x, y, i)
    if @indice == i
      self.cursor_rect.set(x-4, y-4, 32, 32)
      draw_icon(@item_icon[i], x, y, @item_hab[i])
    else
      draw_icon(@item_icon[i], x, y, @item_hab[i])
    end
  end
  #--------------------------------------------------------------------------
  # Inicia o menu
  #--------------------------------------------------------------------------
  def inicia_menu
    @modo = ModoIni
    @passos = DurIni
    if  SE_Inicio != nil and SE_Inicio != ""
      Audio.se_play("Audio/SE/" + SE_Inicio, 80, 100)
    end
  end
  #--------------------------------------------------------------------------
  # Gira o menu
  #--------------------------------------------------------------------------
  def girar(modo)
    if modo == ModoMD
      @indice -= 1
      @indice = @item_hab.size - 1 if @indice < 0
    elsif modo == ModoME
      @indice += 1
      @indice = 0 if @indice >= @item_hab.size
    else
      return
    end
    @modo = modo
    @passos = DurMov
  end
  
end

#==============================================================================
# Scene_Title
#------------------------------------------------------------------------------
# Faz modificações nescessarias para a exibição do nome do mapa
#==============================================================================

class Scene_Title
  alias load_database_old load_database
  def load_database
    load_database_old
    $data_mapinfo = load_data("Data/MapInfos.rvdata")
  end
end

#==============================================================================
# Window_Local
#------------------------------------------------------------------------------
# Cria a janela responsavel pela exibição do nome do mapa
#==============================================================================

class Window_Local < Window_Base
  #--------------------------------------------------------------------------
  # Inicia o objeto
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 160, 96)
    refresh
  end
  #--------------------------------------------------------------------------
  # Atualiza o objeto
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, 120, 32, "Local:")
    self.contents.font.color = system_color
    self.contents.draw_text(4, 32, 120, 32, $data_mapinfo[$game_map.map_id].name, 2)
  end
end
 
Maus":4hy8uuzw said:
Well, it seems to be incompatible with either the custom commands/custom battle commands script, the party changer, the large party script, or the sideview battler.
Which sideview battler system you're using? I'm using the Sozai one and it works.
 

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