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.

Ring Command Window

This is a class for scripters who for whatever reason want to have a command window display in a ring, obviously you could make a ring menu system, but with some creative thinking you could for example make a safe opening minigame without too much difficulty.

Anyway here's the script:
Code:
class Window_Ring_Command < Window_Base
  
  attr_accessor :index
  
  Turn_Frames = 20
  
  def initialize(x_pos, y_pos, commands, radius = 150.0)
    super(0, 0, 640, 480)
    @x_pos = x_pos
    @y_pos = y_pos
    @commands = commands
    @index = 0
    @moving = 0
    @radius = radius
    @radius = radius
    self.contents = Bitmap.new(width-32, height-32)
    self.opacity = 0
    refresh
  end
  
  def update
    super
    if @moving != 0
      refresh
    end
  end
  
  def refresh
    self.contents.clear
    if @moving != 0
      @moving = (Math.abs(@moving) - 1) * (@moving/Math.abs(@moving))
    end
    max_item = @commands.size
    pi_part = (2 * Math::PI) / max_item
    for i in 0...max_item
      x = (@radius * Math.sin((i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @x_pos
      x = x.to_i
      y = (@radius * Math.cos((i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @y_pos
      y = y.to_i
      draw_item(x, y, i)
    end
  end
  
  def draw_item(x, y, i)
    k = i + @index
    if k >= @commands.size
      k -= @commands.size
    end
    self.contents.draw_text(x, y, 150, 32, @commands[k])
  end
  
  def move_right
    @index += 1
    if @index >= @commands.size
      @index -= @commands.size
    end
    @moving += Turn_Frames
  end
  
  def move_left
    @index -= 1
    if @index < 0
      @index += @commands.size
    end
    @moving -= Turn_Frames
  end
  
  def moving?
    return @moving != 0
  end
  
end

module Math
  
  def self.abs(x)
    if x >= 0
      return x
    else
      return -1 * x
    end
  end
  
end

To use the constant Turn_Frames is how many frames or whatever you want to call them it takes to rotate to the next option in the command window.
The paranthesis when initialising are:

x_pos - The x co-ordinate of the ring/circle (CENTRE)
y_pos - The y co-ordinate of the ring/circle (CENTRE)
commands - The commands you want in the rung
radius = 150.0 - Basically you don't have to bother with this unless you want a smaller or larger ring/circle.

The methods you need to know:
update - call it as you would a normal command window
moving? - use this if you want to check if the menu is rotating (ie to stop them pushing left again)
move_left - moves the menu left (equivelent of up on a normal command window)
move_right - moves the menu left (equivelent of down on a normal command window).

I hope this is of use to someone, I'm willing to help and maybe make a few examples of how to use this if needed, but I'm busy with college work at the moment so don't expect speedy responces.

Add-Ons
Choices in a ring menu.

Script:
Code:
class Game_Temp
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :choices
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias choices_initialize initialize
  def initialize
    choices_initialize
    @choices = []
  end
end


class Interpreter
  #--------------------------------------------------------------------------
  # * Setup Choices
  #--------------------------------------------------------------------------
  def setup_choices(parameters)
    # Set choice item count to choice_max
    $game_temp.choice_max = parameters[0].size
    # Set choice to message_text
    $game_temp.choices = []
    for text in parameters[0]
      $game_temp.choices.push(text)
    end
    # Set cancel processing
    $game_temp.choice_cancel_type = parameters[1]
    # Set callback
    current_indent = @list[@index].indent
    $game_temp.choice_proc = Proc.new { |n| @branch[current_indent] = n }
  end
end


class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # * Terminate Message
  #--------------------------------------------------------------------------
  alias choices_terminate terminate_message
  def terminate_message
    choices_terminate
    if @choice_window != nil
      @choice_window.dispose
      @choice_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    x = y = 0
    @cursor_width = 0
    # Indent if choice
    if $game_temp.choice_start == 0
      x = 8
    end
    # If waiting for a message to be displayed
    if $game_temp.message_text != nil
      text = $game_temp.message_text
      # Control text processing
      begin
        last_text = text.clone
        text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
      end until text == last_text
      text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
        $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
      end
      # Change "\\\\" to "\000" for convenience
      text.gsub!(/\\\\/) { "\000" }
      # Change "\\C" to "\001" and "\\G" to "\002"
      text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
      text.gsub!(/\\[Gg]/) { "\002" }
      # Get 1 text character in c (loop until unable to get text)
      while ((c = text.slice!(/./m)) != nil)
        # If \\
        if c == "\000"
          # Return to original text
          c = "\\"
        end
        # If \C[n]
        if c == "\001"
          # Change text color
          text.sub!(/\[([0-9]+)\]/, "")
          color = $1.to_i
          if color >= 0 and color <= 7
            self.contents.font.color = text_color(color)
          end
          # go to next text
          next
        end
        # If \G
        if c == "\002"
          # Make gold window
          if @gold_window == nil
            @gold_window = Window_Gold.new
            @gold_window.x = 560 - @gold_window.width
            if $game_temp.in_battle
              @gold_window.y = 192
            else
              @gold_window.y = self.y >= 128 ? 32 : 384
            end
            @gold_window.opacity = self.opacity
            @gold_window.back_opacity = self.back_opacity
          end
          # go to next text
          next
        end
        # If new line text
        if c == "\n"
          # Update cursor width if choice
          if y >= $game_temp.choice_start
            @cursor_width = [@cursor_width, x].max
          end
          # Add 1 to y
          y += 1
          x = 0
          # Indent if choice
          if y >= $game_temp.choice_start
            x = 8
          end
          # go to next text
          next
        end
        # Draw text
        self.contents.draw_text(4 + x, 32 * y, 40, 32, c)
        # Add x to drawn text width
        x += self.contents.text_size(c).width
      end
    end
    # If choice
    if $game_temp.choice_max > 0
      
      # EDIT
      
      
      @choice_window = Window_Ring_Command.new(280, 180, $game_temp.choices,60)
      
      # /EDIT
      
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      digits_max = $game_temp.num_input_digits_max
      number = $game_variables[$game_temp.num_input_variable_id]
      @input_number_window = Window_InputNumber.new(digits_max)
      @input_number_window.number = number
      @input_number_window.x = self.x + 8
      @input_number_window.y = self.y + $game_temp.num_input_start * 32
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If fade in
    if @fade_in
      self.contents_opacity += 24
      if @input_number_window != nil
        @input_number_window.contents_opacity += 24
      end
      if self.contents_opacity == 255
        @fade_in = false
      end
      return
    end
    # If inputting number
    if @input_number_window != nil
      @input_number_window.update
      # Confirm
      if Input.trigger?(Input::C)
        $game_system.se_play($data_system.decision_se)
        $game_variables[$game_temp.num_input_variable_id] =
          @input_number_window.number
        $game_map.need_refresh = true
        # Dispose of number input window
        @input_number_window.dispose
        @input_number_window = nil
        terminate_message
      end
      return
    end
    
    
    # EDIT
    
    if @choice_window != nil
      @choice_window.update
      if Input.trigger?(Input::LEFT)
        unless @choice_window.moving?
          @choice_window.move_left
        end
      end
      if Input.trigger?(Input::RIGHT)
        unless @choice_window.moving?
          @choice_window.move_right
        end
      end
    end
    
    
    # /EDIT
    
    
    
    # If message is being displayed
    if @contents_showing
      # If choice isn't being displayed, show pause sign
      if $game_temp.choice_max == 0
        self.pause = true
      end
      # Cancel
      if Input.trigger?(Input::B)
        if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
          $game_system.se_play($data_system.cancel_se)
          $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
          terminate_message
        end
      end
      # Confirm
      if Input.trigger?(Input::C)
        if $game_temp.choice_max > 0
          $game_system.se_play($data_system.decision_se)
          
          
          # EDIT
          
          
          $game_temp.choice_proc.call(@choice_window.index)
          
          
          # /EDIT
          
        end
        terminate_message
      end
      return
    end
    # If display wait message or choice exists when not fading out
    if @fade_out == false and $game_temp.message_text != nil
      @contents_showing = true
      $game_temp.message_window_showing = true
      reset_window
      refresh
      Graphics.frame_reset
      self.visible = true
      self.contents_opacity = 0
      if @input_number_window != nil
        @input_number_window.contents_opacity = 0
      end
      @fade_in = true
      return
    end
    # If message which should be displayed is not shown, but window is visible
    if self.visible
      @fade_out = true
      self.opacity -= 48
      if self.opacity == 0
        self.visible = false
        @fade_out = false
        $game_temp.message_window_showing = false
      end
      return
    end
  end
  
end


Background Windows add-on

Code:
class Window_Ring_Command < Window_Base
  
  alias background_windows_initialize initialize
  def initialize(x_pos, y_pos, commands, radius = 150.0)
    @windows = []
    background_windows_initialize(x_pos, y_pos, commands, radius = 150.0)
  end
  
  def refresh
    self.contents.clear
    unless @windows == []
      for i in 0...@windows.size
        @windows[i].dispose
        @windows[i] = nil
      end
      @windows = []
    end
    if @moving != 0
      @moving = (Math.abs(@moving) - 1) * (@moving/Math.abs(@moving))
    end
    max_item = @commands.size
    pi_part = (2 * Math::PI) / max_item
    for i in 0...max_item
      x = (@radius * Math.sin((i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @x_pos
      x = x.to_i
      y = (@radius * Math.cos((i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @y_pos
      y = y.to_i
      @windows[@windows.size] = Window_Base.new(x, y, 158, 50)
      draw_item(x, y, i)
    end
  end
  
  def dispose
    unless @windows == []
      for i in 0...@windows.size
        @windows[i].dispose
        @windows[i] = nil
      end
      @windows = []
    end
    super
  end
  
end
 

Kaito

Member

Yay~ I finally understand on how to use this...Couldn't believe it's so simple.^^
Neways...To use ring command in battles, place this script above main:
Code:
#==============================================================================
# ** Scene_Battle (part 1)
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Initialize each kind of temporary battle data
    $game_temp.in_battle = true
    $game_temp.battle_turn = 0
    $game_temp.battle_event_flags.clear
    $game_temp.battle_abort = false
    $game_temp.battle_main_phase = false
    $game_temp.battleback_name = $game_map.battleback_name
    $game_temp.forcing_battler = nil
    # Initialize battle event interpreter
    $game_system.battle_interpreter.setup(nil, 0)
    # Prepare troop
    @troop_id = $game_temp.battle_troop_id
    $game_troop.setup(@troop_id)
    # Make actor command window
    s1 = $data_system.words.attack
    s2 = $data_system.words.skill
    s3 = $data_system.words.guard
    s4 = $data_system.words.item
    @actor_command_window = Window_Ring_Command.new(60, 80, [s1, s2, s3, s4], 60)
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Make other windows
    @party_command_window = Window_PartyCommand.new
    @help_window = Window_Help.new
    @help_window.back_opacity = 160
    @help_window.visible = false
    @status_window = Window_BattleStatus.new
    @message_window = Window_Message.new
    # Make sprite set
    @spriteset = Spriteset_Battle.new
    # Initialize wait count
    @wait_count = 0
    # Execute transition
    if $data_system.battle_transition == ""
      Graphics.transition(20)
    else
      Graphics.transition(40, "Graphics/Transitions/" +
        $data_system.battle_transition)
    end
    # Start pre-battle phase
    start_phase1
    # Main loop
    loop do
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    end
    # Refresh map
    $game_map.refresh
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @actor_command_window.dispose
    @party_command_window.dispose
    @help_window.dispose
    @status_window.dispose
    @message_window.dispose
    if @skill_window != nil
      @skill_window.dispose
    end
    if @item_window != nil
      @item_window.dispose
    end
    if @result_window != nil
      @result_window.dispose
    end
    # Dispose of sprite set
    @spriteset.dispose
    # If switching to title screen
    if $scene.is_a?(Scene_Title)
      # Fade out screen
      Graphics.transition
      Graphics.freeze
    end
    # If switching from battle test to any screen other than game over screen
    if $BTEST and not $scene.is_a?(Scene_Gameover)
      $scene = nil
    end
  end
  #--------------------------------------------------------------------------
  # * Determine Battle Win/Loss Results
  #--------------------------------------------------------------------------
  def judge
    # If all dead determinant is true, or number of members in party is 0
    if $game_party.all_dead? or $game_party.actors.size == 0
      # If possible to lose
      if $game_temp.battle_can_lose
        # Return to BGM before battle starts
        $game_system.bgm_play($game_temp.map_bgm)
        # Battle ends
        battle_end(2)
        # Return true
        return true
      end
      # Set game over flag
      $game_temp.gameover = true
      # Return true
      return true
    end
    # Return false if even 1 enemy exists
    for enemy in $game_troop.enemies
      if enemy.exist?
        return false
      end
    end
    # Start after battle phase (win)
    start_phase5
    # Return true
    return true
  end
  #--------------------------------------------------------------------------
  # * Battle Ends
  #     result : results (0:win 1:lose 2:escape)
  #--------------------------------------------------------------------------
  def battle_end(result)
    # Clear in battle flag
    $game_temp.in_battle = false
    # Clear entire party actions flag
    $game_party.clear_actions
    # Remove battle states
    for actor in $game_party.actors
      actor.remove_states_battle
    end
    # Clear enemies
    $game_troop.enemies.clear
    # Call battle callback
    if $game_temp.battle_proc != nil
      $game_temp.battle_proc.call(result)
      $game_temp.battle_proc = nil
    end
    # Switch to map screen
    $scene = Scene_Map.new
  end
  #--------------------------------------------------------------------------
  # * Battle Event Setup
  #--------------------------------------------------------------------------
  def setup_battle_event
    # If battle event is running
    if $game_system.battle_interpreter.running?
      return
    end
    # Search for all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event pages
      page = $data_troops[@troop_id].pages[index]
      # Make event conditions possible for reference with c
      c = page.condition
      # Go to next page if no conditions are appointed
      unless c.turn_valid or c.enemy_valid or
             c.actor_valid or c.switch_valid
        next
      end
      # Go to next page if action has been completed
      if $game_temp.battle_event_flags[index]
        next
      end
      # Confirm turn conditions
      if c.turn_valid
        n = $game_temp.battle_turn
        a = c.turn_a
        b = c.turn_b
        if (b == 0 and n != a) or
           (b > 0 and (n < 1 or n < a or n % b != a % b))
          next
        end
      end
      # Confirm enemy conditions
      if c.enemy_valid
        enemy = $game_troop.enemies[c.enemy_index]
        if enemy == nil or enemy.hp * 100.0 / enemy.maxhp > c.enemy_hp
          next
        end
      end
      # Confirm actor conditions
      if c.actor_valid
        actor = $game_actors[c.actor_id]
        if actor == nil or actor.hp * 100.0 / actor.maxhp > c.actor_hp
          next
        end
      end
      # Confirm switch conditions
      if c.switch_valid
        if $game_switches[c.switch_id] == false
          next
        end
      end
      # Set up event
      $game_system.battle_interpreter.setup(page.list, 0)
      # If this page span is [battle] or [turn]
      if page.span <= 1
        # Set action completed flag
        $game_temp.battle_event_flags[index] = true
      end
      return
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # If battle event is running
    if $game_system.battle_interpreter.running?
      # Update interpreter
      $game_system.battle_interpreter.update
      # If a battler which is forcing actions doesn't exist
      if $game_temp.forcing_battler == nil
        # If battle event has finished running
        unless $game_system.battle_interpreter.running?
          # Rerun battle event set up if battle continues
          unless judge
            setup_battle_event
          end
        end
        # If not after battle phase
        if @phase != 5
          # Refresh status window
          @status_window.refresh
        end
      end
    end
    # Update system (timer) and screen
    $game_system.update
    $game_screen.update
    # If timer has reached 0
    if $game_system.timer_working and $game_system.timer == 0
      # Abort battle
      $game_temp.battle_abort = true
    end
    # Update windows
    @help_window.update
    @party_command_window.update
    @actor_command_window.update
    @status_window.update
    @message_window.update
    # Update sprite set
    @spriteset.update
       if  @actor_command_window != nil
       @actor_command_window.update
      if Input.trigger?(Input::LEFT)
        unless  @actor_command_window.moving?
           @actor_command_window.move_left
        end
      end
      if Input.trigger?(Input::RIGHT)
        unless  @actor_command_window.moving?
           @actor_command_window.move_right
        end
      end
    end
    # If transition is processing
    if $game_temp.transition_processing
      # Clear transition processing flag
      $game_temp.transition_processing = false
      # Execute transition
      if $game_temp.transition_name == ""
        Graphics.transition(20)
      else
        Graphics.transition(40, "Graphics/Transitions/" +
          $game_temp.transition_name)
      end
    end
    # If message window is showing
    if $game_temp.message_window_showing
      return
    end
    # If effect is showing
    if @spriteset.effect?
      return
    end
    # If game over
    if $game_temp.gameover
      # Switch to game over screen
      $scene = Scene_Gameover.new
      return
    end
    # If returning to title screen
    if $game_temp.to_title
      # Switch to title screen
      $scene = Scene_Title.new
      return
    end
    # If battle is aborted
    if $game_temp.battle_abort
      # Return to BGM used before battle started
      $game_system.bgm_play($game_temp.map_bgm)
      # Battle ends
      battle_end(1)
      return
    end
    # If waiting
    if @wait_count > 0
      # Decrease wait count
      @wait_count -= 1
      return
    end
    # If battler forcing an action doesn't exist,
    # and battle event is running
    if $game_temp.forcing_battler == nil and
       $game_system.battle_interpreter.running?
      return
    end
    # Branch according to phase
    case @phase
    when 1  # pre-battle phase
      update_phase1
    when 2  # party command phase
      update_phase2
    when 3  # actor command phase
      update_phase3
    when 4  # main phase
      update_phase4
    when 5  # after battle phase
      update_phase5
    end
  end
end
^-^

Neways Formar...about adding icons...I found this script by Seph. Really similiar, but he's one has icons, and yours have simplicity.^^ If you could merge em, it will be great!
Code:
#==============================================================================
# Window_RingMenu
#-----------------------------------------------------------------
#  Created By SephirothSpawn (10.29.05)
#     Last Updated: (11.11.05)
#==============================================================================

#==============================================================================
# Class Window Ring Menu
#==============================================================================
class Window_RingMenu < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :index
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(commands, icons, radius = 64, center_x = nil, center_y = nil, width = 640, height = 480)
    # Sets Up Window
    super(0, 0, width, height)
    # Sets Center Coordinates to player Center by Default
    center_x = $game_player.screen_x - 30 if center_x == nil
    center_y = $game_player.screen_y - 48 if center_y == nil
    self.contents = Bitmap.new(width-32, height-32)
    # Select Font Type, Size and Color
    self.contents.font.name = "Arial"
    self.contents.font.size = 22
    self.contents.font.color = Color.new(255, 255, 255, 255)
    # Sets up Window Border and Window Background Opacity
    self.opacity, self.back_opacity = 0, 0
    # Sets Up Commands & Icons
    @commands = commands
    @item_max = commands.size
    @index = 0
    @items = icons
    # Sets Up Radius
    @radius = radius
    # Sets Up Disabled Items
    @disabled = Array.new(@item_max, false)
    # Sets Up Center of Ring
    @cx = center_x
    @cy = center_y
    # Disabled Icon
    @icon_disable = RPG::Cache.icon("")
    # Frame Setup
    @startup_frames = 20
    @moving_frames = 5
    setup_move_start
    refresh
  end
  #--------------------------------------------------------------------------
  # * Setup Move Start
  #--------------------------------------------------------------------------
  def setup_move_start
    @mode = 1
    @steps = @startup_frames
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
      when 1; refresh_start
      when 2; refresh_wait
      when 3; refresh_move(1)
      when 4; refresh_move(0)
    end
    rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index], 1)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh Start
  #--------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / @startup_frames
    r = @radius - 1.0 * @radius * @steps / @startup_frames
    for i in 0...@item_max
      j = i - @index + 1
      d = d1 * j + d2 * @steps
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = 2
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Wait
  #--------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index + 1
      x = @cx + ( @radius * Math.sin( d * j ) ).to_i
      y = @cy - ( @radius * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Move
  #--------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / @moving_frames
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index + 1
      d = d1 * j + d2 * @steps
      x = @cx + ( @radius * Math.sin( d ) ).to_i
      y = @cy - ( @radius * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = 2
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(x, y, i)
    rect = Rect.new(0, 0, @items[i].width, @items[i].height)
    if @index == i
      self.contents.blt( x, y, @items[i], rect )
      if @disabled[@index]
        self.contents.blt( x, y, @icon_disable, rect )
      end
    else
      self.contents.blt( x, y, @items[i], rect, 128 )
      if @disabled[@index]
        self.contents.blt( x, y, @icon_disable, rect, 128 )
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
  #--------------------------------------------------------------------------
  # * Setup Move Move
  #--------------------------------------------------------------------------
  def setup_move_move(mode)
    if mode == 3
      @index -= 1
      @index = @items.size - 1 if @index < 0
    elsif mode == 4
      @index += 1
      @index = 0 if @index >= @items.size
    else
      return
    end
    @mode = mode
    @steps = @moving_frames
  end
  #--------------------------------------------------------------------------
  # * Animation
  #--------------------------------------------------------------------------
  def animation?
    return @mode != 2
  end
end

Cya~
 
They are the same simplicity. Mine just has one more object to send to the initialize method.

But I do desperty need to update that (which I am almost getting to in my command window package).


Anyways, great work Fomar. You are on your way to be a great assent to the community.
 
Kaito;109250 said:
Yay~ I finally understand on how to use this...Couldn't believe it's so simple.^^
Neways...To use ring command in battles, place this script above main:

^-^

Thanks you saved me some time by doing that.

Kaito;109250 said:
Neways Formar...about adding icons...I found this script by Seph. Really similiar, but he's one has icons, and yours have simplicity.^^ If you could merge em, it will be great!

Cya~

I have an alternate idea on how to do icons (which shouldn't be a problem unless you have more than 50 or so icons).

SephirothSpawn;109252 said:
Anyways, great work Fomar. You are on your way to be a great asset to the community.

Thank you, you are already a great asset.


EDIT: Icon time...this way seemed easier to me rather than pass an array full of icon names everytime.
You add an entry to the hash array like shown and then to use you just need to do the following, when your putting the text eg 'Items' add a $ and then a reference to the icon eg:
I used '$PYes' and '$QNo' to make this:
http://i4.photobucket.com/albums/y139/F ... wicons.png[/IMG]
Code:
class Window_Ring_Command < Window_Base
  
  Icons = {'P'=>'001-Weapon01','Q'=>'002-Weapon02',}
  
  def draw_item(x, y, i)
    k = i + @index
    if k >= @commands.size
      k -= @commands.size
    end
    text = @commands[k]
    if @commands[k][0, 1] == '$'
      icon = @commands[k][1, 1]
      if Icons[icon] != nil
        bitmap = RPG::Cache.icon(Icons[icon])
        self.contents.blt(x, y, bitmap, Rect.new(0, 0, 24, 24), 255)
        self.contents.draw_text(x + 24, y, 150, 32, text[2, (text.size - 2)])
        return
      end
    end
    self.contents.draw_text(x, y, 150, 32, text)
  end
  
end
 
The screenshot... I can just add the windows' opacity=0 right?
And how can i remove the text? (im guessing in the variable valuing?)
 

Kaito

Member

Alright~ Finally I can finish my menu.^^

One question: How do you edit so the selected command is on the right instead of the current bottom?

thank you!
Cya~
 
~Atlaswing~;111852 said:
The screenshot... I can just add the windows' opacity=0 right?
And how can i remove the text? (im guessing in the variable valuing?)

You mean to just have icons?

Use the original code without the background windows add on and use the icon add on and just pass an Icon to the class when you initialise it.

Which reminds me *edits main post with background windows*

Kaito;111926 said:
Alright~ Finally I can finish my menu.^^

One question: How do you edit so the selected command is on the right instead of the current bottom?

thank you!
Cya~
Try this.
Code:
class Window_Ring_Command < Window_Base

  def refresh
    self.contents.clear
    if @moving != 0
      @moving = (Math.abs(@moving) - 1) * (@moving/Math.abs(@moving))
    end
    max_item = @commands.size
    pi_part = (2 * Math::PI) / max_item
    for i in 0...max_item
      x = (@radius * Math.sin((Math::PI/2) + (i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @x_pos
      x = x.to_i
      y = (@radius * Math.cos((Math::PI/2) + (i * pi_part) + (@moving * (pi_part/Turn_Frames)))) + @y_pos
      y = y.to_i
      draw_item(x, y, i)
    end
  end
  
end
 
@Prime: This is a scripting tool, which means nothing will happen unless you write some methods around it... for example, you could change the input processing inside Scene_Map for B key (Esc/X) so it doesn't automatically shoots the menu, but brings up a command window first... in general, you call it like this:

Code:
@window_nickname = Window_Ring_Command.new(x_pos, y_pos, commands, radius)
 

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