Help - Search - Members - Calendar
Full Version: SBS Battler Window
RPG RPG Revolution Forums > Scripting > Script Development and Support
Logan110
I was originally making a project in XP but decided to try out VX a little bit. While on VX I liked the Tankentai Battle Status window better and wanted to transfer that to XP. I spent awhile trying to go through the code to find where it was at but couldn't. Anyway is it possible to transfer the style to XP via copy and paste or will it take extra coding to be compatible?

Here is an example of the window on mine.




Here is what I want the bottom window to look like




Here is a copy of the vx demo if needed
http://www.mediafire.com/?u2d88czx6f2md48
Night_Runner
Give this a try:

Night_Runner's VX Window_BattleStatus for ENU's SBS
CODE
#==============================================================================
# ■ Night_Runner's VX Window_BattleStatus for ENU's SBS
# History:
#  Date Created: 29/07/2011
#  Created for: Logan110
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=51937
#==============================================================================


#==============================================================================
# ■ Scene_Battle
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  alias nr_VXWindowBattle_create_viewport  create_viewport  unless $@
  def create_viewport(*args)
    # Run the original create_viewport
    nr_VXWindowBattle_create_viewport(*args)
    # Make the party command window a normal options
    @party_command_window.dispose
    @party_command_window = Window_Command.new(160, ["Fight", "Escape"])
    @party_command_window.height = 160
    @party_command_window.back_opacity = 160
    # Move the actor command window
    @actor_command_window.y = 480 - @actor_command_window.height
    @actor_command_window.x = 640
    @party_command_window.x = 0
    @party_command_window.y = 480 - @party_command_window.height
  end
  #--------------------------------------------------------------------------
  alias nr_vxwindowbattle_update  update  unless $@
  def update(*args)
    nr_vxwindowbattle_update(*args)
    pwx = swx = awx = 0
    @party_command_window.visible = @actor_command_window.visible = true
    case @phase
    when 1, 2
      @status_window.index = -1
      pwx = 0
      swx = @party_command_window.width
      awx = 640
    when 3
      @status_window.index = @active_battler.index unless @active_battler.nil?
      # Set the position for the party command window
      pwx = -@party_command_window.width
      swx = 0
      awx = 640 - @actor_command_window.width
      @actor_command_window.visible = @status_window.visible
    else
      @status_window.index = -1
      pwx = -@party_command_window.width
      swx = ( 640 - @status_window.width ) / 2
      awx = 640
    end
    winds = [ [@party_command_window, pwx],
              [@actor_command_window, awx],
              [@status_window,        swx] ]
    for wind in winds
      window , dest = wind[0], wind[1]
      speed = [(window.x - dest).abs / 4, 2].max
      if window.x < dest - speed
        window.x += speed
      elsif window.x > dest + speed
        window.x -= speed
      else
        window.x = dest
      end
    end
  end
  #--------------------------------------------------------------------------
  alias nr_VXWindowBattle_phase3_setup_command_wind phase3_setup_command_window
  def phase3_setup_command_window(*args)
    backup_actor_x = @actor_command_window.x
    # Run the original phase3...
    nr_VXWindowBattle_phase3_setup_command_wind(*args)
    @actor_command_window.y = 480 - @actor_command_window.height
    @actor_command_window.x = backup_actor_x
  end
end


#==============================================================================
# ■ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  def initialize
    super(160, 320, 480, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @level_up_flags = []
    $game_party.actors.size.times { @level_up_flags << false }
    self.back_opacity = 160
    self.z = 900
    @index = -1
    refresh
  end
  #--------------------------------------------------------------------------
  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 = 0
      actor_y = i * 32
      draw_actor_name(actor, actor_x, actor_y)
      draw_actor_hp(actor, actor_x + self.contents.width / 3, actor_y)
      draw_actor_sp(actor, actor_x + self.contents.width * 2 / 3, actor_y)
      dx = self.contents.text_size(actor.name).width + 10
      if @level_up_flags[i] and Lvl_UP_FLAG
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x + dx, actor_y, 64, 32, Lvl_Up_Msg )
      else
        draw_actor_state(actor, actor_x + dx, actor_y)
      end
    end
  end
  #--------------------------------------------------------------------------
  def update
    super
  end
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Update cursor rectangle
    self.cursor_rect.set(0, @index * 32, self.contents.width, 32)
  end
  #--------------------------------------------------------------------------
  def index=(num)
    @index = num
    update_cursor_rect
  end
end
Logan110
Works great. One more thing. Would it be possible to take the hp/mp bar from VX as well? I was looking through the RTP to find the bars but couldn't find it. Im going to guess it uses the System / Window.png file?
Night_Runner
Sephiroth Spawn made a script that allows you to have slanted bars (link).
The only thing is that you'll probably need to edit the colours if you wanted to get the exact colours, you just need to look for the lines like this:
CODE
draw_slant_bar(x, y + 18, actor.hp, actor.maxhp, bar_width, 6, bar_color = Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255))

Those last two arguments, Color.new(100, 0, 0, 255), end_color = Color.new(255, 0, 0, 255), specify the red, green and blue of the colours at the start and end of the bar respectively smile.gif
Logan110
Thanks a lot smile.gif . Exactly what i wanted. Sorry this is in script support guess it shoulda been in the request forum. I had originally thought the sbs script edited the entire battle.
sapphireluna
Sorry, where would I paste this script for it to work?
Night_Runner
It should work if you go in to the Script Editor, along the left look for 'Main', and if you right click on Main and select 'Insert' it should make a blank window on the right, and along the left it will be ABOVE MAIN, it should work if you paste it in there (so long as you have Tankentai's Sideview Battle System (there may be a newer version, but from memory I think that's the version I made this for) installed as well)
sapphireluna
Got it. Thanks!

Is there a way to display the character's level as well?

One more thing, is there a way to make it scroll so it shows the info of the 5th character, if there is one?
Atoa
Just a question... why you're using an custom script, when the tanketai itself have an add on that allows COMPLETE customization of status window?

The tankentai itself have the add-on battle window, that allows you to change the position of every information in the status screen, and show things like level, face and character graphics. With it you can even set the font individually for each info.
sapphireluna
I saw that. It's just that when switching to the horizontal display, all items appear on top of each other and you have to manually move them. That sounds time-consuming because of the trial and error you have to do until you've placed it exactly where you want it.
bluesuicidal
QUOTE
Just a question... why you're using an custom script, when the tanketai itself have an add on that allows COMPLETE customization of status window?

The tankentai itself have the add-on battle window, that allows you to change the position of every information in the status screen, and show things like level, face and character graphics. With it you can even set the font individually for each info.


Um.. I'd like to humbly ask.. what add on is that? I can't seem to find it.. I'm sorry.. I'm new to this.. biggrin.gif
Atoa
QUOTE (bluesuicidal @ Oct 11 2011, 11:41 AM) *
Um.. I'd like to humbly ask.. what add on is that? I can't seem to find it.. I'm sorry.. I'm new to this.. biggrin.gif

Did you really searched for it?

If you don't saw that, you should see a doctor... you might need to use glasses.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.