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.

This maybe a little easy but I am frustrated

Twirly

Sponsor

Hello everyone  :lol:
After getting an ATB script for VX (look at the icon)
I wanted to modify one of the scripts included in the battle system which shows new (and better) hp and mp bars(including the atb bar of course).
I wanted to remove the mp bar but it is really frustrating...
Here is the script:
Code:
#==============================================================================
# ★RGSS2 
# STR33g1_ãƒ
 
Try this:

#==============================================================================
# ?RGSS2
# STR33g1_????????  0.5 08/03/20
#
# ·STR11e has the same specifications.
# ?STR11e????????????????????????
#  ????????????????????
#
# ?Features
# ·Different HP/MP Gauge Flavor
# ·"Fast Rolling" Numbers
# ·State Icon Cycle
#
# ?Materials
# This script requires several image skins.
# Skin images are placed in the .Graphics\System folder.
#
# ·Main Skin
#  HP/MP Back Gauge Skin
#   No size limit.
# ·HP/MP Gauge
#  Normally two gauges for
#   Width = Unlimited
#  Height = Gauge Height(Optional) * 2
#  ??????????????????????????
# ·Numbers
#  0123456789 is the order of number arrays
#   Width = One Frame Width(Any Size) * 10
#  Height = Unlimited
# ·State Skin
#  State Icon Main Skin
#  ????????????????????????????
#  Main skin is separate.
#  No size limit.
#
#==============================================================================
# ¦ Window_BattleStatus
#==============================================================================
class Window_BattleStatus < Window_Selectable
  # ????????
  BTSKIN_00 = "atb_Btskin_main"   # ??????
  BTSKIN_01 = "atb_Btskin_hp"     # HP(???)
  BTSKIN_04 = "Btskin_n00"    # HP(??)
  BTSKIN_03 = "atb_Btskin_state"  # ???????
  # ??????[  x,  y]
  BTSKIN_B_XY = [  0,  0]     # ????
  BTSKIN_00XY = [  0,  0]     # ??????
  BTSKIN_01XY = [132, 16]     # HP(???)
  BTSKIN_02XY = [216, 16]     # MP(???)
  BTSKIN_04XY = [148,  2]     # HP(??)
  BTSKIN_05XY = [232,  2]     # MP(??)
  BTSKIN_03XY = [104,  0]     # ???????
  BTSKIN_06XY = [104,  0]     # ????
  # ????
  BTSKIN_01GS = 2             # HP???????(?????????)
  BTSKIN_02GS = 4             # MP???????(?????????)
  BTSKIN_04SS = 8             # HP????????(?????????)
  BTSKIN_05SS = 2             # MP????????(?????????)
  BTSKIN_04NS = 4             # HP????
  BTSKIN_05NS = 4             # MP????
  BTSKIN_06WH = [24,24]       # [?????,??]
  BTSKIN_06SC = 2             # ?????????????????
                              # (1?????·?????????)
  # ??????????
  def set_xy
    @x = []
    @y = []
    for i in 0...$game_party.members.size
      x = 0
      y = (i * 24)
      @x = x + 16#+ STRRGSS2::ST_SX
      @y = y + 16#+ STRRGSS2::ST_SY
    end
  end
  # ????????
  @@f = false
 
 
  #--------------------------------------------------------------------------
  # ? ?????
  #--------------------------------------------------------------------------
  alias initialize_str33 initialize
  def initialize(f = false)
    initialize_str33
    unless @@f
      @f = @@f = true
    else
      @f = false
    end
    set_xy
    @s_sprite = []
    @s_party = []
    @s_lv = []
    @opacity = 0
    self.contents.dispose
    self.create_contents
    self.back_opacity = 0
    self.opacity = 0
    #@column_max = $game_party.actors.size
    @viewport = Viewport.new(0, 416-128, 416, 128)
    @hpgw = (Cache.system(BTSKIN_01)).width
    @mpgw = (Cache.system(BTSKIN_02)).width
    @viewport.z = self.z - 1
    @state_opacity = []
    @item_max = $game_party.members.size
    return unless @f
    for i in 0...@item_max
      draw_item(i)
    end
    update
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def refresh
    # :)
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def draw_actor_state(actor)
    icon = Cache.system("Iconset")
    w = actor.states.size * 24
    w = 24 if w < 1
    bitmap = Bitmap.new(w, BTSKIN_06WH[1])
    count = 0
    for state in actor.states
      icon_index = state.icon_index
      x = 24 * count
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      bitmap.blt(x, 0, icon, rect)
      count += 1
    end
    return bitmap
  end
  #--------------------------------------------------------------------------
  # ? ????
  #--------------------------------------------------------------------------
  def name_bitmap(actor)
    bitmap = Bitmap.new(100, 24)
    bitmap.font.size = 16
    bitmap.draw_text_f(0, 0, 100, 24, actor.name)
    return bitmap
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def state_size(actor)
    return actor.states.size
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def draw_item(index)
    return unless @f
    actor = $game_party.members[index]
    #
    @s_sprite[index] = []
    s = @s_sprite[index]
    # ??????
    s[0] = Sprite.new(@viewport)
    s[0].bitmap = Cache.system(BTSKIN_00)
    s[0].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_00XY[0]
    s[0].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_00XY[1]
    s[0].z = 0
    # HP
    s[1] = Sprite.new(@viewport)
    s[1].bitmap = Cache.system(BTSKIN_01)
    s[1].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]
    s[1].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]
    s[1].z = 4
    w = s[1].bitmap.width
    h = s[1].bitmap.height / 2
    s[1].src_rect.set(0, 0, w, h)
    s[2] = Sprite.new(@viewport)
    s[2].bitmap = Cache.system(BTSKIN_01)
    s[2].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_01XY[0]
    s[2].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_01XY[1]
    s[2].z = 3
    s[2].src_rect.set(0, h, w, h)
    s[11] = 96
    s[6] = Sprite_strNumbers.new(@viewport, BTSKIN_04, BTSKIN_04NS)
    s[6].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_04XY[0]
    s[6].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_04XY[1]
    s[6].z = 5
    s[13] = actor.hp
    s[6].update(s[13])
    # MP
    # ????
    s[5] = Viewport.new(0, 0, BTSKIN_06WH[0], BTSKIN_06WH[1])
    s[5].rect.x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_06XY[0] + @viewport.rect.x
    s[5].rect.y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_06XY[1] + @viewport.rect.y
    s[5].z = @viewport.z + 1
    s[8] = Sprite.new(@viewport)
    s[8].bitmap = Cache.system(BTSKIN_03)
    s[8].x = @x[index] + BTSKIN_B_XY[0] + BTSKIN_03XY[0]
    s[8].y = @y[index] + BTSKIN_B_XY[1] + BTSKIN_03XY[1]
    s[8].z = -2
    s[9] = Plane.new(s[5])
    s[9].bitmap = draw_actor_state(actor)
    s[10] = state_size(actor)
    # ?????????
    s[11] = ((@hpgw * (actor.hp / (actor.maxhp * 1.0))) + 1).truncate
    # ????
    for l in [0,1,2,3,4,8,9,15]
      s[l].opacity = 0
    end
    for l in [6,7]
      s[l].o = 0
    end
    # ????
    @s_lv[index] = actor.level
    @s_party[index] = [actor.name, actor.hp, actor.maxhp,
                       actor.mp, actor.maxmp, actor.states]
    #
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def dispose       
    super
    return unless @f
    for i in 0...@s_sprite.size
      for l in [0,1,2,3,4,8,9,15]
        @s_sprite[l].bitmap.dispose
        @s_sprite[l].dispose
      end
      for l in [5,6,7]
        @s_sprite[l].dispose
      end
    end
    @@f = false
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update
    super
    return unless @f
    for i in 0...@s_sprite.size
      s = @s_sprite
      a = $game_party.members
      m = @s_party
      @state_opacity = 0 if @state_opacity == nil
      # ???????
      @state_opacity += 8
      if @opacity < 272
        @opacity += 8
        for l in [0,1,2,3,4,15]
          s[l].opacity = @opacity
        end
        for l in [6,7]
          s[l].o = @opacity
        end
      end
      # ????
      if a.name != m[0]
        s[15].bitmap.dispose
        s[15].bitmap = name_bitmap(a)
        m[0] = a.name
      end
      # HP/MP??
      update_hp(s,a,m)
      # ??????
      if s[10] > BTSKIN_06WH[0] / 24 and (Graphics.frame_count % BTSKIN_06SC) == 0
        s[9].ox += 1
      end
      if s[10] > 0 and @state_opacity < 272
        for l in [8,9]
          s[l].opacity = @state_opacity
        end
      end
      if a.states != m[5]
        m[5] = a.states
        s[9].ox = 0
        s[9].bitmap.dispose
        s[9].bitmap = draw_actor_state($game_party.members)
        s[10] = state_size($game_party.members)
        @state_opacity = 0
        for l in [8,9]
          s[l].opacity = @state_opacity
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ? ?????? (HP)
  #--------------------------------------------------------------------------
  def update_hp(s,a,m)
    # HP????
    if a.hp != s[13]
      c = 0; c = 1 if a.hp < a.maxhp / 4; c = 2 if a.hp == 0
      if s[13] > a.hp
        s[13] -= BTSKIN_04SS
        s[13] = a.hp if s[13] < a.hp
      else
        s[13] += BTSKIN_04SS
        s[13] = a.hp if s[13] > a.hp
      end
      s[6].update(s[13], c)
    end
    # HP
    if a.hp != m[1]
      s[11] = ((@hpgw * (a.hp / (a.maxhp * 1.0))) + 1).truncate
      m[1] = a.hp
    end
    sr = s[1].src_rect
    if sr.width != s[11]
      sp = BTSKIN_01GS
      sr.width = (s[11] + (s[1].src_rect.width * (sp - 1))) / sp
      sr.width = 2 if sr.width <= 1 and a.hp > 0
    end
    sr = s[2].src_rect
    sp = 2
    if sr.width != s[1].src_rect.width and (Graphics.frame_count % sp) == 0
      if sr.width < s[1].src_rect.width
        sr.width += 1
      else
        sr.width -= 1
      end
    end
    sr.width = 2 if sr.width <= 1 and a.hp > 0
  end
  #--------------------------------------------------------------------------
  # ? ?????? (MP)
  #--------------------------------------------------------------------------
 

