The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Alerith on July 13, 2007, 04:34:57 PM

Title: Help with Status Window.
Post by: Alerith on July 13, 2007, 04:34:57 PM
Im using an RTAB system by Cogwheel in addition to Minkoff's Animated Side View system.

Everything is working fine except for one minor detail:

The status window (HP/SP) does not update until I use a skill. Even if I take damage, it doesnt appear to be subtracted from my HP. But I know that the damage is still being registered, because I still die after taking so many hits.

If I use a skill that alters the status of a character (like from Normal to Poison) THEN the screen updates.

Does anyone have any idea on how to fix this?

Thanks,

-Alerith-
Title: Re: Help with Status Window.
Post by: modern algebra on July 13, 2007, 07:55:41 PM
Hmmmm, well...

I can't tell you what to do without seeing the script. But basically you have to find the place that damage is being done, and then put in something like @status_window.refresh.
Title: Re: Help with Status Window.
Post by: Alerith on July 13, 2007, 11:33:38 PM
These are the scripts. Im not sure which one I need to add the refresh command to.

I think it is this one, but im soooo script illiterate that im not quite sure:

Battle Status [spoiler]#===============================================================================
# ** BattleStatus Modification (RTAB Version)                            Credits
#    by DerVVulfman
#    Version 2.1
#    02-18-07
#
#-------------------------------------------------------------------------------
# ** A MODIFICATION OF
# ** Real time active battle (RTAB) Ver 1.12-1.16
# ** RTAB engine available at...
# ** http://members.jcom.home.ne.jp/cogwheel/
#-------------------------------------------------------------------------------
#  This script is a response  to a friend who wanted the battle status window to
#  display the hero(s) information in a different manner.  Instead of displaying
#  each hero's information  directly underneath of them,  it displays it along a
#  single horizontal line in the style of the Final Fantasy games.
#
#  EX:  ARSHES        HP 204 / SP 199   [Normal ]        [=========]
#       BASIL         HP 184 / SP  49   [Knockout]       [=========]
#       GLORIA        HP 234 / SP 299   [Normal ]        [=========]
#       HILDA         HP 214 / SP 129   [Normal ]        [=========]
#
#  As a bonus, the system can Right-Justify the display and set the transparency
#  of the status window.   The only caveat of this is that  it doesn't highlight
#  the name of the hero in action. But, I have altered the battle command window
#  to change its height to appear just over the name (or atb bar) of the current
#  hero in action (instead of moving left to right).

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Configuration Section

  # Behavior Controls
  $bstat_align    =     1  # Left/Right alignment of text (either 0 or 1)
  $bstat_cmnd     =     0  # Type of Command Window (0 = Original / 1 = New)
  $bstat_min_size =     6  # Minimum # of slots in the window

  # Positioning System
  $bstat_cmnd_ht  =   180  # Height of the default 'Command' window 180
  $bstat_top      =   480  # Bottom most position of the window (480 is default)
  $bstat_dist     =   40   # Vertical distance between actors (24 is tight)
  $bstat_marg     =   12   # Margin distance from top (12 is pretty tight)
 
  # Opacity settings
  $bstat_opa      =   190  # Opacity of the window's border
  $bstat_b_opa    =   190  # Opacity of the window's background
  $bcmnd_opa      =   205  # Opacity of the Command window's border
  $bcmnd_b_opa    =   205  # Opacity of the Command window's background


#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
#  This class is for all in-game windows.
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # * Draw Name (battler)
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #--------------------------------------------------------------------------
  def draw_battler_name(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 120, 32, actor.name, 2)
  end 
end


#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# ?It is the window which indicates the status of the party member in the
#  battle picture.
#==============================================================================

