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.

Kingdom Hearts II HUD (V 1.0)

Kingdom Hearts II HUD
Version: 1.0

Introduction

After months of Despain and others requesting this system, I have decided to do it.

This script was designed to remake the arc gradient bar HUD from Kingdom Hearts 2. It shows the HP and SP values, with a custom feature that will make the face change when hp drops, hp rises, your actor dies, or life falls below 25% health.

All HUD dimensions are customizable, although I did make a basic setup nearly perfectly matching the Kingdom Hearts 2 HUD. You may also toggle the visibility when a switch is on or off.

Screenshots


Demo

Script

Code:
#==============================================================================
# ** Kingdom Hearts II HUD
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-09-17
#------------------------------------------------------------------------------
# * Description:
#
#   This script was designed to remake the arc gradient bar HUD from Kingdom
#   Hearts 2. It shows the HP and SP values, with a custom feature that
#   will make the face change when hp drops, hp rises, your actor
#   dies, or life falls below 25% health.
#
#   All HUD dimensions are customizable, although I did make a basic setup
#   nearly perfectly matching the Kingdom Hearts 2 HUD. You may also toggle
#   the visibility when a switch is on or off.
#------------------------------------------------------------------------------
# * Instructions:
#
#   Place the script below the SDK (if included) and above main.
#
#   Change the constant in Kingdom_Hearts_2_HUD module.
#------------------------------------------------------------------------------
# * Requirements:
#
#   Method and Class Library 2.3+
#------------------------------------------------------------------------------
# * Terms & Conditions:
#
#   Copyright (C) 2007 SephirothSpawn (Timothy Hoffman)
#   Free for non-commercial use.
#   40 USD commercial license. Contact via. SephirothSpawn@hotmail.com
#
#   Any modifications to the system are not to be re-distributed without my
#   consent.
#==============================================================================

#==============================================================================
# ** SDK Log
#==============================================================================

if Object.const_defined?(:SDK)
  SDK.log('Kingdom Hearts II HUD', 'SephirothSpawn', 1.0, '2008-09-17')
end

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if Object.const_defined?(:SDK) == false || SDK.enabled?('Kingdom Hearts II HUD')
  
#==============================================================================
# ** Kingdom_Hearts_2_HUD
#==============================================================================

module Kingdom_Hearts_2_HUD
  #--------------------------------------------------------------------------
  # * Faces Directory
  #--------------------------------------------------------------------------
  Face_Folder = 'Graphics/HUD Faces/'
  #--------------------------------------------------------------------------
  # * Background & Cover Images
  #
  #   The background image will be displayed below everything
  #   The cover image will be drawn over everything
  #   Draw Background will draw pixel borders are gradient bars
  #   Draw SP Background will draw pixel borders are sp bar
  #--------------------------------------------------------------------------
  Background_Image    = nil
  Cover_Image         = nil
  Draw_Background     = true
  Draw_SP_Background  = true
  #--------------------------------------------------------------------------
  # * Faces Size: Rect.new(0, 0, width, height)
  #--------------------------------------------------------------------------
  Main_Face_Rect = Rect.new(525, 369, 86, 86)
  Sub_Face_Rect  = Rect.new(573, 307, 46, 46)
  #--------------------------------------------------------------------------
  # * Main HUD Preferences
  #--------------------------------------------------------------------------
  Main_Center_X         = 568
  Main_Center_Y         = 412
  Main_HP_Min_Radius    = 36
  Main_HP_Max_Radius    = 50
  Main_HP_Border_Width  = 2
  Main_HP_Tail_Length   = 172
  Main_HP_Color         = Color.new(188, 243, 62)
  Main_HP_Color2        = Color.new(53, 215, 18)
  Main_SP_Length        = 150
  Main_SP_Height        = Draw_Background ? 8 : Draw_SP_Background ? 12 : 8
  Main_SP_Border_Width  = 2
  Main_SP_Overlap       = 6
  Main_SP_Color         = Color.new(9, 141, 255)
  Main_SP_Color2        = Color.new(8, 101, 222)
  Main_HP_Background    = Color.new(50, 50, 50)
  Main_SP_Backgorund    = Color.new(25, 25, 25)
  #--------------------------------------------------------------------------
  # * Sub HUD Dimensions
  #--------------------------------------------------------------------------
  Sub_Center_X          = 596
  Sub_Center_Y          = 332
  Sub_Center_Diff       = 56
  Sub_Min_Radius        = 20
  Sub_Max_Radius        = 26
  Sub_Border_Width      = 2
  Sub_HP_Color          = Main_HP_Color
  Sub_HP_Color2         = Main_HP_Color2
  Sub_SP_Color          = Main_SP_Color
  Sub_SP_Color2         = Main_SP_Color2
  Sub_Background_Color  = Color.new(50, 50, 50)
  #--------------------------------------------------------------------------
  # * Visibility Switch
  #--------------------------------------------------------------------------
  Switch_ID = 1
  #--------------------------------------------------------------------------
  # * Faces
  #--------------------------------------------------------------------------
  Enable_Complex_Faces = true
  Complex_Face_Change = 20
  Complex_Faces = {
    'hp_down' => '_hp_down',
    'hp_up'   => '_hp_up',
    'crisis'  => '_crisis',
    'dead'    => '_dead',
  }
  #--------------------------------------------------------------------------
  # * Load Face
  #--------------------------------------------------------------------------
  def self.face(actor)
    begin
      return RPG::Cache.load_bitmap(Face_Folder, 
        actor.kh_face, actor.character_hue)
    rescue
      return RPG::Cache.load_bitmap(Face_Folder, 
        actor.kh_face_base, actor.character_hue)
    end
  end
  #--------------------------------------------------------------------------
  # * Background
  #--------------------------------------------------------------------------
  def self.background
    return RPG::Cache.load_bitmap(Face_Folder, Background_Image)
  end
  #--------------------------------------------------------------------------
  # * Cover
  #--------------------------------------------------------------------------
  def self.cover
    return RPG::Cache.load_bitmap(Face_Folder, Cover_Image)
  end
end

#==============================================================================
# ** Game_Actor
#==============================================================================

class Game_Actor
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :kh_face_suffix
  #--------------------------------------------------------------------------
  # * Kingdom Hearts Face Base
  #--------------------------------------------------------------------------
  def kh_face_base
    return character_name
  end
  #--------------------------------------------------------------------------
  # * Kingdom Hearts Face
  #--------------------------------------------------------------------------
  def kh_face
    begin
      return "#{kh_face_base}#{kh_face_suffix.nil? ? '' : kh_face_suffix}"
    rescue
      return kh_face_base
    end
  end
end

#==============================================================================
# ** Kingdom_Hearts_2_HUD::Window_HUD
#==============================================================================

