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.

[Filled] Better single battler placement

Hi, i need a script that, whenever you have only one person in your party and you start a battle that this person isn't displayed in the bottem left but in the center of the bottem also when you have only two members that they must be near the center and for 3 members also centered. If someone needs more explenation I will give it.
 
Ok, this requires 3 edits. One to position the battler image, one to position the status text, and one to position the actor command window. I'll include the original statement, commented, and the modified statement.

Scene_Battle 3, line 81
Code:
#    @actor_command_window.x = @actor_index * 160
    @actor_command_window.x = @actor_index * 160 + 320 - ($game_party.actors.size * 80)

Game_Actor, line 574
Code:
#      return self.index * 160 + 80
      return self.index * 160 + 400 - ($game_party.actors.size * 80)  #TMB

Window_BattleStatus, line 38
Code:
#      actor_x = i * 160 + 4
      actor_x = i * 160 + 4 + 320 - ($game_party.actors.size * 80)

Be Well
 
Thanks, but I have another question could you make it so that the window skin s adjusted to the amount of battlers. So that you don't have the big one even when there's only one battler.
It would be really great if you could do that.
 

Khoa

Member

This is SephirothSpawn 's Enhanced BattleStatus Window, please credit him
Place is below SDK

Code:
#==============================================================================
# ** Enhanced BattleStatus Window
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.1
# 2007-03-13
# SDK : Version 2.0+, Part I
#------------------------------------------------------------------------------
# * Version History :
#
#   Version 1 ---------------------------------------------------- (2007-02-11)
#    Version 1.1 ------------------------------------------------- (2007-03-13)
#     - Update : Added 'Stretch' Battlestatus Window Option
#------------------------------------------------------------------------------
# * Description :
#
#   This script was designed to center the battlestatus window depending on 
#   the parties size and/or seperate the status window with seperate dummy
#   windows.
#------------------------------------------------------------------------------
# * Instructions :
#
#   Place The Script Below the SDK and Above Main.
#------------------------------------------------------------------------------
# * Customization :
#
#   Default Settings
#    - Default_Center_Battlestatus_Window    = true or false
#    - Default_Seperate_Battlestatus_Window  = true or false
#    - Default_Stetch_To_Full_Width          = true or false
#------------------------------------------------------------------------------
# * Syntax :
#
#   Turning Center Justification On / Off
#    - $game_system.center_battlestatus   = true or false
#
#   Turn Seperate Status Windows On / Off
#    - $game_system.seperate_battlestatus = true or false
#
#   Turn Stretch to full window On / Off
#    - $game_system.stretch_battlestatus  = true or false
#==============================================================================

#------------------------------------------------------------------------------
# * SDK Log Script
#------------------------------------------------------------------------------
SDK.log('Enhanced BattleStatus Window', 'SephirothSpawn', 1.1, '2007-03-13')
SDK.check_requirements(2.0)

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if SDK.enabled?('Enhanced BattleStatus Window')
  
#==============================================================================
# ** Game_System
#==============================================================================
  
class Game_System
  #--------------------------------------------------------------------------
  # * Defaults
  #--------------------------------------------------------------------------
  Default_Center_Battlestatus_Window    = true
  Default_Seperate_Battlestatus_Window  = true
  Default_Stetch_To_Full_Width          = true
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :center_battlestatus
  attr_accessor :seperate_battlestatus
  attr_accessor :stretch_battlestatus
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_centerseperatebsw_gmsys_init, :initialize
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_centerseperatebsw_gmsys_init
    # Set Center / Sep Options
    @center_battlestatus   = Default_Center_Battlestatus_Window
    @seperate_battlestatus = Default_Seperate_Battlestatus_Window
    @stretch_battlestatus  = Default_Stetch_To_Full_Width
  end
end

#==============================================================================
# ** Window_BattleStatus
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_centersperate_windbtlst_init, :initialize
  alias_method :seph_centersperate_windbtlst_disp, :dispose
  alias_method :seph_centersperate_windbtlst_updt, :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_centersperate_windbtlst_init
    # If Center is On
    if $game_system.center_battlestatus
      width = $game_party.actors.size * 160
      self.x, self.width = 320 - width / 2, width
      if width - 32 < self.contents.width
        self.contents.dispose
        self.contents = Bitmap.new(width - 32, height - 32)
        refresh
      end
      self.opacity = 0
    end
    # If Stretch
    if $game_system.stretch_battlestatus
      self.x, self.width, self.opacity = 0, 640, 255
      # If Center
      if $game_system.center_battlestatus
        self.ox = - (640 - $game_party.actors.size * 160) / 2
      end
    end
    # If Seperate is On
    if $game_system.seperate_battlestatus
      @seperate_windows = []
      for i in 0...$game_party.actors.size
        w = Window_Base.new(self.x + i * 160, self.y, 160, 160)
        if $game_system.stretch_battlestatus
          w.x = (640 - $game_party.actors.size * 160) / 2
          w.x += i * 160
        end
        @seperate_windows << w
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Object Dispose
  #--------------------------------------------------------------------------
  def dispose
    # Original Dispose
    seph_centersperate_windbtlst_disp
    # Return if No Seperate Windows
    return if @seperate_windows.nil? 
    # Dispose Seperate Windows
    @seperate_windows.each {|x| x.dispose}
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Original Update
    seph_centersperate_windbtlst_updt
    # Return if No Seperate Windows
    return if @seperate_windows.nil? 
    # Turn Window Opacity Off
    self.opacity = 0 unless $game_system.stretch_battlestatus
    # Update Seperate Windows
    @seperate_windows.each {|x| x.update}
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_centersperate_gmact_sx, :screen_x
  #--------------------------------------------------------------------------
  # * Screen X
  #--------------------------------------------------------------------------
  def screen_x
    # If Center On
    if $game_system.center_battlestatus
      if self.index.nil?
        return 0
      else
        ox = 320 - ($game_party.actors.size * 160 / 2) + self.index * 160 + 80
        return ox
      end
    end
    # Return Original Screen X
    return seph_centersperate_gmact_sx
  end
end

#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

have fun (^^)
 
desperato":mmaflayo said:
Thanks, but I have another question could you make it so that the window skin s adjusted to the amount of battlers. So that you don't have the big one even when there's only one battler.
It would be really great if you could do that.

You could have asked for that to start with..... 

Window_BattleStatus, line 38  (change back to where it was)
Code:
      actor_x = i * 160 + 4
#      actor_x = i * 160 + 4 + 320 - ($game_party.actors.size * 80)

Window_BattleStatus, initialize method
Code:
  def initialize
    super(0, 320, 640, 160)
    # adjust the window size to # of characters                 # Add
    self.x = 320 - ($game_party.actors.size * 80)               # Add
    self.width = $game_party.actors.size * 160                  # Add
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = [false, false, false, false]
    refresh
  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