class Window_BattleStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @oldsize = $game_party.actors.size
    y = $game_party.actors.size * (64 - $bstat_dist)
    height = ($game_party.actors.size * (64 - $bstat_dist))
    if $bstat_min_size > $game_party.actors.size
      y = $bstat_min_size * (64 - $bstat_dist)
      height = ($bstat_min_size * (64 - $bstat_dist))
    end
    super(0, $bstat_top - y, 640, height)
    self.back_opacity = $bstat_b_opa
    self.opacity      = $bstat_opa
    @actor_window = []
    offset = $bstat_top - height - $bstat_marg
    for i in 0...$game_party.actors.size
      @actor_window.push(Window_ActorStatus.new(i, (i * (64-$bstat_dist)) + offset ))
    end
    @level_up_flags = [false, false, false, false]
    refresh
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    for window in @actor_window
      window.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(number = 0)
    if number == 0
      cnt = 0
      for window in @actor_window
        window.refresh(@level_up_flags[cnt])
        cnt += 1
      end
    else
      @actor_window[number - 1].refresh(@level_up_flags[number - 1])
    end
  end
  #--------------------------------------------------------------------------
  # * AT gauge refreshment
  #--------------------------------------------------------------------------
  def at_refresh(number = 0)
    if number == 0
      for window in @actor_window
        window.at_refresh
      end
    else
      @actor_window[number - 1].at_refresh
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Renewal
  #--------------------------------------------------------------------------
  def update
    super
    # Establish if using a set window size, or expandable
    checkvalue = $game_party.actors.size
    if $bstat_min_size > $game_party.actors.size
      checkvalue = $bstat_min_size
    end
    # See if the window size is altered
    if self.y != $bstat_top - (checkvalue * (64 - $bstat_dist)) or
      $game_party.actors.size != @oldsize
      self.y = $bstat_top - (checkvalue * (64 - $bstat_dist))
      self.height = (checkvalue * (64 - $bstat_dist))
      for window in @actor_window
        window.dispose
      end
      @actor_window = []
      for i in 0...$game_party.actors.size
        @actor_window.push(Window_ActorStatus.new(i, y + i * (64 - $bstat_dist)- $bstat_marg))
      end
      @oldsize = $game_party.actors.size
      refresh     
    end
    for window in @actor_window
      window.update
    end
  end
end

#==============================================================================
# ** Window_ActorStatus
#------------------------------------------------------------------------------
# ?It is the window which indicates the status of the party member respectively
#  in the battle picture.
#==============================================================================