class Kingdom_Hearts_2_HUD::Window_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Include Constants
  #--------------------------------------------------------------------------
  include Kingdom_Hearts_2_HUD
  #--------------------------------------------------------------------------
  # * Math Calculations
  #--------------------------------------------------------------------------
  c  = Main_HP_Min_Radius + (Main_HP_Max_Radius - Main_HP_Min_Radius) / 2
  c *= 2 * Math::PI * 4 / 3
  HP_Arc_Percent = c / (c + Main_HP_Tail_Length)
  HP_Arc_Color = Color.color_between(Main_HP_Color, Main_HP_Color2, 
    HP_Arc_Percent)
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(-16, -16, 672, 512)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    # If background exist
    if Background_Image != nil
      # Draw background
      b = Kingdom_Hearts_2_HUD.background
      self.contents.blt(0, 0, b, b.rect)
    end
    # Set empty actors
    @actors = []
    # Save face changes
    @face_suffix, @face_time = [], []
    # Update
    update
    # If cover exist
    if Cover_Image != nil
      # Draw Cover
      b = Kingdom_Hearts_2_HUD.cover
      self.contents.blt(0, 0, b, b.rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # Update visibility
    self.visible = $game_switches[Switch_ID]
    # Stop if not visible
    return unless self.visible
    # If no actors
    if $game_party.actors.size == 0
      # Clear window and return
      self.contents.clear
      return
    end
    # Update face suffix
    for i in 0...[@actors.size, $game_party.actors.size].max
      update_face_suffix(i)
    end
    
    
    
    # If main actor has changed
    if actor_changed?($game_party.actors[0], @actors[0])
      # Save actor
      @actors[0] = $game_party.actors[0].dup
      # Clear main
      clear_main
      # Draw main HP Background
      draw_main_background if Draw_Background
      # Draw main HP Bar
      draw_main_hp_bar
      # Draw main face
      draw_main_face
      # Draw main SP bar
      draw_main_sp_bar
    end
    # Pass through sub actors
    for i in 1...[@actors.size, $game_party.actors.size].max
      # If nil actor
      if $game_party.actors[i] == nil
        # Set nil actor
        @actors[i] = nil
        # Clear area and skip to next
        clear_sub(i)
        next
      end
      # If sub actor has changed
      if actor_changed?($game_party.actors[i], @actors[i])
        # Save actor
        @actors[i] = $game_party.actors[i].dup
        # Clear sub area
        clear_sub(i)
        # Draw sub background
        draw_sub_background(i) if Draw_Background
        # Draw sub HP bar
        draw_sub_hp_bar(i)
        # Draw sub SP bar
        draw_sub_sp_bar(i)
        # Draw sub face
        draw_sub_face(i)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Update Face Suffix
  #--------------------------------------------------------------------------
  def update_face_suffix(i)
    # Return if not complex faces
    return unless Enable_Complex_Faces
    # Get new and old actor
    new_actor, old_actor = $game_party.actors[i], @actors[i]
    # If id is different
    if new_actor.id != old_actor.id
      # Clear both suffixes
      new_actor.kh_face_suffix = '' unless new_actor == nil
      old_actor.kh_face_suffix = '' unless old_actor == nil
      # Clear time and suffix
      @face_suffix[i] = nil
      @face_time[i] = nil
      return
    end
    # If dead
    if new_actor.dead?
      suffix = Complex_Faces['dead']
    # If less life
    elsif new_actor.hp < old_actor.hp
      suffix = Complex_Faces['hp_down']
    # If more life
    elsif new_actor.hp > old_actor.hp
      suffix = Complex_Faces['hp_up']
    # If crisis
    elsif new_actor.hp <= new_actor.maxhp / 4 && new_actor.kh_face_suffix == ''
      suffix = Complex_Faces['crisis']
    else
      suffix = ''
    end
    # If suffix exist
    if suffix != ''
      # Change suffix
      new_actor.kh_face_suffix = suffix
      @face_suffix[i] = suffix
      @face_time[i] = Complex_Face_Change
      return
    end
    # Return if no face suffix
    if @face_time[i] == nil
      @face_suffix[i] = nil
      return
    end
    # If time is greater than 0
    if @face_time[i] > 0
      # Subtract time
      @face_time[i] -= 1
      return
    end
    # Return if suffix is dead or crisis
    return if [Complex_Faces['crisis'], 
      Complex_Faces['dead']].include?(new_actor.kh_face_suffix)
    # Clear suffix
    new_actor.kh_face_suffix = ''
    @face_suffix[i] = nil
    @face_time[i] = nil
  end
  #--------------------------------------------------------------------------
  # * Clear Main
  #--------------------------------------------------------------------------
  def clear_main
    # Get rect
    rx = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    ry = Main_Center_Y - Main_HP_Max_Radius - Main_HP_Border_Width
    rw = Main_Center_X + Main_HP_Max_Radius + Main_HP_Border_Width - rx
    rh = Main_HP_Max_Radius * 2 + Main_HP_Border_Width * 2
    rect = Rect.new(rx, ry, rw, rh)
    # Clear area
    self.contents.fill_rect(rect, Color.clear)
    # Draw background
    if Background_Image != nil
      # Draw background
      b = Kingdom_Hearts_2_HUD.background
      self.contents.blt(rx, ry, b, rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Background
  #--------------------------------------------------------------------------
  def draw_main_background
    # Draw arc region
    self.contents.draw_cw_arc_region(Main_Center_X, Main_Center_Y, 
      Main_HP_Min_Radius - Main_HP_Border_Width, Main_HP_Max_Radius + 
      Main_HP_Border_Width, 180, 270, 1, 1, Main_HP_Background)
    # Draws corner border
    ox = Main_Center_X - Main_HP_Max_Radius - Main_HP_Border_Width
    oy = Main_Center_Y
    ow = (Main_HP_Max_Radius - Main_HP_Min_Radius) + Main_HP_Border_Width * 2
    oh = Main_HP_Border_Width
    self.contents.fill_rect(ox, oy, ow, oh, Main_HP_Background)
    # Get HP tail dimensions
    ox = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    oy = Main_Center_Y + Main_HP_Min_Radius - Main_HP_Border_Width
    ow = Main_HP_Tail_Length + Main_HP_Border_Width
    oh = Main_HP_Max_Radius - Main_HP_Min_Radius + Main_HP_Border_Width * 2
    # Draw bar
    self.contents.fill_rect(ox, oy, ow, oh, Main_HP_Background)
  end
  #--------------------------------------------------------------------------
  # * Draw Main HP
  #--------------------------------------------------------------------------
  def draw_main_hp_bar
    # Get current and max values
    cur, max = @actors[0].hp, @actors[0].maxhp
    # Adjust for arc region
    max = Integer(max * HP_Arc_Percent)
    cur = [max, cur].min
    # Gets center and radi
    cx, cy = Main_Center_X, Main_Center_Y
    mnr, mxr = Main_HP_Min_Radius, Main_HP_Max_Radius
    # Draw Arc Region
    if Main_HP_Color2 == nil
      self.contents.draw_cw_arc_region(cx, cy, mnr, mxr, 180, 270, cur, max, 
        Main_HP_Color)
    else
      self.contents.draw_cw_grad_arc_region(cx, cy, mnr, mxr, 180, 270, cur, 
        max, Main_HP_Color, HP_Arc_Color)
    end
    # Gets max subtraction
    max_sub = Integer(@actors[0].maxhp * HP_Arc_Percent)
    # Get new cur & max
    cur, max = @actors[0].hp, @actors[0].maxhp
    cur -= max_sub ; max -= max_sub
    # Return if cur < 0
    return unless cur > 0
    # Get HP tail dimensions
    ox = Main_Center_X - Main_HP_Tail_Length
    oy = Main_Center_Y + Main_HP_Min_Radius
    ow = Main_HP_Tail_Length
    oh = Main_HP_Max_Radius - Main_HP_Min_Radius
    # Draw reverse bar
    if Main_HP_Color2 == nil
      self.contents.draw_rev_bar(ox, oy, ow, oh, cur, max, Main_HP_Color)
    else
      self.contents.draw_rev_grad_bar(ox, oy - 1, ow, oh + 2, cur, max, 
        HP_Arc_Color, Main_HP_Color2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Main SP
  #--------------------------------------------------------------------------
  def draw_main_sp_bar
    # If draw background
    if Draw_Background
      # Get SP tail dimensions
      ox = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
      oy = Main_Center_Y + Main_HP_Min_Radius - Main_HP_Border_Width
      oy -= Main_SP_Height - Main_SP_Overlap
      ow = Main_SP_Length + Main_SP_Border_Width * 2
      oh = Main_SP_Height + Main_SP_Border_Width * 2
      # Draw border
      self.contents.fill_rect(ox, oy, ow, oh, Main_SP_Backgorund)
      # Get gradient dimensions
      ox += Main_SP_Border_Width
      oy += Main_SP_Border_Width
      # Draw reverse bar
      if Main_SP_Color2 == nil
        self.contents.draw_rev_bar(ox, oy, Main_SP_Length, Main_SP_Height, 
          @actors[0].sp, @actors[0].maxsp, Main_SP_Color)
      else
        self.contents.draw_rev_grad_bar(ox, oy, Main_SP_Length, Main_SP_Height, 
          @actors[0].sp, @actors[0].maxsp, Main_SP_Color, Main_SP_Color2)
      end
    # If draw sp background
    elsif Draw_SP_Background
      # Get SP tail dimensions
      ox = Main_Center_X - Main_HP_Tail_Length
      oy = Main_Center_Y + Main_HP_Min_Radius - Main_SP_Height + Main_SP_Overlap
      ow = Main_SP_Length
      oh = Main_SP_Height
      # Draw border
      self.contents.fill_rect(ox, oy, ow, oh, Main_SP_Backgorund)
      # Offset border
      ox += Main_SP_Border_Width ; oy += Main_SP_Border_Width
      ow -= Main_SP_Border_Width * 2; oh -= Main_SP_Border_Width * 2
      # Draw reverse bar
      if Main_SP_Color2 == nil
        self.contents.draw_rev_bar(ox, oy, ow, oh, 
          @actors[0].sp, @actors[0].maxsp, Main_SP_Color)
      else
        self.contents.draw_rev_grad_bar(ox, oy, ow, oh, 
          @actors[0].sp, @actors[0].maxsp, Main_SP_Color, Main_SP_Color2)
      end
    else
      # Get SP tail dimensions
      ox = Main_Center_X - Main_HP_Tail_Length
      oy = Main_Center_Y + Main_HP_Min_Radius - Main_SP_Height + Main_SP_Overlap
      # Draw reverse bar
      if Main_SP_Color2 == nil
        self.contents.draw_rev_bar(ox, oy, Main_HP_Tail_Length, Main_SP_Height, 
          @actors[0].sp, @actors[0].maxsp, Main_SP_Color)
      else
        self.contents.draw_rev_grad_bar(ox, oy, Main_HP_Tail_Length, 
          Main_SP_Height, @actors[0].sp, @actors[0].maxsp, Main_SP_Color, 
          Main_SP_Color2)
      end
    end
    # Get rect
    rx = Main_Center_X - Main_HP_Tail_Length - Main_HP_Border_Width
    ry = Main_Center_Y - Main_HP_Max_Radius - Main_HP_Border_Width
    rw = Main_Center_X + Main_HP_Max_Radius + Main_HP_Border_Width - rx
    rh = Main_HP_Max_Radius * 2 + Main_HP_Border_Width * 2
    rect = Rect.new(rx, ry, rw, rh)
    # Draw Cover
    if Cover_Image != nil
      # Draw cover
      b = Kingdom_Hearts_2_HUD.cover
      self.contents.blt(rx, ry, b, rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Main Face
  #--------------------------------------------------------------------------
  def draw_main_face
    # Gets bitmap
    bitmap = Kingdom_Hearts_2_HUD.face(@actors[0])
    # Draws face
    self.contents.stretch_blt(Main_Face_Rect, bitmap, bitmap.rect)
  end
  #--------------------------------------------------------------------------
  # * Sub Center Y
  #--------------------------------------------------------------------------
  def sub_center_y(i)
    y = Sub_Center_Y
    y -= Sub_Center_Diff * (i - 1)
  end
  #--------------------------------------------------------------------------
  # * Clear Sub
  #--------------------------------------------------------------------------
  def clear_sub(i)
    # Get rect
    rx = Sub_Center_X - Sub_Max_Radius - Sub_Border_Width
    ry = sub_center_y(i) - Sub_Max_Radius - Sub_Border_Width
    rw = rh = Sub_Max_Radius * 2 + Sub_Border_Width + 2
    rect = Rect.new(rx, ry, rw, rh)
    # Clear area
    self.contents.fill_rect(rect, Color.clear)
    # Draw background
    if Background_Image != nil
      # Draw background
      b = Kingdom_Hearts_2_HUD.background
      self.contents.blt(rx, ry, b, rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Sub Background
  #--------------------------------------------------------------------------
  def draw_sub_background(i)
    # Gets center
    cx, cy = Sub_Center_X, sub_center_y(i)
    # Draw outer circle
    self.contents.draw_circle(cx, cy, Sub_Max_Radius + Sub_Border_Width, 
      Sub_Background_Color)
    # Clear inner circle
    self.contents.draw_circle(cx, cy, Sub_Min_Radius - Sub_Border_Width, 
      Color.clear)
  end
  #--------------------------------------------------------------------------
  # * Draw Sub HP Bar
  #--------------------------------------------------------------------------
  def draw_sub_hp_bar(i)
    # Get actor
    a = @actors[i]
    # Gets center
    cx, cy = Sub_Center_X, sub_center_y(i)
    # Draw arc region
    if Sub_HP_Color2 == nil
      self.contents.draw_cw_arc_region(cx, cy, Sub_Min_Radius, Sub_Max_Radius,
        268, 92, a.hp, a.maxhp, Sub_HP_Color)
    else
      self.contents.draw_cw_grad_arc_region(cx, cy, Sub_Min_Radius, 
        Sub_Max_Radius, 268, 92, a.hp, a.maxhp, Sub_HP_Color, Sub_HP_Color2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Sub SP Bar
  #--------------------------------------------------------------------------
  def draw_sub_sp_bar(i)
    # Get actor
    a = @actors[i]
    # Gets center
    cx, cy = Sub_Center_X, sub_center_y(i)
    # Draw arc region
    if Sub_SP_Color2
      self.contents.draw_ccw_arc_region(cx, cy, Sub_Min_Radius, Sub_Max_Radius,
        272, 88, a.sp, a.maxsp, Sub_SP_Color)
    else
      self.contents.draw_ccw_grad_arc_region(cx, cy, Sub_Min_Radius, 
        Sub_Max_Radius, 272, 88, a.sp, a.maxsp, Sub_SP_Color, Sub_SP_Color2)
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Sub Face
  #--------------------------------------------------------------------------
  def draw_sub_face(i)
    # Gets dest rect
    dx = Sub_Face_Rect.x
    dy = Sub_Face_Rect.y - Sub_Center_Diff * (i - 1)
    dest_rect = Rect.new(dx, dy, Sub_Face_Rect.width, Sub_Face_Rect.height)
    # Gets bitmap
    bitmap = Kingdom_Hearts_2_HUD.face(@actors[i])
    # Draws face
    self.contents.stretch_blt(dest_rect, bitmap, bitmap.rect)
    # Get rect
    rx = Sub_Center_X - Sub_Max_Radius - Sub_Border_Width
    ry = sub_center_y(i) - Sub_Max_Radius - Sub_Border_Width
    rw = rh = Sub_Max_Radius * 2 + Sub_Border_Width + 2
    rect = Rect.new(rx, ry, rw, rh)
    # Draw cover
    if Cover_Image != nil
      # Draw cover
      b = Kingdom_Hearts_2_HUD.cover
      self.contents.blt(rx, ry, b, rect)
    end
  end
  #--------------------------------------------------------------------------
  # * Actor Changed?
  #--------------------------------------------------------------------------
  def actor_changed?(a1, a2)
    return true unless a2.is_a?(Game_Actor)
    return a1.hp != a2.hp || a1.maxhp != a2.maxhp ||
           a1.sp != a2.sp || a1.maxsp != a2.maxsp ||
           a1.kh_face != a2.kh_face ||
           a1.character_hue != a2.character_hue
  end
end

#==============================================================================
# ** Scene_Map
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Window
  #--------------------------------------------------------------------------
  if Object.const_defined?(:SDK)
    alias_method :seph_kh2hud_mw, :main_window
    def main_window
      seph_kh2hud_mw
      @hud = Kingdom_Hearts_2_HUD::Window_HUD.new
    end
  else
    alias_method :seph_kh2hud_m, :main
    def main
      seph_kh2hud_m
      @hud = Kingdom_Hearts_2_HUD::Window_HUD.new
    end
  end
end

#==============================================================================
# ** Bitmap
#==============================================================================

class Bitmap
  #--------------------------------------------------------------------------
  # * Draw Clockwise Circular Arc Region
  #--------------------------------------------------------------------------
  def draw_cw_arc_region(x, y, min_rad, max_rad, s_angle, e_angle, 
                         cur_v, max_v, color = Color.red)
    # Calculate Inner Regions
    inner_region = {}
    for i in 0..min_rad
      y_ = Integer((min_rad ** 2 - i ** 2) ** 0.5)
      inner_region[x + i] = y_
      inner_region[x - i] = y_
    end
    # Make Degrees between 0 - 360
    s_angle %= 360 ; e_angle %= 360
    # Make s_angle Greater than e_angle
    s_angle += 360 if  s_angle < e_angle
    # Calculate Difference
    diff = s_angle - e_angle
    # Get Percent Difference
    p_diff = Integer(diff * cur_v / max_v.to_f)
    # Modify e_angle with percent Diffence
    e_angle = s_angle - p_diff
    # Pass from left to right
    for i in (x - max_rad)..(x + max_rad)
      # Get Y max at that pixel
      y_max = Integer((max_rad ** 2 - (x - i).abs ** 2) ** 0.5)
      # Pass from top to bottom
      for j in (y - y_max)..(y + y_max)
        # If Inner region has key
        if inner_region.has_key?(i)
          # Get Inner Value
          inner = inner_region[i]
          # Skip if Between inner region limits
          next if j.between?(y - inner, y + inner)
        end
        # Gets Angle of pixel from center
        a = Math.atan2((j - y).abs, (i - x).abs.to_f) * 180 / Math::PI
        # Get 360 Degree Angle
        if (i - x) > 0
          a = 360 - a if (j - y) > 0
        else
          a = 180 + ((j - y) > 0 ? a : -a)
        end
        # Set Pixel if Between Angles
        if Math.cw_between_angles?(a, s_angle, e_angle)
          set_pixel(i, j, color)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Counter-Clockwise Circular Arc Region
  #--------------------------------------------------------------------------
  def draw_ccw_arc_region(x, y, min_rad, max_rad, s_angle, e_angle, 
                          cur_v, max_v, color = Color.red)
    # Make Degrees between 0 - 360
    s_angle %= 360 ; e_angle %= 360
    # Make e_angle Greater than s_angle
    e_angle += 360 if e_angle < s_angle
    # Calculate Difference
    diff = e_angle - s_angle
    # Get Percent Difference
    p_diff = Integer(diff * cur_v / max_v.to_f)
    # Modify e_angle with percent Diffence
    e_angle = s_angle + p_diff
    # Draw CW Arc Region
    draw_cw_arc_region(x, y, min_rad, max_rad, e_angle, s_angle, 1, 1, color)
  end
  #--------------------------------------------------------------------------
  # * Draw Clockwise Gradient Circular Arc Region
  #--------------------------------------------------------------------------
  def draw_cw_grad_arc_region(x, y, min_rad, max_rad, s_angle, e_angle, 
                              cur_v, max_v, s_color = Color.red, 
                              e_color = Color.blue)
    # Calculate Inner Regions
    inner_region = {}
    for i in 0..min_rad
      y_ = Integer((min_rad ** 2 - i ** 2) ** 0.5)
      inner_region[x + i] = y_
      inner_region[x - i] = y_
    end
    # Make Degrees between 0 - 360
    s_angle %= 360 ; e_angle %= 360
    # Make s_angle Greater than e_angle
    s_angle += 360 if  s_angle < e_angle
    # Calculate Difference
    diff = s_angle - e_angle
    # Get Percent Difference
    p_diff = Integer(diff * cur_v / max_v.to_f)
    # Modify e_angle with percent Diffence
    e_angle = s_angle - p_diff
    # Pass from left to right
    for i in (x - max_rad)..(x + max_rad)
      # Get Y max at that pixel
      y_max = Integer((max_rad ** 2 - (x - i).abs ** 2) ** 0.5)
      # Pass from top to bottom
      for j in (y - y_max)..(y + y_max)
        # If Inner region has key
        if inner_region.has_key?(i)
          # Get Inner Value
          inner = inner_region[i]
          # Skip if Between inner region limits
          next if j.between?(y - inner, y + inner)
        end
        # Gets Angle of pixel from center
        a = Math.atan2((j - y).abs, (i - x).abs.to_f) * 180 / Math::PI
        # Get 360 Degree Angle
        if (i - x) > 0
          a = 360 - a if (j - y) > 0
        else
          a = 180 + ((j - y) > 0 ? a : -a)
        end
        # If Between Angles
        if Math.cw_between_angles?(a, s_angle, e_angle)
          # Get Color Value
          per = Math.cw_percent_between_angles(a, s_angle, s_angle - diff)
          color = Color.color_between(e_color, s_color, per)
          # Set Pixel
          set_pixel(i, j, color)
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Counter-Clockwise Gradient Circular Arc Region
  #--------------------------------------------------------------------------
  def draw_ccw_grad_arc_region(x, y, min_rad, max_rad, s_angle, e_angle, 
                               cur_v, max_v, s_color = Color.red, 
                               e_color = Color.blue)
    # Make Degrees between 0 - 360
    s_angle %= 360 ; e_angle %= 360
    # Make e_angle Greater than s_angle
    e_angle += 360 if e_angle < s_angle
    # Calculate Difference
    diff = e_angle - s_angle
    # Get Percent Difference
    p_diff = Integer(diff * cur_v / max_v.to_f)
    # Modify e_angle with percent Diffence
    e_angle2 = s_angle + p_diff
    # Modify colors
    per = Math.ccw_percent_between_angles(e_angle2, s_angle, e_angle)
    sc = Color.color_between(s_color, e_color, per)
    ec = s_color
    # Draw CW Grad Arc Region
    draw_cw_grad_arc_region(x, y, min_rad, max_rad, e_angle2, s_angle, 1, 1, 
      sc, ec)
  end  
  #--------------------------------------------------------------------------
  # * Draw Reverse Bar
  #--------------------------------------------------------------------------
  def draw_rev_bar(x, y, width, height, cur, max, color = Color.red)
    bar_width = Integer((cur / max.to_f) * width)
    self.fill_rect(x + width - bar_width, y, bar_width, height, color)
  end
  #--------------------------------------------------------------------------
  # * Draw Reverse Gradient Bar
  #--------------------------------------------------------------------------
  def draw_rev_grad_bar(x, y, width, height, cur, max, s_color = Color.red, 
                               e_color = Color.blue)
    for i in 0...((cur / max.to_f) * width)
      c = Color.color_between(s_color, e_color, (i / width.to_f))
      self.fill_rect(x + width - 1 - i, y + 1, 1, height - 2, c)
    end
  end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

Instructions

See script heading

Compatibility

Should be compatible with anything. It doesn't require the SDK.

Terms and Conditions

Copyright © 2007 SephirothSpawn (Timothy Hoffman)
Free for non-commercial use.
40 USD commercial license. Contact via. SephirothSpawn@hotmail.com

Any modifications to the system are not to be re-distributed without my consent.

Author's Notes

You may customize and of the constants, just be sure you know what you are doing.

Enjoy!
 
:eek: Pretty awesome that you decided to do this Seph! I dunno if I'll personally use it but I know a ton of people have been wanting this for a long ass time.
Though I can't seem to get any of your screens, the script, or the demo to load =/
 
The Panda":3ra7qfhp said:
:eek: Pretty awesome that you decided to do this Seph! I dunno if I'll personally use it but I know a ton of people have been wanting this for a long ass time.
Though I can't seem to get any of your screens, the script, or the demo to load =/


Same here. the links used to lead me to a wikipedia article about HTTP, but now it doesn't.
 
Thanks Seph Thats Going Great

One Question Does the health bar grow when your hP is Upgraded?



Problem? = When i start my game with the script with all the dependencies the images on the screen flicker
 
Just tried it and it's pretty awesome Seph ^_^
Now all's we need is for someone to make an ABS with that little window thingy in the corner and we might just get all them KH fans around here to asplode with happiness(and then we won't have to deal with the constant crappy fan games! Cuz..ya know..they'd be all asploded and such >.>)
 
Auto-start what?

I really only did this to challenge some math abilities. My girlfriend brought over her calculus homework, a class I took like 6-7 years ago, and I had to refresh the chapter. I felt like saying "when they start putting letters in it?"

Well, I did have an old KH battle system actually. It's not that hard to make really. I might just pull it and put it out with this thing.
 
SephirothSpawn":2p8yy59v said:
Well, I did have an old KH battle system actually. It's not that hard to make really. I might just pull it and put it out with this thing.

Please do, Seph; if only to stop the excessive requests for one. :x
 
Atemu":2q52kfhj said:
SephirothSpawn":2q52kfhj said:
Well, I did have an old KH battle system actually. It's not that hard to make really. I might just pull it and put it out with this thing.

Please do, Seph; if only to stop the excessive requests for one. :x
Yes Please
 
Lol either way there is a bit of an error. Well its not really an error but if the main actor dies then he just disappears and well the others are left in oblivion out of nowhere.

But I would be curious to see that battle system as well as it could help stop the requests.

What else?

Is there a way to get rid of the HP down text?

I haven't read the script yet. So sue me or whatever. I'm tired its late. I'm posting this.

Blah.

good work nonetheless. :thumb:

EDIT: Nevermind. I see it now. My bad. Read the script. Blah.

But why does this have the SDk and check for it if its not required?  :huh:
 
Yeah but that really has nothing to do with the script.

Tomorrow I will dig up the old ABS, clean it up and stuff and post it. It'll be worth a few laughs. In the ABS it will fix the disappearing actor (or go to gameover, the user decides). The HP down text is just an image actually. You can disable all the images. I guess when I add the customizable tail lengths, I'll add something where you can turn off the optional image chances.

Oh yeah. Kingdom Hearts Starter Kit. :p
 
Lol yeah I noticed that they were images after I looked at the script. :D

My mistake.

But yeah that sounds interesting. I want to see it.

Because an ABS is an ABS. Be it Mo's, Behemoths, Prexus, yours, etc.

But you're going to release it as a joke eh?

Nothing serious. :[

I'm an ABS fanatic sorry.
 
It doesn't require the SDK. I am working with my scripts now to not require SDK as much. More work for me, but then I don't have to hear people whine so much. I actually think this does require the SDK, because I never update or dispose the HUD. I'll have to fix that too tomorrow.

Well it will be a joke because I am not re-doing an entire ABS I modified 2+ years ago. It was actually just a MOD of Near's SBABS and I added the Kingdom Hearts command window and a few other things. So you'll be seeing a script from 2 years, beefed up. I will probably improve the system to be totally 40% more functional, but I just don't have the time to go in-depth.

I have a serious ABS, but it is my baby. This community is not even ready for it yet. ;)
 
SephirothSpawn":wojjnu3i said:
I have a serious ABS, but it is my baby. This community is not even ready for it yet. ;)

Dammit. :( but at least ummm animations?

Maybe not.

Beggars can't be choosers. We'll see how this goes!

:thumb:
 
Yep. I had to de-rail, to make a adv. movement system, for shits and giggles, that also adds the dash/sneak bars to this HUD. This both are un-official releases. I will post both tomorrow.

Code:
#==============================================================================
# ** Advance Movement System
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 2
# 2008-09-18
#------------------------------------------------------------------------------
# Version History:
#
#  Version 1.0 ------------------------------------------------- (2006-04-24)
#  Version 2.0 ------------------------------------------------- (2008-09-18)
#   - Update: Updated entire system
#==============================================================================

#==============================================================================
# ** Advanced_Movement_System
#==============================================================================

module Advanced_Movement_System
  #--------------------------------------------------------------------------
  # * Keyboard Input Keys
  #--------------------------------------------------------------------------
  Button_Sneak = Keyboard::Letters['F']
  Button_Dash  = Keyboard::Letters['G']
  Button_Jump  = Keyboard::Letters['H']
  #--------------------------------------------------------------------------
  # * Speeds
  #--------------------------------------------------------------------------
  Speed_Sneak = 3
  Speed_Walk  = 4
  Speed_Dash  = 5
  #--------------------------------------------------------------------------
  # * Jump Distances
  #--------------------------------------------------------------------------
  Jump_Distance_Sneaking = 2
  Jump_Distance_Walking  = 2
  Jump_Distance_Dashing  = 3
  #--------------------------------------------------------------------------
  # * Count, Cost & Recover
  #
  #   Count:   Number of frame points for action (nil for unlimited)
  #   Recover: Number of frames to restore count point
  #--------------------------------------------------------------------------
  Count_Sneak   = 200
  Count_Dash    = 200
  Recover_Sneak = 10
  Recover_Dash  = 10
  #--------------------------------------------------------------------------
  # * Animation Suffix
  #
  #   Base + iso + jump + sneak/dash
  #--------------------------------------------------------------------------
  Animation_Suffix_Sneak  = '_sneak'
  Animation_Suffix_Dash   = '_dash'
  Animation_Suffix_Jump   = '_jump'
  Animation_Suffix_Iso    = '_iso'
  Animation_Suffix_Stand  = '_stand'
  #--------------------------------------------------------------------------
  # * Default Enable Settings
  #--------------------------------------------------------------------------
  Enable_Sneak      = true
  Enable_Dash       = true
  Enable_Jump       = true
  Enable_Isometric  = true
  Enable_Anim_Sneak = false
  Enable_Anim_Dash  = false
  Enable_Anim_Jump  = false
  Enable_Anim_Iso   = false
  Enable_Anim_Stand = false
end

#==============================================================================
# ** Game_Player
#==============================================================================

class Game_Player
  #--------------------------------------------------------------------------
  # * Include Advanced Movement System
  #--------------------------------------------------------------------------
  include Advanced_Movement_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :sneak_count
  attr_reader   :dash_count
  attr_accessor :sneak_count_bonus
  attr_accessor :dash_count_bonus
  attr_accessor :enable_sneaking
  attr_accessor :enable_dashing
  attr_accessor :enable_jumping
  attr_accessor :enable_isometric
  attr_accessor :enable_sneaking_animation
  attr_accessor :enable_dashing_animation
  attr_accessor :enable_jumping_animation
  attr_accessor :enable_isometric_animation
  attr_accessor :enable_standing_animation
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_advplyrmvt_gmplyr_init,      :initialize
  alias_method :seph_advplyrmvt_gmplyr_update,    :update
  alias_method :seph_advplyrmvt_gmplyr_cn,        :character_name
  alias_method :seph_advplyrmvt_gmplyr_mrand,     :move_random
  alias_method :seph_advplyrmvt_gmplyr_mf,        :move_forward
  alias_method :seph_advplyrmvt_gmplyr_mb,        :move_backward
  alias_method :seph_advplyrmvt_gmplyr_cett,      :check_event_trigger_there
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    # Original Initialization
    seph_advplyrmvt_gmplyr_init
    # Enable settings
    @enable_sneaking  = Enable_Sneak
    @enable_dashing   = Enable_Dash
    @enable_jumping   = Enable_Jump
    @enable_isometric = Enable_Isometric
    # Enable animations
    @enable_sneaking_animation  = Enable_Anim_Sneak
    @enable_dashing_animation   = Enable_Anim_Dash
    @enable_jumping_animation   = Enable_Anim_Jump
    @enable_isometric_animation = Enable_Anim_Iso
    @enable_standing_animation  = Enable_Anim_Stand
    # Sneak & dash bonuses
    @sneak_count_bonus, @dash_count_bonus = 0, 0
    # Sets sneak and dash count
    @sneak_count = max_sneak_count
    @dash_count  = max_dash_count
    # Sneaking & Dashing
    @sneaking, @dashing = false, false
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update sneak if sneak enabled and not dashing
    update_sneaking if @enable_sneaking && !@dashing
    # Update dash if dash enabled and not sneaking
    update_dashing if @enable_dashing && !@sneaking
    # Update Walking
    update_walking unless @sneaking || @dashing
    # Update jump if jumping enabled
    update_jumping if @enable_jumping
    # Update Isometric movement
    update_isometric_movement unless self.methods.include?('update_player_movement')
    # Update Isometric Movespeed
    update_isometric_movespeed
    # Original Update Player Movement
    seph_advplyrmvt_gmplyr_update
  end
  #--------------------------------------------------------------------------
  # * Character Name
  #--------------------------------------------------------------------------
  def character_name
    # Get Base
    base = seph_advplyrmvt_gmplyr_cn.dup
    # Add Iso if isometric enable
    base += Animation_Suffix_Iso if @enable_isometric_animation
    # Add jump suffix
    base += Animation_Suffix_Jump if jumping? && @enable_jumping_animation
    # Add sneaking suffix
    base += Animation_Suffix_Sneak if sneaking? && @enable_sneaking_animation
    # Add dash suffix
    base += Animation_Suffix_Dash if dashing? && @enable_dashing_animation
    # Add stand animation
    base += Animation_Suffix_Stand if (!moving?) && @enable_standing_animation
    # Return base
    return base
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Sneaking
  #--------------------------------------------------------------------------
  def update_sneaking
    # If sneak button is pressed
    if Keyboard.pressed?(Button_Sneak) && moving?
      # If infinte sneak or positive count
      if Count_Sneak == nil || @sneak_count > 0
        # Decrease sneak count
        @sneak_count -= 1
        # Turn sneaking on
        @sneaking = true
        # Adjust move speed
        @move_speed = Speed_Sneak
        return
      end
    end
    # Turn sneaking off
    @sneaking = false
    # Restore sneak count
    if Graphics.frame_count % Recover_Sneak == 0
      # Increase sneak count
      @sneak_count += 1 if @sneak_count < max_sneak_count
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Dashing
  #--------------------------------------------------------------------------
  def update_dashing
    # If dash button is pressed
    if Keyboard.pressed?(Button_Dash) && moving?
      # If infinte dash or positive count
      if Count_Dash == nil || @dash_count > 0
        # Decrease dash count
        @dash_count -= 1
        # Turn dashing on
        @dashing = true
        # Adjust move speed
        @move_speed = Speed_Dash
        return
      end
    end
    # Turn dashing off
    @dashing = false
    # Restore dash count
    if Graphics.frame_count % Recover_Dash == 0
      # Increase dash count
      @dash_count += 1 if @dash_count < max_dash_count
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Walking
  #--------------------------------------------------------------------------
  def update_walking
    # Reset Move Speed (Walking)
    @move_speed = Speed_Walk
  end
  #--------------------------------------------------------------------------
  # * Frame Update : Jumping
  #--------------------------------------------------------------------------
  def update_jumping
    # If jump button is pressed
    if Input.trigger?(Button_Jump)
      # Gets distance
      dist = @sneaking ? Jump_Distance_Sneaking : @dashing ? 
        Jump_Distance_Dashing : Jump_Distance_Walking
      # Case direciton
      case @direction
      when 2 ; jump(0, dist)
      when 4 ; jump(- dist, 0)
      when 6 ; jump(dist, 0)
      when 8 ; jump(0, - dist)
      when 10 ; jump(- dist, dist)
      when 12 ; jump(dist, dist)
      when 14 ; jump(- dist, - dist)
      when 16 ; jump(dist, - dist)
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Player Movement
  #--------------------------------------------------------------------------
  if method_defined?(:update_player_movement)
    alias_method :seph_advmvtsys_gmply_upm, :update_player_movement
    def update_player_movement
      update_isometric_movement
      seph_advmvtsys_gmply_upm if update_plyrmvttest?
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Isometric Movement
  #--------------------------------------------------------------------------
  def update_isometric_movement
    # If Isometic Enabled
    if @enable_isometric
      # Branch Point By Input
      case Input.dir8
      when 1 ; move_lower_left
      when 3 ; move_lower_right
      when 7 ; move_upper_left
      when 9 ; move_upper_right
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update: Isometric Movement Speed
  #--------------------------------------------------------------------------
  def update_isometric_movespeed
    if moving? && [10, 12, 14, 16].include?(@direction)
      @move_speed *= 1 / Math.sqrt(2)
    end
  end
  #--------------------------------------------------------------------------
  # * Max Sneak Count
  #--------------------------------------------------------------------------
  def max_sneak_count
    return Count_Sneak == nil ? nil : Count_Sneak + @sneak_count_bonus
  end
  #--------------------------------------------------------------------------
  # * Max Dash Count
  #--------------------------------------------------------------------------
  def max_dash_count
    return Count_Dash == nil ? nil : Count_Dash + @dash_count_bonus
  end
  #--------------------------------------------------------------------------
  # * Diagonal Movement Methods
  #--------------------------------------------------------------------------
  d = {'move_lower_left' => 10, 'move_lower_right' => 12, 
       'move_upper_left' => 14, 'move_upper_right' => 14}
  for m in d.keys
    s  = "alias_method :seph_advmvtsys_gmplyr_#{m}, :#{m};"
    s += "def #{m};"
    s += "  seph_advmvtsys_gmplyr_#{m};"
    s += "  @direction = #{d[m]};"
    s += "end"
    eval s
  end
  #--------------------------------------------------------------------------
  # * Move at Random
  #--------------------------------------------------------------------------
  def move_random
    # Isometric movement
    if @enable_isometric
      case rand(8)
      when 0 ; move_lower_left
      when 1 ; move_lower_right
      when 2 ; move_upper_left
      when 3 ; move_upper_right
      end
    end
    # Original random move
    seph_advplyrmvt_gmplyr_mrand
  end
  #--------------------------------------------------------------------------
  # * 1 Step Forward
  #--------------------------------------------------------------------------
  def move_forward
    # Isometric movement
    if @enable_isometric
      case @direction
      when 10 ; move_lower_left
      when 12 ; move_lower_right
      when 14 ; move_upper_left
      when 16 ; move_upper_right
      end
    end
    # Original move forward
    seph_advplyrmvt_gmplyr_mf
  end
  #--------------------------------------------------------------------------
  # * 1 Step Backward
  #--------------------------------------------------------------------------
  def move_backward
    # Remember direction fix situation
    last_direction_fix = @direction_fix
    # Isometric movement
    if @enable_isometric
      case @direction
      when 10 ; move_upper_right
      when 12 ; move_upper_left
      when 14 ; move_lower_right
      when 16 ; move_lower_left
      end
    end
    # Original move backward
    seph_advplyrmvt_gmplyr_mb
    # Return direction fix situation back to normal
    @direction_fix = last_direction_fix
  end
  #--------------------------------------------------------------------------
  # * Front Event Starting Determinant
  #--------------------------------------------------------------------------
  def check_event_trigger_there(triggers)
    # If isometric enables and direction is isometric
    if @enable_isometric && [10, 12, 14, 16].include?(@direction)
      # Check event trigger there isometric
      check_event_trigger_there_iso(triggers)
      return
    end
    # Original check event trigger there
    seph_advplyrmvt_gmplyr_cett(triggers)
  end
  #--------------------------------------------------------------------------
  # * Front Envent Starting Determinant (Isometric)
  #--------------------------------------------------------------------------
  def check_event_trigger_there_iso(triggers)
    result = false
    # If event is running
    return result if $game_system.map_interpreter.running?
    # Get position
    new_x = @x + ([12, 16].include?(@direction) ? 1 : -1)
    new_y = @y + ([10, 12].include?(@direction) ? 1 : -1)
    # All event loops
    for event in $game_map.events.values
      # If event coordinates and triggers are consistent
      if event.x == new_x and event.y == new_y and
         triggers.include?(event.trigger)
        # If starting determinant is front event (other than jumping)
        if not event.jumping? and not event.over_trigger?
          event.start
          result = true
        end
      end
    end
    # If fitting event is not found
    if result == false
      # If front tile is a counter
      if $game_map.counter?(new_x, new_y)
        # Calculate 1 tile inside coordinates
        new_x += ([12, 16].include?(@direction) ? 1 : -1)
        new_y += ([10, 12].include?(@direction) ? 1 : -1)
        # All event loops
        for event in $game_map.events.values
          # If event coordinates and triggers are consistent
          if event.x == new_x and event.y == new_y and
             triggers.include?(event.trigger)
            # If starting determinant is front event (other than jumping)
            if not event.jumping? and not event.over_trigger?
              event.start
              result = true
            end
          end
        end
      end
    end
    return result
  end
  #--------------------------------------------------------------------------
  # * Sneaking?
  #--------------------------------------------------------------------------
  def sneaking?   ; return @sneaking  ; end
  #--------------------------------------------------------------------------
  # * Dashing?
  #--------------------------------------------------------------------------
  def dashing?   ; return @dashing    ; end
end

#==============================================================================
# ** Sprite_Character
#==============================================================================

class Sprite_Character < RPG::Sprite
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    # If tile ID, file name, or hue are different from current ones
    if @tile_id != @character.tile_id or
       @character_name != @character.character_name or
       @character_hue != @character.character_hue
      # Remember tile ID, file name, and hue
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_hue = @character.character_hue
      # If tile ID value is valid
      if @tile_id >= 384
        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
          @tile_id, @character.character_hue)
        self.src_rect.set(0, 0, 32, 32)
        self.ox = 16
        self.oy = 32
      # If tile ID value is invalid
      else
        self.bitmap = RPG::Cache.character(@character.character_name,
          @character.character_hue)
        @cw = bitmap.width / 4
        if @character.is_a?(Game_Player) && 
           @character.enable_isometric_animation
          @ch = bitmap.height / 8
        else
          @ch = bitmap.height / 4
        end
        self.ox = @cw / 2
        self.oy = @ch
      end
    end
    # Set visible situation
    self.visible = (not @character.transparent)
    # If graphic is character
    if @tile_id == 0
      # If player and no isometric animation
      if @character.is_a?(Game_Player)&& 
         @character.enable_isometric_animation == false
        # Set rectangular transfer
        sx = @character.pattern * @cw
        d = @character.direction
        d = 2 if d == 10 || d == 12
        d = 8 if d == 14 || d == 16
        sy = (d - 2) / 2 * @ch
        self.src_rect.set(sx, sy, @cw, @ch)
     else
        # Set rectangular transfer
        sx = @character.pattern * @cw
        sy = (@character.direction - 2) / 2 * @ch
        self.src_rect.set(sx, sy, @cw, @ch)
      end
    end
    # Set sprite coordinates
    self.x = @character.screen_x
    self.y = @character.screen_y
    self.z = @character.screen_z(@ch)
    # Set opacity level, blend method, and bush depth
    self.opacity = @character.opacity
    self.blend_type = @character.blend_type
    self.bush_depth = @character.bush_depth
    # Animation
    if @character.animation_id != 0
      animation = $data_animations[@character.animation_id]
      animation(animation, true)
      @character.animation_id = 0
    end
  end
end

Code:
#==============================================================================
# ** Kingdom Hearts II HUD (Advance Movement System Addition)
#------------------------------------------------------------------------------
# SephirothSpawn
# Version 1.0
# 2008-09-18
#------------------------------------------------------------------------------
# * Description:
#
#   This script was designed to add sneak and dash bars to the KH II HUD.
#------------------------------------------------------------------------------
# * Instructions:
#
#   Place the script below the Kingdom Hearts II HUD.
#------------------------------------------------------------------------------
# * Requirements:
#
#   Method and Class Library 2.3+
#------------------------------------------------------------------------------
# * Terms & Conditions:
#
#   Copyright (C) 2007 SephirothSpawn (Timothy Hoffman)
#   Free for non-commercial use.
#   Free with Kingdom Hearts II HUD lincense.
#
#   Any modifications to the system are not to be re-distributed without my
#   consent.
#==============================================================================

#==============================================================================
# ** SDK Log
#==============================================================================

if Object.const_defined?(:SDK)
  SDK.log('Kingdom Hearts II HUD + AMS', 'SephirothSpawn', 1.0, '2008-09-18')
end

#------------------------------------------------------------------------------
# * Begin SDK Enable Test
#------------------------------------------------------------------------------
if Object.const_defined?(:SDK) == false || 
   SDK.enabled?('Kingdom Hearts II HUD + AMS')
  
#==============================================================================
# ** Kingdom_Hearts_2_HUD
#==============================================================================

module Kingdom_Hearts_2_HUD
  #--------------------------------------------------------------------------
  # * Main HUD Preferences
  #--------------------------------------------------------------------------
  Sneak_Rect              = Rect.new(48, 480 - 32, 160, 12)
  Dash_Rect               = Rect.new(32, 480 - 38, 160, 12)
  Sneak_Border_Width      = 2
  Dash_Border_Width       = 2
  Sneak_Background_Color  = Main_HP_Background
  Dash_Background_Color   = Main_HP_Background
  Sneak_Color             = Color.red
  Sneak_Color2            = Color.purple
  Dash_Color              = Color.yellow
  Dash_Color2             = Color.orange
  Redraw_Frames           = 10
end

#==============================================================================
# ** Kingdom_Hearts_2_HUD::Window_HUD
#==============================================================================

class Kingdom_Hearts_2_HUD::Window_HUD < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  alias_method :seph_dashsneakbars_update, :update
  #--------------------------------------------------------------------------
  # * Draw Main SP
  #--------------------------------------------------------------------------
  def update
    # Original Draw Sp Bar
    seph_dashsneakbars_update
    # If update sneak_n_dash
    return unless update_sneak_n_dash
    # If draw background
    if Draw_Background
      # Get sneak backgroud position
      ox = Sneak_Rect.x - Sneak_Border_Width
      oy = Sneak_Rect.y - Sneak_Border_Width
      ow = Sneak_Rect.width + Sneak_Border_Width + Sneak_Border_Width
      oh = Sneak_Rect.height + Sneak_Border_Width + Sneak_Border_Width
      # Draw background
      self.contents.fill_rect(ox, oy, ow, oh, Sneak_Background_Color)
      # Get dash backgroud position
      ox = Dash_Rect.x - Dash_Border_Width
      oy = Dash_Rect.y - Dash_Border_Width
      ow = Dash_Rect.width + Dash_Border_Width + Dash_Border_Width
      oh = Dash_Rect.height + Dash_Border_Width + Dash_Border_Width
      # Draw background
      self.contents.fill_rect(ox, oy, ow, oh, Dash_Background_Color)
    end
    # Get sneak position
    ox, oy = Sneak_Rect.x, Sneak_Rect.y
    ow, oh = Sneak_Rect.width, Sneak_Rect.height
    # Gets current and max
    if Advanced_Movement_System::Count_Sneak == nil
      cur, max = 1, 1
    else
      cur, max = $game_player.sneak_count, $game_player.max_sneak_count
    end
    # Draw sneak reverse bar
    if Sneak_Color2 == nil
      self.contents.draw_rev_bar(ox, oy, ow, oh, cur, max, Sneak_Color)
    else
      self.contents.draw_rev_grad_bar(ox, oy, ow, oh, cur, max, 
        Sneak_Color, Sneak_Color2)
    end
    # Get dash position
    ox, oy = Dash_Rect.x, Dash_Rect.y
    ow, oh = Dash_Rect.width, Dash_Rect.height
    # Gets current and max
    if Advanced_Movement_System::Count_Dash == nil
      cur, max = 1, 1
    else
      cur, max = $game_player.dash_count, $game_player.max_dash_count
    end
    # Draw dash reverse bar
    if Dash_Color2 == nil
      self.contents.draw_rev_bar(ox, oy, ow, oh, cur, max, Dash_Color)
    else
      self.contents.draw_rev_grad_bar(ox, oy, ow, oh, cur, max, 
        Dash_Color, Dash_Color2)
    end
  end
  #--------------------------------------------------------------------------
  # * Update Dash N Sneak
  #--------------------------------------------------------------------------
  def update_sneak_n_dash
    # Return true if hasn't been drawn yet
    if @draw_dash_n_sneak == nil
      @draw_dash_n_sneak = true
      return true
    end
    # Return false if not redraw frame
    return false unless Graphics.frame_count % Redraw_Frames == 0
    # Return true if sneaking
    if Advanced_Movement_System::Count_Sneak != nil || 
       Advanced_Movement_System::Count_Dash != nil
      # If current count is different
      if @draw_sneak_count != $game_player.sneak_count ||
         @draw_dash_count != $game_player.dash_count
        @draw_sneak_count = $game_player.sneak_count
        @draw_dash_count = $game_player.dash_count
        return true
      end
    end
    # Return false
    return false
  end
end

#------------------------------------------------------------------------------
# * End SDK Enable Test
#------------------------------------------------------------------------------
end

I'll probably have them all done next week sometime.

@.::Makasu::.  : Maybe in a few months I might release some pictures and such. ;)
 

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