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.

How to change battler window size

I want to know how to tweak the battler window box. I want the window to limit itself according to the actors in the team. How do I do this? E.g Now I have 1 hero in my team, but the length of the default battle system window is too long and meant for 4 heroes. So I want to tweak it so that the size depends on the player's party size. Thanks.
 
I had a script that would center your characters based on how many were in your party. So for example, if you only had one party member at the time, he would be in the center, instead of on the left. I don't have the script on this computer, but I could post it on here in a few hours if you would like, if no one else does it before me. But, this might not be what you're looking for...
 
So... it doesn't remove the empty spaces around the hero? Not exactly what I am looking for but centering my character wouldn't be too bad either. Thanks. I would appreciate it if you had posted the script. But it would really be nice if I could size the sides of the battle window then. Something like Master of the Wind's battle system. Centered and without the sides. Very nice.
 
There is a script, at one point, I had it but that was over a year ago. The one I had, the window was only as wide as the number of characters and it auto-centered the window.

Now, I think there's one that's with the RTAB, but if you aren't using that, then I don't know
 
You could also use something like:

In Window_BattleStatus search for:
Code:
super(x, y, width, height)

Just use for the width something like:
Code:
super(x, y, $game_party.actors.size * 160, height)
 
Sorry, almost forgot. The centering script is a bit more complicated. I'm not sure if there's a simpler way to do it. I just found it on the forums a while back. The author's name is "Matte"

Code:
#==============================================================================
# ¦ Sprite_Battler
#------------------------------------------------------------------------------
#  ????????????????Game_Battler ???????????????
# ????????????????????
#==============================================================================

class Sprite_Battler < RPG::Sprite
 #--------------------------------------------------------------------------
 # ? ??????????
 #--------------------------------------------------------------------------
 attr_accessor :battler                  # ????
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   super
   # ????? nil ???
   if @battler == nil
     self.bitmap = nil
     loop_animation(nil)
     return
   end
   # ????????????????????
   if @battler.battler_name != @battler_name or
      @battler.battler_hue != @battler_hue
     # ????????????
     @battler_name = @battler.battler_name
     @battler_hue = @battler.battler_hue
     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
     @width = bitmap.width
     @height = bitmap.height
     self.ox = @width / 2
     self.oy = @height
     # ?????????????????? 0 ???
     if @battler.dead? or @battler.hidden
       self.opacity = 0
     end
   end
   # ??????? ID ????????????
   if @battler.damage == nil and
      @battler.state_animation_id != @state_animation_id
     @state_animation_id = @battler.state_animation_id
     loop_animation($data_animations[@state_animation_id])
   end
   # ??????????????
   if @battler.is_a?(Game_Actor) and @battler_visible
     # ???????????????????????
     if $game_temp.battle_main_phase
       self.opacity += 3 if self.opacity < 255
     else
       self.opacity -= 3 if self.opacity > 207
     end
     if $game_party.actors.size == 1
       self.x = @battler.screen_x + 240
     elsif $game_party.actors.size == 2
       self.x = @battler.screen_x + 160
     elsif $game_party.actors.size == 3
       self.x = @battler.screen_x + 80
     elsif $game_party.actors.size == 4
       self.x = @battler.screen_x
     end
   elsif @battler.is_a?(Game_Enemy)
     self.x = @battler.screen_x
   end
   # ??
   if @battler.blink
     blink_on
   else
     blink_off
   end
   # ??????
   unless @battler_visible
     # ??
     if not @battler.hidden and not @battler.dead? and
        (@battler.damage == nil or @battler.damage_pop)
       appear
       @battler_visible = true
     end
   end
   # ?????
   if @battler_visible
     # ??
     if @battler.hidden
       $game_system.se_play($data_system.escape_se)
       escape
       @battler_visible = false
     end
     # ??????
     if @battler.white_flash
       whiten
       @battler.white_flash = false
     end
     # ???????
     if @battler.animation_id != 0
       animation = $data_animations[@battler.animation_id]
       animation(animation, @battler.animation_hit)
       @battler.animation_id = 0
     end
     # ????
     if @battler.damage_pop
       damage(@battler.damage, @battler.critical)
       @battler.damage = nil
       @battler.critical = false
       @battler.damage_pop = false
     end
     # ????
     if @battler.damage == nil and @battler.dead?
       if @battler.is_a?(Game_Enemy)
         $game_system.se_play($data_system.enemy_collapse_se)
       else
         $game_system.se_play($data_system.actor_collapse_se)
       end
       collapse
       @battler_visible = false
     end
   end
   # ??????????
   self.y = @battler.screen_y
   self.z = @battler.screen_z
 end
