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.

Centering Battlers

I know there have been people repeatedly requesting a script that centers the players' battlers (using the default battle system), but I haven't actually seen one.

Basically, let's say we have two party members.

[Enemies]
[Actor1][Actor2]_____________

With the script, it should look like this:

[Enemies]
________[Actor1][Actor2]________


2nd Example. Three party members:

[Enemies]
____[Actor1][Actor2][Actor3]____
 
Here's the script to center the battlers i made it and yes you can use it... I'm not sure how to get rid of the black area behind the battlers though.. and i know that the XRXS website has a script to do it, but like you said its impossible to contact him.. so maybe if you need it, maybe someone else can help you with that.. sorry

Code:
#==============================================================================
# ===Center Battlers===
#  Script by xthexdarknessx
#==============================================================================
#  Sprite_Battler
#==============================================================================
#  Game_Battler 
#==============================================================================

class Sprite_Battler < RPG::Sprite
 attr_accessor :battler                  
 def update
   super
   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
     if @battler.dead? or @battler.hidden
       self.opacity = 0
     end
   end
   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
#==============================================================================

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  
   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 
#==============================================================================

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
   @actor_command_window.index = 0
 end
end


 
Sephiroth7734;203798 said:
Ehhh. Sorry, but the first one's impossible to get permission from its creators, and the second one says the script is not for commercial use.
Regarding XRXS's site, permission isn't necessary. If you edit a script, they request you send a copy of your edit to them... but nothing about requesting permission. It DOES say you are limited to 'Shareware' games (commercial like Aveyond by Amanda F... our own member 'Lambchop'), and you must include credit to XRXS in the game... title... credit roll... etc.

So you may wanna give it a shot.
What I babelfished from the site, and a link to said site

XRXS (Cherry Tree Elegance Resident in Earth)
...at 'Shelf Script'...

Condition of Use: In regard to utilization UPDATE
  • When the script of the script shelf is utilized in the game,
  • Including the mind of appreciation, the staff roll of the game* 1, or
  • It will try adding the name of the developer to the introduction page and the like of the home page.
When it utilizes, necessary item
  • Your copyright inscription of appearance. (Publication of script developer name)
  • Name to place, link, to insert in the staff roll, the variety.
  • There is no feeling of appreciation, (what), excessively the small-sized game and the like
  • Also those where name is not done are the ant. In addition, "cherry tree elegance resident in earth" and name of developer
  • Each also it is good to write, and, the cartridge it is the "script shelf" just inscription
  • Also those where it does are the ant. In your own appearance.
When it utilizes, when you do, delightful thing
  • When shelf the game which utilizes the script completes, the report and the advertisement.
  • If the script inside the game which was usedwith the shelfboard the advertisement.
  • When the game which uses the shelf script is released it becomes encouragement.
It loads onto the game
  • Releasing the game by your
  • You apply to the contest and the like
  • Shareware sale
You remodel
  • You use in your own game
  • You contribute to the shelf
  • You publish to your own sight (Inside the remodelling script the 'link "and the 'effect' which was remodelled.)
  • You publish to your own sight that way

- - - - - - - - - - - - - - - - - - - - - - - - - -

What this translates into is:
  • The script is copyrighted and remains the author's.
  • Posting the script requires the url link be posted with the script.
  • By using this script in your game, it is required that full credit to this script be given and the author's name and the url above be listed in the scrolling/displaying credits of the game.
 
Took a hand at writing this meh 95 lines

Code:
=begin
#==============================================================================
# ●● Centered Status
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 1.0
# Date 5/10/07
# Goto rmxp.org for updates/support/bug reports
#------------------------------------------------------------------------------
# This script centers the Battle Status window with respect to how many actors
# there are Example:
# For One Actor Party
#
#
#             1
# For Two Actor Party
#
#
#         2       3        
# For Three Actor Party
#
#
#     1       2       3        
# For Four Actor Party
#
#
# 1       2       3       4
#==============================================================================
=end

#--------------------------------------------------------------------------
# ● Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Centered Status', 'Trickster', 1.0, '5/10/07')
#--------------------------------------------------------------------------
# ● Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [])
#--------------------------------------------------------------------------
# ● Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.enabled?('Centered Status')

class Game_Actor
  #--------------------------------------------------------------------------
  # * Screen_X
  #--------------------------------------------------------------------------
  alias_method :trick_centered_actor_screen_x, :screen_x
  def screen_x
    # Get X
    x = trick_centered_actor_screen_x
    # Get Centered Value
    return x - 80 * $game_party.actors.size + 320
  end
end

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias_method :trick_centered_battlestatus_initialize, :initialize
  def initialize
    # The Usual
    trick_centered_battlestatus_initialize
    # Get Size
    size = $game_party.actors.size
    # Dispose Contents
    self.contents.dispose
    # Setup New Position and Width
    self.x = 320 - 80 * size
    self.width = size * 160
    # Setup New Contents
    self.contents = Bitmap.new(width - 32, height - 32)
    # Refresh
    refresh
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Actor Command Window Setup
  #--------------------------------------------------------------------------
  alias_method(:trick_centered_battle_phase3_setup_command_window,
    :phase3_setup_command_window)
  def phase3_setup_command_window
    # The Usual
    trick_centered_battle_phase3_setup_command_window
    # Set X
    @actor_command_window.x += 320 - 80 * $game_party.actors.size
  end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end

Only requires SDK Part I which doesn't mess with any scripts
 
Please note that I get PMs from SA all the time and its rare that I see non SA related stuff

here is your answer, if I remember what you asked

Yes you can use my scripts, just credit Trickster no need to use my real name :p

Anything else?
 
what error were you getting on my script, even if you aren't going to use it i would kinda like to know so i can fix things, i can't figure it out, i have tried it with and without other scripts and i dont get an error at all.. unless it has to do with these lines
Code:
   self.contents.font.name = $fontface  
   self.contents.font.size = $fontsize
in which case change them to
Code:
   self.contents.font.name = "Arial"  
   self.contents.font.size = 24
also i figured out how to make the battle background fit the whole screen.

add
Code:
    @battleback_sprite.zoom_x = 1.5
    @battleback_sprite.zoom_y = 1.5
in Spriteset_Battle right under
Code:
    @battleback_sprite = Sprite.new(@viewport1)
 
Er.. That's not what I meant. I'm not getting a script error, it just won't let me change targets in battle.

Couldn't someone make a script that does what Trickster's "Battler Centering" script does, just without the need for his SDK?
 
Ok 1

You don't need the whole SDK for this just Part I if you have all of it then remove those parts

Part I does nothing to your scripts so I suggest you just got the whole thing

I believe you can remove the dependancy by removing the SDK lines at the top of the script and removing the last end statement from the script. try it it may work
 

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