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.

Actor_Commands over Battler Image?

Status
Not open for further replies.
I managed to make an in battle Ring Menu... Does anyone know how I can set it over the hero's battler (Instead of it putting itself over where the actor_command would normally be)? (I'm using Minkoff's animated battlers so I don't know if that would matter or anything.)
http://img178.imageshack.us/img178/4176 ... enuyy4.png[/img]
See it? I just need to center it above the battler. Or a way to set the exact positions for each of the 4 characters.

This is in my Scene_Battle...
Code:
# Make actor command window
    s1 = "Jump"
    s2 = "Hammer"
    s3 = "Special"
    s4 = "Party"
    s5 = $data_system.words.item
    s6 = $data_system.words.guard
    s7 = "Flee"
    @actor_command_window = Window_IconCommand.new(360, [s1, s2, s3, s4, s5, s6, s7])
    @actor_command_window.y = 160
    @actor_command_window.back_opacity = 160
    @actor_command_window.active = false
    @actor_command_window.visible = false

This is in a script above main:
Code:
#------------------------------------------------------------------------------
#  Window_IconCommand
#------------------------------------------------------------------------------
class Window_IconCommand < Window_Base
  STARTUP_FRAMES = 20
  MOVING_FRAMES = 6  
  RING_R = -33        
  ICON_JUMP   = RPG::Cache.icon("Jump")
  ICON_HAMMER  = RPG::Cache.icon("Run")
  ICON_SPECIAL  = RPG::Cache.icon("Tactics")
  ICON_PARTY = RPG::Cache.icon("Item")
  ICON_ITEM   = RPG::Cache.icon("Party")
  ICON_DEFEND   = RPG::Cache.icon("Special")
  ICON_EXIT   = RPG::Cache.icon("Hammer")
  ICON_DISABLE= RPG::Cache.icon("")
  SE_STARTUP = ""
  MODE_START = 1
  MODE_WAIT  = 2
  MODE_MOVER = 3
  MODE_MOVEL = 4
  attr_accessor :index
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize( center_x, center_y )
    super(0, 0, 640, 680)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "pmdialog"
    self.contents.font.color = system_color
    self.contents.font.size = 16
    self.opacity = 0
    self.back_opacity = 0
    s1 = "Jump"
    s2 = "Run"
    s3 = "Tactics"
    s4 = "Item"
    s5 = "Party"
    s6 = "Special"
    s7 = "Hammer"
    @commands = [ s1, s2, s3, s4, s5, s6, s7 ]
    @item_max = 7
    @index = 0
    @items = [ ICON_JUMP, ICON_HAMMER, ICON_SPECIAL, ICON_PARTY, ICON_ITEM, ICON_DEFEND, ICON_EXIT ]
    @disabled = [ false, false, false, false, false, false, false ]
    @cx = center_x
    @cy = center_y
    setup_move_start
    refresh
  end
#------------------------------------------------------------------------------
#  Update
#------------------------------------------------------------------------------
  def update
    super
    refresh
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
    when MODE_START
      refresh_start
    when MODE_WAIT
      refresh_wait
    when MODE_MOVER
      refresh_move(1)
    when MODE_MOVEL
      refresh_move(0)
    end
    rect = Rect.new(30 - 272, 100 + 24, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index],1)
  end
#------------------------------------------------------------------------------
#  Refresh Start
#------------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / STARTUP_FRAMES
    r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
    for i in 0...@item_max
      j = i - @index
      d = d1 * j + d2 * @steps
      x = 35 + ( r * Math.sin( d ) ).to_i
      y = 35 - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    end
  end
#------------------------------------------------------------------------------
#  Refresh Wait
#------------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index
      x = 35 + ( RING_R * Math.sin( d * j ) ).to_i
      y = 35 - ( RING_R * 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
      d = d1 * j + d2 * @steps
      x = 35 + ( RING_R * Math.sin( d ) ).to_i
      y = 35 - ( RING_R * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = MODE_WAIT
    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 Start
#------------------------------------------------------------------------------
  def setup_move_start
    @mode = MODE_START
    @steps = STARTUP_FRAMES
    if  SE_STARTUP != nil and SE_STARTUP != ""
      Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
    end
  end
#------------------------------------------------------------------------------
#  Setup Move Move
#------------------------------------------------------------------------------
  def setup_move_move(mode)
    if mode == MODE_MOVER
      @index -= 1
      @index = @items.size - 1 if @index < 0
    elsif mode == MODE_MOVEL
      @index += 1
      @index = 0 if @index >= @items.size
    else
      return
    end
    @mode = mode
    @steps = MOVING_FRAMES
  end
#------------------------------------------------------------------------------
#  Animation
#------------------------------------------------------------------------------
  def animation?
    return @mode != MODE_WAIT
  end
end
#------------------------------------------------------------------------------
#  Window_RingMenuStatus
#------------------------------------------------------------------------------
class Window_IconCommandStatus < Window_Selectable
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize
    super(204, 64, 232, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.size = $chara_select[5]
    refresh
    self.active = false
    self.index = -1
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.windowskin = RPG::Cache.windowskin($chara_select[4])
    self.contents.font.name = $chara_select[0]
    self.contents.font.color = text_color($chara_select[1])
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      x = 80
      y = 80 * i
      actor = $game_party.actors[i]
      draw_actor_graphic(actor, x - 60, y + 65)
      draw_actor_name(actor, x, y + 2)
      draw_actor_hp(actor, x - 40, y + 26)
      draw_actor_sp(actor, x - 40, y + 50)
    end
  end
#------------------------------------------------------------------------------
#  Update Cursor Rect
#------------------------------------------------------------------------------
  def update_cursor_rect
    if @index < 0
      self.cursor_rect.empty
    else
      self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
    end
  end
end
#------------------------------------------------------------------------------
#  Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
#  Name
#------------------------------------------------------------------------------
  def name
    $map_infos[@map_id]
  end
end
#------------------------------------------------------------------------------
#  Scene_Title
#------------------------------------------------------------------------------
class Scene_Title
  $map_infos = load_data("Data/MapInfos.rxdata")
  for key in $map_infos.keys
    $map_infos[key] = $map_infos[key].name
  end
end
#------------------------------------------------------------------------------
#  Window_Location
#------------------------------------------------------------------------------
class Window_Location < Window_Base
#------------------------------------------------------------------------------
#  Initialize
#------------------------------------------------------------------------------
  def initialize
    super(0, 0, $window_size[0], $window_size[1])
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $location_text[0]
    self.contents.font.size = $location_text[1]
    refresh
  end
#------------------------------------------------------------------------------
#  Refresh
#------------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.windowskin = RPG::Cache.windowskin($window_location_skin)
    self.contents.font.color = text_color($location_text[2])
    self.contents.draw_text(4, 0, 120, 32, $location_text[3])
    self.contents.font.color = text_color($location_text[4])
    self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)
  end
end
I'd really appreciate it from anybody help lends any assistance.
 
Add this:
Code:
class Scene_Battle
  #-------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  alias ring_p3scw phase3_setup_command_window
  def phase3_setup_command_window
    # Perform the original call
    ring_p3scw
    # Move the command window
    @actor_command_window.x = @active_battler.screen_x
    @actor_command_window.y = @active_battler.screen_y
  end
end

Paste it below BOTH scripts. It needs to refer to both the Momomo Ring command system and the revised screen_x and screen_y values.
 
This topic has been resolved. If Boo Mansion or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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