end


#==============================================================================
# ¦ Arrow_Actor
#------------------------------------------------------------------------------
#  ????????????????????????????? Arrow_Base ??
# ????????
#==============================================================================

class Arrow_Actor < Arrow_Base
 #--------------------------------------------------------------------------
 # ? ??????
 #--------------------------------------------------------------------------
 def update
   super
   # ?????
   if Input.repeat?(Input::RIGHT)
     $game_system.se_play($data_system.cursor_se)
     @index += 1
     @index %= $game_party.actors.size
   end
   # ?????
   if Input.repeat?(Input::LEFT)
     $game_system.se_play($data_system.cursor_se)
     @index += $game_party.actors.size - 1
     @index %= $game_party.actors.size
   end
   # ???????????
   if self.actor != nil
     if $game_party.actors.size == 1
       self.x = self.actor.screen_x + 240
     elsif $game_party.actors.size == 2
       self.x = self.actor.screen_x + 160
     elsif $game_party.actors.size == 3
       self.x = self.actor.screen_x + 80
     elsif $game_party.actors.size == 4
       self.x = self.actor.screen_x
     end
     self.y = self.actor.screen_y
   end
 end
end


#==============================================================================
# ¦ Window_BattleStatus
#------------------------------------------------------------------------------
#  ?????????????????????????????????
#==============================================================================

class Window_BattleStatus < Window_Base
 #--------------------------------------------------------------------------
 # ? ?????????
 #--------------------------------------------------------------------------
 def initialize
   super(0, 320, 160 * $game_party.actors.size, 160)
   self.contents = Bitmap.new(width - 32, height - 32)
   self.contents.font.name = $fontface  # "Battle Status" window font
   self.contents.font.size = $fontsize
   @level_up_flags = [false, false, false, false]
   if $game_party.actors.size == 3
     self.width = 480
     self.x = 80
   elsif $game_party.actors.size == 2
     self.width = 320
     self.x = 160
   elsif $game_party.actors.size == 1
     self.width = 160
     self.x = 240
   else
     self.width = 640
   end
   refresh
 end
end



#==============================================================================
# ¦ Scene_Battle (???? 3)
#------------------------------------------------------------------------------
#  ?????????????????
#==============================================================================

class Scene_Battle
   def phase3_setup_command_window
   # ?????????????????
   @party_command_window.active = false
   @party_command_window.visible = false
   # ?????????????????
   @actor_command_window.active = true
   @actor_command_window.visible = true
   # ???????????????????
     if $game_party.actors.size == 1
       @actor_command_window.x = (@actor_index * 160) + 240
     elsif $game_party.actors.size == 2
       @actor_command_window.x = (@actor_index * 160) + 160
     elsif $game_party.actors.size == 3
       @actor_command_window.x = (@actor_index * 160) + 80
     elsif $game_party.actors.size == 4
       @actor_command_window.x = @actor_index * 160
     end
   # ??????? 0 ???
   @actor_command_window.index = 0
 end
end

Then go to Spriteset_Battle and change this line
Code:
@viewport1 = Viewport.new(0, 0, 640, 320)

to this,
Code:
@viewport1 = Viewport.new(0, 0, 640, 480)

I'm not sure if this will conflict with the previous code you edited or not...
 

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