class Window_ActorStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(id, y)
    @actor_num = id
    super(0, $bstat_top - y, 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    actor = $game_party.actors[@actor_num]
    @actor_nm = actor.name
    @actor_mhp = actor.maxhp
    @actor_msp = actor.maxsp
    @actor_hp = actor.hp
    @actor_sp = actor.sp
    @actor_st = make_battler_state_text(actor, 120, true)
    @status_window = []
    for i in 0...5
      @status_window.push(Window_DetailsStatus.new(actor, i, y))
    end
    refresh(false)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    for i in 0...5
      @status_window.dispose
    end
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(level_up_flags)
    self.contents.clear
    actor = $game_party.actors[@actor_num]
    @status_window[0].refresh(actor) if @actor_nm != actor.name
    @status_window[1].refresh(actor) if
      @actor_mhp != actor.maxhp or @actor_hp != actor.hp
    @status_window[2].refresh(actor) if
      @actor_msp != actor.maxsp or @actor_sp != actor.sp
    @status_window[3].refresh(actor, level_up_flags) if
      @actor_st != make_battler_state_text(actor, 120, true) or level_up_flags
    @actor_nm = actor.name
    @actor_mhp = actor.maxhp
    @actor_msp = actor.maxsp
    @actor_hp = actor.hp
    @actor_sp = actor.sp
    @actor_st = make_battler_state_text(actor, 120, true)
  end
  #--------------------------------------------------------------------------
  # * AT gauge refreshment
  #--------------------------------------------------------------------------
  def at_refresh
    @status_window[4].refresh($game_party.actors[@actor_num])
  end
  #--------------------------------------------------------------------------
  # * Frame Renewal
  #--------------------------------------------------------------------------
  def update
    for window in @status_window
      window.update
    end
  end
end

#==============================================================================
# ** Window_DetailsStatus
#------------------------------------------------------------------------------
# ?It is the window which indicates the status of the actor in individually in the battle picture.
#==============================================================================

class Window_DetailsStatus < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor, id, y)
    @status_id = id
    super(0 , y , 640, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.back_opacity = 0
    refresh(actor, false)
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    super
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh(actor, level_up_flags = false)
    self.contents.clear
    if $bstat_align == 0
      # Draw Name/Hp etc left to right
      case @status_id
      when 0
        draw_actor_name(actor, 4, -8)
      when 1
        draw_actor_hp(actor, 152, -8, 80)
      when 2
        draw_actor_sp(actor, 248, -8, 80)
      when 3
        if level_up_flags
          self.contents.font.color = normal_color
          self.contents.draw_text(344, -8, 120, 32, "LEVEL UP!")
        else
          draw_actor_state(actor, 344, -8)
        end
      when 4
        draw_actor_atg(actor, 488, -8, 120)
      end
    else 
      # Draw Name/Hp etc right to left
      case @status_id
      when 0
        draw_battler_name(actor, 488, -8)
      when 1
        draw_actor_hp(actor, 296, -8, 80)
      when 2
        draw_actor_sp(actor, 392, -8, 80)
      when 3
        if level_up_flags
          self.contents.font.color = normal_color
          self.contents.draw_text(160, -8, 120, 32, "LEVEL UP!")
        else
          draw_actor_state(actor, 160, -8)
        end
      when 4
        draw_actor_atg(actor, 0, -8, 120)
      end
    end   
  end
  #--------------------------------------------------------------------------
  # * Frame renewal
  #--------------------------------------------------------------------------
  def update
    #At the time of main phase opacity is lowered a little
    if $game_temp.battle_main_phase
      self.contents_opacity -= 4 if self.contents_opacity > 191
    else
      self.contents_opacity += 4 if self.contents_opacity < 255
    end
  end
end



#==============================================================================
# ** Scene_Battle (Division definition 3)
#------------------------------------------------------------------------------
# * It is the class which processes the battle picture.
#==============================================================================
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Setup of actor command window
  #--------------------------------------------------------------------------
  def phase3_setup_command_window
    offset = $bstat_top - ($game_party.actors.size * 64)
    # Nullifying the party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Enabling the actor command window
    @actor_command_window.active = true
    @actor_command_window.visible = true
    if $bstat_cmnd == 0
      # Get relative position of window in percentages
      x_perc = ((@actor_index +1) * 100) / $game_party.actors.size
      # Apply position to 640 width of screen
      xpos = ((640 * x_perc) / 100)
      # Get window width difference in percentages
      wperc = (($game_party.actors.size - 1) * 100) / $game_party.actors.size
      # Get amount of window to remove
      wperc2 = @actor_command_window.width
      if $game_party.actors.size > 4
        wperc2 = (@actor_command_window.width * wperc) / 100
      end
      if xpos - wperc2 <0
        wperc2 = xpos
      end
      if xpos - wperc2 > (640 - @actor_command_window.width)
        wperc2 = @actor_command_window.width
      end
      # Apply command window difference
      xpos = xpos - wperc2
      #(@actor_command_window.width)
      # Set position
      @actor_command_window.x = xpos
      @actor_command_window.y = $bstat_cmnd_ht                             
      #print wperc
    else
      @actor_command_window.x = 0
      if $bstat_align != 0
        @actor_command_window.x = 640 - @actor_command_window.width
      end
      checkvalue = ($game_party.actors.size * (64 - $bstat_dist))
      if $bstat_min_size > $game_party.actors.size
        checkvalue = $bstat_min_size * (64 - $bstat_dist)
      end
      @actor_command_window.y = ($bstat_top - (checkvalue)) -
        (@actor_command_window.height - (@actor_index * (64 - $bstat_dist)))
    end
    @actor_command_window.back_opacity = $bcmnd_b_opa
    @actor_command_window.opacity = $bcmnd_opa
    @actor_command_window.z = 125
    @actor_command_window.index = 0
  end
end[/spoiler]
Title: Re: Help with Status Window.
Post by: modern algebra on July 14, 2007, 12:37:54 AM
It works for me. I'm gueesing there's somethig in your version of the RTAB that's messed up.

Errmmm...

post the game project and I'll see if I can work it out. If it is your regular game project and you don't want to hand it out, then just make a new project and mimic the situation of your game project and upload that