#==============================================================================
# ¦ Sprite_strNumber
#==============================================================================
class Sprite_strNumber < Sprite
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize(v, gra, n = 0)
    @n = n
    super(v)
    self.bitmap = Cache.system(gra)
    @w = self.bitmap.width/10
    @h = self.bitmap.height/3
    self.src_rect = Rect.new(@n*@w, 0, @w, @h)
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update(n = -1, c = 0)
    @n = n
    self.src_rect.x = @n*@w
    self.src_rect.y = c*@h
  end
end
#==============================================================================
# ¦ Sprite_strNumbers
#==============================================================================
class Sprite_strNumbers
  attr_accessor :x
  attr_accessor :y
  attr_accessor :z
  attr_accessor :eek:
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def initialize(v, gra, n = 4, s = 0)
    @n = n # ??
    @x = 0
    @y = 0
    @z = 0
    @o = 255
    @sprite = []
    # ????
    b = Cache.system(gra)
    @s = b.width / 10 - s
    # ???????
    for i in 0...n
      @sprite = Sprite_strNumber.new(v, gra)
    end
    update
  end
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def update(v = 0, c = 0)
    val = []
    # ????????
    for i in 0...@n
      if (10 ** (i)) == 0
        val = v % 10
      else
        val = v / (10 ** (i)) % 10
      end
    end
    val = val.reverse
    # ???0?????
    for i in 0...@n
      if val == 0 and @n != i + 1
        val = -1
      else
        break
      end
    end
    # ???????
    for i in 0...@n
      @sprite.update(val, c)
      @sprite.x = @x + (i * @s)
      @sprite.y = @y
      @sprite.z = @z
      @sprite.opacity = @o
    end
  end
  #--------------------------------------------------------------------------
  # ? ???????
  #--------------------------------------------------------------------------
  def o=(val)
    @o = val
    for i in 0...@n
      @sprite.opacity = @o
    end
  end
  #--------------------------------------------------------------------------
  # ? ????????
  #--------------------------------------------------------------------------
  def dispose
    for i in 0...@sprite.size
      @sprite.bitmap.dispose
      @sprite.dispose
    end
  end
end


I don't have the system to test it with (downloading now) but it should work.

...Nope. Like the whole system, it's buggy.
 
Change these in that script to:

Code:
  BTSKIN_02 = ""     # MP(Gauge)
  BTSKIN_05 = ""    # MP(Numbers)

You will need to edit atb_Btskin_main.png to get rid of the MP back gauge, but that isn't hard.
 

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