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.

DBS edit

Yuegen

Member

I need an edit to the default battle system that has the actors centered on the bottom instead of lined up from the left. For example if I only have one actor in the party I would like him to be centered in the bottom window instead of all the way to the left. Same for two or three actors. Can anybody help me out? thanks.
 

Atoa

Member

Code:
#==========================================================================

# ** Battler Centralize

#==========================================================================

# por SandGolem

# Version 2

# January 16th, 2008

#==========================================================================

class Window_BattleStatus < Window_Base

  def refresh

    self.contents.clear

    @item_max = $game_party.actors.size

    for i in 0...$game_party.actors.size

      actor = $game_party.actors[i]

      actor_x = i * 160 + 4

      actor_x = i * 160 + 240 if $game_party.actors.size == 1

      actor_x = i * 160 + 160 if $game_party.actors.size == 2

      actor_x = i * 160 + 80 if $game_party.actors.size == 3

      draw_actor_name(actor, actor_x, 0)

      draw_actor_hp(actor, actor_x, 32, 120)

      draw_actor_sp(actor, actor_x, 64, 120)

      if @level_up_flags[i]

        self.contents.font.color = normal_color

        self.contents.draw_text(actor_x, 96, 120, 32, "Nível Acima!")

      else

        draw_actor_state(actor, actor_x, 96)

      end

    end

  end

end

 

class Game_Actor

  alias_method :sg_centerpgroup_screenx, :screen_x

  def screen_x

    sg_temp = sg_centerpgroup_screenx

    sg_temp += 240 if $game_party.actors.size == 1

    sg_temp += 160 if $game_party.actors.size == 2

    sg_temp += 80 if $game_party.actors.size == 3

    return sg_temp

  end

end

 

class Scene_Battle

  alias_method :sg_centerpgroup_p3setupcom, :phase3_setup_command_window

  def phase3_setup_command_window

    sg_centerpgroup_p3setupcom

    @actor_command_window.x += 240 if $game_party.actors.size == 1

    @actor_command_window.x += 160 if $game_party.actors.size == 2

    @actor_command_window.x += 80 if $game_party.actors.size == 3

  end

end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top