Ogłoszenie 

Uwaga! To forum jest w trybie offline.
Wszelką pomoc uzyskasz pod adresem
forum.ultimateam.pl


Administracja Forum


Poprzedni temat «» Następny temat
Kingdom Hearts HUD
Autor Wiadomość
pro14ab 




Preferowany:
RPG Maker VX

Pomógł: 5 razy
Dołączył: 20 Maj 2011
Posty: 32
Wysłany: Sob 12 Lis, 2011 14:52
Kingdom Hearts HUD
Opis:Skrypt ten tworzy HUD z gry Kingdom Hearts
Autor:BigED
Instrukcja: Wklej skrypt nad Main
Kompatybilność: VX
Screeny
Spoiler:



Skrypt:
Spoiler:

Kod:
#--------------------------------------------------------------------
# Listę kolorów, które można wykorzystać do konfiguracji czcionek i grubości
# Kolory w config sekcji. Wystarczy wymienić ostatniej części każdego
#Oświadczenie #, czyli udział w nawiasach <> poniżej:
#
# Kolory:: <White>
#------------------------------------------------- -------------------
# Kontynuuj poniżej sekcji konfiguracji
#--------------------------------------------------------------------
module Colors
 
  AliceBlue = Color.new(240,248,255)
  AntiquaWhite = Color.new(250,235,215)
  Aqua = Color.new(0,255,255)
  Aquamarine = Color.new(127,255,212)
  Azure = Color.new(240,255,255)
  Beige = Color.new(245,245,220)
  Bisque = Color.new(255,228,196)
  Black = Color.new(0,0,0)
  BlanchedAlmond = Color.new(255,255,205)
  Blue = Color.new(0,0,255)
  BlueViolet = Color.new(138,43,226)
  Brown = Color.new(165,42,42)
  BurlyWood = Color.new(222,184,135)
  CadetBlue = Color.new(95,158,160)
  Chartreuse = Color.new(127,255,0)
  Chocolate = Color.new(210,105,30)
  Coral = Color.new(255,127,80)
  CornFlowerBlue = Color.new(100,149,237)
  Cornsilk = Color.new(255,248,220)
  Crimson = Color.new(220,20,60)
  Cyan = Color.new(0,255,255)
  DarkBlue = Color.new(0,0,139)
  DarkCyan = Color.new(0,139,139)
  DarkGoldenrod = Color.new(184,134,11)
  DarkGray = Color.new(169,169,169)
  DarkGreen = Color.new(0,100,0)
  DarkKhaki= Color.new(189,183,107)
  DarkMagenta = Color.new(139,0,139)
  DarkOliveGreen = Color.new(85,107,47)
  DarkOrange = Color.new(255,140,0)
  DarkRed = Color.new(139,0,0)
  DarkSalmon = Color.new(233,150,122)
  DarkSeaGreen = Color.new(143,188,143)
  DarkSlateBlue = Color.new(72,61,139)
  DarkSlateGray = Color.new(40,79,79)
  DarkTurquoise = Color.new(0,206,209)
  DarkViolet = Color.new(148,0,211)
  DeepPink = Color.new(255,20,147)
  DeepSkyBlue = Color.new(0,191,255)
  DimGray = Color.new(105,105,105)
  DodgerBlue = Color.new(30,144,255)
  FireBrick = Color.new(178,34,34)
  FloralWhite = Color.new(255,255,240)
  ForestGreen = Color.new(34,139,34)
  Fuschia = Color.new(255,0,255)
  Gainsboro = Color.new(220,220,220)
  GhostWhite = Color.new(248,248,255)
  Gold = Color.new(255,215,0)
  Goldenrod = Color.new(218,165,32)
  Gray = Color.new(128,128,128)
  Green = Color.new(0,128,0)
  GreenYellow = Color.new(173,255,47)
  Honeydew = Color.new(240,255,240)
  HotPink = Color.new(255,105,180)
  IndianRed = Color.new(205,92,92)
  Indigo = Color.new(75,0,130)
  Ivory = Color.new(255,240,240)
  Khaki = Color.new(240,230,140)
  Lavender = Color.new(230,230,250)
  LavenderBlush = Color.new(255,240,245)
  LawnGreen = Color.new(124,252,0)
  LemonChiffon = Color.new(255,250,205)
  LightBlue = Color.new(173,216,230)
  LightCoral = Color.new(240,128,128)
  LightCyan = Color.new(224,255,255)
  LightGoldenrodYellow = Color.new(250,250,210)
  LightGreen = Color.new(144,238,144)
  LightGray = Color.new(211,211,211)
  LightPink = Color.new(255,182,193)
  LightSalmon = Color.new(255,160,122)
  LightSeaGreen = Color.new(32,178,170)
  LightSkyBlue = Color.new(135,206,250)
  LightSlateGray = Color.new(119,136,153)
  LightSteelBlue = Color.new(176,196,222)
  LightYellow = Color.new(255,255,224)
  Lime = Color.new(0,255,0)
  LimeGreen = Color.new(50,205,50)
  Linen = Color.new(250,240,230)
  Magenta = Color.new(255,0,255)
  Maroon = Color.new(128,0,0)
  MediumAquamarine = Color.new(102,205,170)
  MediumBlue = Color.new(0,0,205)
  MediumOrchid = Color.new(186,85,211)
  MediumPurple = Color.new(147,112,219)
  MediumSeaGreen = Color.new(60,179,113)
  MediumSlateBlue = Color.new(123,104,238)
  MediumSpringGreen = Color.new(0,250,154)
  MediumTurquoise = Color.new(72,209,204)
  MediumVioletRed = Color.new(199,21,112)
  MidnightBlue = Color.new(25,25,112)
  MintCream = Color.new(245,255,250)
  MistyRose = Color.new(255,228,225)
  Moccasin = Color.new(255,228,181)
  NavajoWhite = Color.new(255,222,173)
  Navy = Color.new(0,0,128)
  OldLace = Color.new(253,245,230)
  Olive = Color.new(128,128,0)
  OliveDrab = Color.new(107,142,45)
  Orange = Color.new(255,165,0)
  OrangeRed = Color.new(255,69,0)
  Orchid = Color.new(218,112,214)
  PaleGoldenRod = Color.new(238,232,170)
  PaleGreen = Color.new(152,251,152)
  PaleTurquoise = Color.new(175,238,238)
  PaleVioletRed = Color.new(219,112,147)
  PapayaWhip = Color.new(255,239,213)
  PeachPuff = Color.new(255,218,155)
  Peru = Color.new(205,133,63)
  Pink = Color.new(255,192,203)
  Plum = Color.new(221,160,221)
  PowderBlue = Color.new(176,224,230)
  Purple = Color.new(128,0,128)
  Red = Color.new(255,0,0)
  RosyBrown = Color.new(188,143,143)
  RoyalBlue = Color.new(65,105,225)
  SaddleBrown = Color.new(139,69,19)
  Salmon = Color.new(250,128,114)
  SandyBrown = Color.new(244,164,96)
  SeaGreen = Color.new(46,139,87)
  Seashell = Color.new(255,245,238)
  Sienna = Color.new(160,82,45)
  Silver = Color.new(192,192,192)
  SkyBlue = Color.new(135,206,235)
  SlateBlue = Color.new(106,90,205)
  SlateGray = Color.new(112,128,144)
  Snow = Color.new(255,250,250)
  SpringGreen = Color.new(0,255,127)
  SteelBlue = Color.new(70,130,180)
  Tan = Color.new(210,180,140)
  Teal = Color.new(0,128,128)
  Thistle = Color.new(216,191,216)
  Tomato = Color.new(253,99,71)
  Turquoise = Color.new(64,244,208)
  Violet = Color.new(238,130,238)
  Wheat = Color.new(245,222,179)
  White = Color.new(255,255,255)
  WhiteSmoke = Color.new(245,245,245)
  Yellow = Color.new(255,255,0)
  YellowGreen = Color.new(154,205,50)
 
  GaugeGreen = Color.new(202,241,126)
  GaugeBlue = Color.new(137,222,254)
 
end

#--------------------------------------------------------------------
# do not touch this
class Point
  attr_reader :x
  attr_reader :y
  def initialize(x, y)
    @x, @y = x, y
  end
  def to_a
    [@x, @y]
  end
end
# or this
class ScrollDirection
  Left = 0
  Right = 1
end
#--------------------------------------------------------------------

#--------------------------------------------------------------------
# * Configuration Section
#--------------------------------------------------------------------
module HudConfig
 
  # The actor id of the main character in your game.
  # This will be the character in the main hud window.
  PLAYER_ID                  = 1
 
  # if this is set to 'true' the HUD will go opaque.
  # when the player is walking.
  TRANSPARENT_WHEN_MOVING    = true
  # this is the minimum opacity value reached while walking.
  # this should be a value between 0 and 255.
  TRANSPARENCY_WHEN_MOVING   = 64
  # this value determines how fast the HUD will fade out and in.
  # this is in incremenets per frame (60 frames per second).
  TRANSPARENCY_SWITCH_SPEED  = 2
 
  # If this switch is 'ON' the hud will not appear at all.
  # Set this to 'nil' to disable the feature completely
  NO_SHOW_SWITCH             = nil
 
  # If this text is found in a map name the hud will
  # be disabled for that map at all times.  This text
  # will be removed from the map name proper in case
  # you are using a map name script or somethin like that.
  NO_SHOW_TEXT               = 'hud no show'
 
  # Display an empty hud if there is no party leader?
  SHOW_IF_NO_LEADER          = false
 
  # Name of the player (main character) hud graphic
  PLAYER_HUD_IMAGE_NAME      = 'player_hud'
  # Use the gren and blue mp/hp gauges?
  # You may use your own graphics, but they must
  # adhere to the same format as the originals, i.e.,
  #
  #   hud_bar_hp_000.png
  #
  # Where the '000' part is a multiple of five, from 0-100.
  PLAYER_USE_CUSTOM_GAUGE    = true
 
  # The physical location of the hud sprite.
  # All of the other graphic locations are relative to this one.
  PLAYER_HUD_LOC             = Point.new(0, 0)
  # The relative location of the hud image to the hud sprite.
  PLAYER_HUD_IMAGE_LOCATION  = Point.new(0, 0)   
   
  # The starting location of each peice of the HP gauge.
  PLAYER_HP_GAUGE_LOCATION   = Point.new(0, 0)
  # the starting location of each peice of the MP gauge.
  PLAYER_MP_GAUGE_LOCATION   = Point.new(0, 0)
 
  SHOW_PLAYER_FACE_IMAGE     = true
  # The location of the face graphic.
  FACE_LOCATION              = Point.new(35, 0)
 
  # Show all party members? (THESE FEATURES ARE NOT YET IMPLEMENTED)
  USE_MEMBER_WINDOW          = true
  MEMBER_HUD_IMAGE_NAME      = 'member_hud'
  MEMBER_USE_CUSTOM_GAUGE    = false
 
  # Allow the player to hide the HUD by pressing a button?
  ALLOW_HUD_HIDE             = true
  # The button which will trigger a hud move.
  HIDE_HUD_INPUT             = Input::X
  # The speed at which to move the hud.
  HUD_HIDE_SPEED             = 7
  # replace "Left" with "Right" below to change the scroll direction
  HUD_SCROLL_DIRECTION       = ScrollDirection::Left
 
  # Global values which are convenient for setting
  # multiple values to the same thing.
  GLOBAL_FONT_NAME           = ['Magneto', 'Consolas', 'Verdana', 'Ariel', 'Courier New']
  GLOBAL_PLAYER_FONT_SIZE    = 22
  GLOBAL_MEMBER_FONT_SIZE    = 22
 
  SHOW_PLAYER_NAME            = true
  # The rest of the settings deal with setting the
  # location and style of the text displayed in the HDU
  PLAYER_NAME_FONT           = GLOBAL_FONT_NAME
  PLAYER_NAME_COLOR          = Colors::Silver
  PLAYER_NAME_USE_ITALICS    = false
  PLAYER_NAME_USE_BOLD       = false
  PLAYER_NAME_USE_SHADOW     = true
  PLAYER_NAME_FONT_SIZE      = 20
  PLAYER_NAME_LOCATION       = Point.new(125,0)
  PLAYER_NAME_WIDTH          = 90
  PLAYER_NAME_HEIGHT         = 22
 
  MEMBER_NAME_FONT           = GLOBAL_FONT_NAME
  MEMBER_NAME_COLOR          = Colors::White
  MEMBER_NAME_FONT_SIZE      = GLOBAL_MEMBER_FONT_SIZE
  MEMBER_NAME_LOCATION       = Point.new(0,0)
 
  USE_HP_TEXT_DISPLAY        = true
  PLAYER_HP_FONT             = ['Consolas', 'Verdana', 'Ariel', 'Courier New']
  PLAYER_FULL_HP_COLOR       = Colors::GaugeGreen
  PLAYER_HP_FONT_USE_ITALICS = false
  PLAYER_HP_FONT_USE_BOLD    = true
  PLAYER_HP_FONT_USE_SHADOW  = true
  PLAYER_HP_FONT_SIZE        = 14
  PLAYER_HP_LOCATION         = Point.new(130,66)
  PLAYER_HP_WIDTH            = 76
  PLAYER_HP_HEIGHT           = 11
 
  MEMBER_HP_FONT             = GLOBAL_FONT_NAME
  MEMBER_HP_FONT_SIZE        = GLOBAL_MEMBER_FONT_SIZE
  MEMBER_HP_LOCATION         = Point.new(0,0)
 
  USE_MP_TEXT_DISPLAY        = USE_HP_TEXT_DISPLAY
  PLAYER_MP_FONT             = PLAYER_HP_FONT
  PLAYER_FULL_MP_COLOR       = Colors::GaugeBlue
  PLAYER_MP_FONT_USE_ITALICS = PLAYER_HP_FONT_USE_ITALICS
  PLAYER_MP_FONT_USE_BOLD    = PLAYER_HP_FONT_USE_BOLD
  PLAYER_MP_FONT_USE_SHADOW  = PLAYER_HP_FONT_USE_SHADOW
  PLAYER_MP_FONT_SIZE        = PLAYER_HP_FONT_SIZE
  PLAYER_MP_LOCATION         = Point.new(PLAYER_HP_LOCATION.x, PLAYER_HP_LOCATION.y + PLAYER_HP_HEIGHT + 1)
  PLAYER_MP_WIDTH            = PLAYER_HP_WIDTH
  PLAYER_MP_HEIGHT           = PLAYER_HP_HEIGHT
 
  MEMBER_MP_FONT             = GLOBAL_FONT_NAME
  MEMBER_MP_FONT_SIZE        = GLOBAL_MEMBER_FONT_SIZE
  MEMBER_MP_LOCATION         = Point.new(0,0)
 
  SHOW_PLAYER_LEVEL          = true
  PLAYER_LEVEL_FONT          = GLOBAL_FONT_NAME
  PLAYER_LEVEL_COLOR         = Colors::Gold
  PLAYER_LEVEL_USE_ITALICS   = false
  PLAYER_LEVEL_USE_BOLD      = false
  PLAYER_LEVEL_USE_SHADOW    = true
  PLAYER_LEVEL_FONT_SIZE     = 18
  PLAYER_LEVEL_LOCATION      = Point.new(136,24)
  PLAYER_LEVEL_WIDTH         = 36
  PLAYER_LEVEL_HEIGHT        = 35
 
  MEMBER_LEVEL_FONT          = GLOBAL_FONT_NAME
  MEMBER_LEVEL_COLOR         = PLAYER_LEVEL_COLOR
  MEMBER_LEVEL_FONT_SIZE     = 10
  MEMBER_LEVEL_LOCATION      = Point.new(0,0)
   
  #-------
  # don't change the values below unless you know what you are doing.
 
  # Shows above the map and below the message window by default
  PLAYER_HUD_Z               = 199
 
  # The text format used for gauage images.   
  HEALTH_GAUGE_FORMAT        = 'hud_bar_%s_%.3d'
 
  # the name of the image file used as a mask for the face graphic
  PLAYER_FACE_MASK_NAME      = 'player_face_mask'
 
end

class EventHandler
 
  def initialize
    @client_map = {}
  end
 
  def add_listener(id, func)
    (@client_map[id.hash] ||= []) << func
  end
 
  def remove_listener(id)
    return @client_map.delete(id.hash)
  end
 
  def alert_listeners(*args)
    @client_map.each_value { |v| v.each { |func| func.call(*args) } }
  end
 
  def dispose
    @client_map = nil
  end
 
end

class Game_Actor < Game_Battler
 
  attr_reader :hp_changed
  attr_reader :mp_changed
  attr_reader :maxhp_changed
  attr_reader :maxmp_changed
 
  alias :pre_confhud_ga_init :initialize unless $@
  def initialize(*args)
    @hp_changed = EventHandler.new
    @mp_changed = EventHandler.new
    @maxhp_changed = EventHandler.new
    @maxmp_changed = EventHandler.new
    pre_confhud_ga_init(*args)   
  end
 
  def on_hp_changed(*args)   
    @hp_changed.alert_listeners(*args)
  end
 
  def on_mp_changed(*args)   
    @mp_changed.alert_listeners(*args)
  end
 
  def on_maxhp_changed(*args)
    @maxhp_changed.alert_listeners(*args)
  end
 
  def on_maxmp_changed(*args)
    @maxmp_changed.alert_listeners(*args)
  end
 
  alias :pre_confhud_ga_hpequ :hp= unless $@
  def hp=(*args)
    temp = @hp   
    pre_confhud_ga_hpequ(*args)   
    on_hp_changed(@hp) unless temp == @hp
  end
 
  alias :pre_confhud_ga_maxhpequ :maxhp= unless $@
  def maxhp=(*args)
    temp = self.maxhp
    pre_confhud_ga_maxhpequ(*args)
    cur_max = self.maxhp
    on_maxhp_changed(cur_max) unless temp == cur_max
  end
 
  alias :pre_confhud_ga_mpequ :mp= unless $@
  def mp=(*args)
    temp = @mp
    pre_confhud_ga_mpequ(*args)
    on_mp_changed(@mp) unless temp == @mp
  end
 
  alias :pre_confhud_ga_maxmpequ :maxmp= unless $@
  def maxmp=(*args)
    temp = self.maxmp
    pre_confhud_ga_maxmpequ(*args)
    cur_max = self.maxmp
    on_maxmp_changed(cur_max) unless temp == cur_max
  end
 
  alias :pre_confhud_ga_recover_all :recover_all unless $@
  def recover_all(*args)
    temp_hp, temp_mp = @hp, @mp
    pre_confhud_ga_recover_all(*args)
    on_hp_changed if temp_hp != @hp
    on_mp_changed if temp_mp != @mp
  end
 
end

class Game_Party
 
  attr_reader :party_leader_changed
 
  alias :pre_confhud_gp_init :initialize
  def initialize(*args)
    pre_confhud_gp_init(*args)
    @party_leader_changed = EventHandler.new
  end
 
  def on_party_leader_changed(*args)
    party_leader_changed.alert_listeners(*args)
  end
 
  alias :pre_confhud_gp_add_actor :add_actor
  def add_actor(*args)
    leader = $game_party.members.first
    pre_confhud_gp_add_actor(*args)
    on_party_leader_changed unless leader == $game_party.members.first
  end
 
  alias :pre_confhud_gp_remove_actor :remove_actor
  def remove_actor(*args)
    leader = $game_party.members.first
    pre_confhud_gp_remove_actor(*args)
    on_party_leader_changed unless leader == $game_party.members.first
  end
 
end

class Game_Player < Game_Character
 
  attr_reader :move_begun
  attr_reader :move_end
 
  alias :pre_confhud_gp_init :initialize
  def initialize(*args)
    @move_begun = EventHandler.new
    @move_end = EventHandler.new
    @move_started = false
    pre_confhud_gp_init(*args)
  end
 
  def on_move_begun
    @move_started = true
    @move_begun.alert_listeners
  end
 
  def on_move_end
    @move_started = false
    @move_end.alert_listeners
  end
 
  alias :pre_confhud_gp_update :update
  def update
    on_move_end if !moving? && @move_started
    pre_confhud_gp_update
  end
 
  alias :pre_conf_hud_gp_move_d :move_down
  def move_down(*args)
    on_move_begun if passable?(@x, @y + 1)
    pre_conf_hud_gp_move_d(*args)
  end
 
  alias :pre_conf_hud_gp_move_l :move_left
  def move_left(*args)
    on_move_begun if passable?(@x - 1, @y)
    pre_conf_hud_gp_move_l(*args)
  end
 
  alias :pre_conf_hud_gp_move_u :move_up
  def move_up(*args)
    on_move_begun if passable?(@x, @y - 1)
    pre_conf_hud_gp_move_u(*args)
  end
 
  alias :pre_conf_hud_gp_move_r :move_right
  def move_right(*args)
    on_move_begun if passable?(@x + 1, @y)
    pre_conf_hud_gp_move_r(*args)
  end
 
end

class Window_Base < Window
 
  alias :pre_confhud_wb_hp_color :hp_color unless $@
  def hp_color(actor, for_hud=false)
    return HudConfig::PLAYER_FULL_HP_COLOR if for_hud && actor.hp == actor.maxhp
    return pre_confhud_wb_hp_color(actor)
  end
 
  alias :pre_confhud_wb_mp_color :mp_color unless $@
  def mp_color(actor, for_hud=false)
    return HudConfig::PLAYER_FULL_MP_COLOR if for_hud && actor.mp == actor.maxmp
    return pre_confhud_wb_mp_color(actor)
  end
 
end

class MainHud < Sprite_Base
include HudConfig

  WLH = Window_Base::WLH

  attr_accessor :actor
 
  def initialize(location, viewport=nil, actor=nil, visible=true)
    $game_player.move_begun.add_listener(self, lambda { player_begin_move })
    $game_player.move_end.add_listener(self, lambda { player_end_move })
    @hud_visible = visible
    @new_opacity = 255
    super(viewport)
    self.bitmap = Bitmap.new(Graphics.width, Graphics.height)
    self.x, self.y = location.x, location.y   
    self.actor = actor
  end
 
  def player_end_move
    @new_opacity = 255
  end
 
  def player_begin_move
    @new_opacity = TRANSPARENCY_WHEN_MOVING
  end
 
  def update
    if TRANSPARENT_WHEN_MOVING && self.opacity != @new_opacity
      incr = TRANSPARENCY_SWITCH_SPEED
      if @new_opacity < self.opacity
        new_opacity = [self.opacity - incr, @new_opacity].max
      else
        new_opacity = [self.opacity + incr, @new_opacity].min
      end
      self.opacity = new_opacity
    end
    super
  end
 
  def actor=(value)
    # allow nil values to cause a refresh so that the hud
    # is painted at all times, even when there are no party members.
    return if @actor == value unless value.nil?
    remove_listeners(@actor)
    add_listeners(value)
    @actor = value
    create_player_face_image
    refresh
  end
 
  def hud_visible?
    @hud_visible
  end
 
  def hud_visible=(value)
    if @hud_visible != value
      @hud_visible = value
      refresh
    end
  end
 
  def image_rect
    ret = hud_image.rect
    ret.x, ret.y = *PLAYER_HUD_LOC.to_a
    return ret
  end
 
  def create_dummy_window
    win = Window_Base.new(0, 0, 64, 64)
    win.visible = false   
    return win
  end
 
  # Stupid hack to get standard text colors because
  # I did not feel like copy & pasting those methods.
  def hp_color
    return (@window ||= create_dummy_window).hp_color(@actor, true)
  end
 
  def mp_color
    return (@window ||= create_dummy_window).mp_color(@actor, true)
  end
 
  def hud_image
    return Cache.picture(PLAYER_HUD_IMAGE_NAME)
  end
 
  def hud_location
    return PLAYER_HUD_IMAGE_LOCATION
  end
 
  def hp_gauge_location
    return PLAYER_HP_GAUGE_LOCATION
  end
 
  def mp_gauge_location
    return PLAYER_MP_GAUGE_LOCATION
  end
 
  def name_draw_rect
    return Rect.new(
             PLAYER_NAME_LOCATION.x,
             PLAYER_NAME_LOCATION.y,
             PLAYER_NAME_WIDTH,
             PLAYER_NAME_HEIGHT
             )
  end
 
  def level_draw_rect   
    return Rect.new(
             PLAYER_LEVEL_LOCATION.x,
             PLAYER_LEVEL_LOCATION.y,
             PLAYER_LEVEL_WIDTH,
             PLAYER_LEVEL_HEIGHT
             )
  end
 
  def hp_draw_rect
    return Rect.new(
             PLAYER_HP_LOCATION.x,
             PLAYER_HP_LOCATION.y,
             PLAYER_HP_WIDTH,
             PLAYER_HP_HEIGHT
             )
  end
 
  def mp_draw_rect
    return Rect.new(
             PLAYER_MP_LOCATION.x,
             PLAYER_MP_LOCATION.y,
             PLAYER_MP_WIDTH,
             PLAYER_MP_HEIGHT
             )
  end
 
  def name_font
    font = Font.new(PLAYER_NAME_FONT, PLAYER_NAME_FONT_SIZE)
    font.color = PLAYER_NAME_COLOR
    font.italic = PLAYER_NAME_USE_ITALICS
    font.bold = PLAYER_NAME_USE_BOLD
    font.shadow = PLAYER_NAME_USE_SHADOW
    return font
  end
 
  def hp_font
    font = Font.new(PLAYER_HP_FONT, PLAYER_HP_FONT_SIZE)
    font.color = hp_color
    font.italic = PLAYER_HP_FONT_USE_ITALICS
    font.bold = PLAYER_HP_FONT_USE_BOLD
    font.shadow = PLAYER_HP_FONT_USE_SHADOW
    return font
  end
 
  def mp_font
    font = Font.new(PLAYER_MP_FONT, PLAYER_MP_FONT_SIZE)
    font.color = mp_color
    font.italic = PLAYER_MP_FONT_USE_ITALICS
    font.bold = PLAYER_MP_FONT_USE_BOLD
    font.shadow = PLAYER_MP_FONT_USE_SHADOW
    return font
  end
 
  def level_font
    font = Font.new(PLAYER_LEVEL_FONT, PLAYER_LEVEL_FONT_SIZE)
    font.color = PLAYER_LEVEL_COLOR
    font.italic = PLAYER_LEVEL_USE_ITALICS
    font.bold = PLAYER_LEVEL_USE_BOLD
    font.shadow = PLAYER_LEVEL_USE_SHADOW
    return font
  end
 
  def player_face_mask_image
    return Cache.picture(PLAYER_FACE_MASK_NAME)
  end
 
  def create_player_face_image(size=96)
    if @actor.nil?
      @face_image = Bitmap.new(size, size)
      return
    end   
    rect = Rect.new(0, 0, 0, 0)
    rect.x = @actor.face_index % 4 * 96 + (96 - size) / 2
    rect.y = @actor.face_index / 4 * 96 + (96 - size) / 2
    rect.width = size
    rect.height = size
    face = Cache.face(@actor.face_name)
    mask = player_face_mask_image
    @face_image = Bitmap.new(rect.width, rect.height)
    @face_image.blt(0, 0, face, rect)
    for y in 0...rect.height
      for x in 0...rect.width
        mask_color = mask.get_pixel(x, y)
        @face_image.set_pixel(x, y, mask_color) if mask_color.alpha.zero?
      end
    end
  end
 
  def add_listeners(actor)
    return if actor.nil?
    func = lambda { refresh }
    actor.hp_changed.add_listener(self, func)
    actor.maxhp_changed.add_listener(self, func)
    actor.mp_changed.add_listener(self, func)
    actor.maxmp_changed.add_listener(self, func)
  end
 
  def hp_value_changed
   
    refresh
  end
 
  def remove_listeners(actor)
    return if actor.nil?
    actor.hp_changed.remove_listener(self)
    actor.maxhp_changed.remove_listener(self)
    actor.mp_changed.remove_listener(self)
    actor.maxmp_changed.remove_listener(self)
  end
 
  def draw_hud
    draw_custom_mp_gauge
    draw_custom_hp_gauge
    image = hud_image
    location = hud_location
    self.bitmap.blt(location.x, location.y, image, image.rect)
  end
 
  def draw_custom_hp_gauge
    cur, max = *(@actor.nil? ? [0,1] : [@actor.hp,@actor.maxhp])
    draw_gauge(hp_gauge_location, 'hp', cur, max)
  end
 
  def draw_custom_mp_gauge
    cur, max = *(@actor.nil? ? [0,1] : [@actor.mp,@actor.maxmp])
    draw_gauge(mp_gauge_location, 'mp', cur, max)
  end
 
  def draw_gauge(location, stat_name, current, max)
    percent_health = (current / max.to_f) * 100
    multiple = 5   
    percent_health = check_health_bounds(percent_health, multiple)
    percent_health = round_to_multiple_of(multiple, percent_health.round)
    file_name = HEALTH_GAUGE_FORMAT % [stat_name, percent_health]   
    image = Cache.picture(file_name)   
    self.bitmap.blt(location.x, location.y, image, image.rect)
  end
     
  def round_to_multiple_of(multiple_of, num)
    # why in the fuck did I do this this way?
    # leave comments for yourself in the future dumbass.
    leftover = num % multiple_of
    return num if leftover.zero?
    if leftover > multiple_of / 2
      sym = :+
    else
      sym = :-
    end
    ret = num
    loop do
      ret = ret.send sym, 1
      break if ret % multiple_of == 0
    end
    return ret
  end
 
  def check_health_bounds(num, multiple)
    # dont allow the gauge to read 100 or 0 unless
    # the current health actually is 100 or 0.
    next_lower = 100 - multiple
    if num > next_lower && num < 100
      return next_lower
    elsif num < multiple && num > 0
      return multiple
    else
      return num
    end
  end
 
  def draw_face
    self.bitmap.blt(FACE_LOCATION.x, FACE_LOCATION.y, @face_image, @face_image.rect)
  end
 
  def draw_name
    return if @actor.nil?
    name = @actor.name
    rect = name_draw_rect   
    font = name_font
    temp_font = self.bitmap.font
    self.bitmap.font = font
    self.bitmap.draw_text(rect, name)
    self.bitmap.font = temp_font
  end
 
  def draw_level
    return if @actor.nil?
    level = @actor.level
    rect = level_draw_rect   
    font = level_font
    temp_font = self.bitmap.font
    self.bitmap.font = font
    self.bitmap.draw_text(rect, level, 1)
    self.bitmap.font = temp_font
  end
 
  def use_custom_gauges?
    return PLAYER_USE_CUSTOM_GAUGE
  end
 
  def health_text(prefix, cur, max)
    return "#{prefix}: #{cur}/#{max}"
  end
 
  def draw_health(rect, font, prefix, cur, max)
    self.bitmap.font = font
    xr = rect.x + rect.width
    health_width = (rect.width * 0.33).round
    spacer_width = (health_width / 2.1).round
    temp_font = self.bitmap.font
    prefixf = prefix + ':'
    # fuck this pile of shit, move along, this will just hurt your head
    self.bitmap.draw_text(rect.x, rect.y, self.bitmap.text_size(prefixf).width, rect.height, prefixf)
    self.bitmap.draw_text(xr - spacer_width - health_width * 2 + (health_width * 0.15).round, rect.y, health_width, rect.height, cur, 2)
    self.bitmap.draw_text(xr - spacer_width - health_width, rect.y, spacer_width, rect.height, "/", 2)
    self.bitmap.draw_text(xr - health_width, rect.y, health_width, rect.height, max, 2)
    self.bitmap.font = temp_font
  end
 
  def draw_hp
    return if @actor.nil?
    draw_health(hp_draw_rect, hp_font, Vocab.hp_a, @actor.hp, @actor.maxhp)   
  end
 
  def draw_mp
    return if @actor.nil?
    draw_health(mp_draw_rect, mp_font, Vocab.mp_a, @actor.mp, @actor.maxmp)
  end
 
  def refresh   
    self.bitmap.clear
    return unless hud_visible?
    draw_face if SHOW_PLAYER_FACE_IMAGE
    draw_hud   
    draw_name if SHOW_PLAYER_NAME
    draw_level if SHOW_PLAYER_LEVEL
    draw_hp if USE_HP_TEXT_DISPLAY
    draw_mp if USE_MP_TEXT_DISPLAY       
  end
 
  def dispose
    remove_listeners(@actor)
    $game_player.move_begun.remove_listener(self)
    $game_player.move_end.remove_listener(self)
    unless @window.nil?
      @window.dispose
      @window = nil
    end
    super   
  end
 
end

class SubHud < MainHud
 
 
 
end

class Game_Map
 
  alias :pre_confhud_gm_setup :setup
  def setup(*args)
    id = *args
    @info = load_data('Data/MapInfos.rvdata')[id]   
    pre_confhud_gm_setup(*args)
  end
 
  def display_hud?
    return !@info.name.include?(HudConfig::NO_SHOW_TEXT)
  end
 
end

class Scene_Map < Scene_Base
include HudConfig
 
  attr_reader :player_hud
 
  # used to keep track of the hud location between
  # setups and teardowns, i.e., if you enter the menu or battle.
  @@last_hud_ox = 0
 
  alias :pre_confhud_sm_start :start unless $@
  def start
    pre_confhud_sm_start
    initialize_hud
    $game_party.party_leader_changed.add_listener(self, lambda { @player_hud.actor = $game_party.members.first })
  end
 
  def initialize_hud
    @hud_viewport = Viewport.new(0, 0, 544, 416)
    @hud_viewport.z = PLAYER_HUD_Z
    @hud_viewport.ox = @@last_hud_ox   
    @@target_hud_location ||= @hud_viewport.ox   
    actor = $game_party.members.first
    @player_hud = MainHud.new(
      PLAYER_HUD_LOC,
      @hud_viewport,
      actor,
      hud_enabled?(actor)
      )
  end
 
  alias :pre_confhud_sm_update :update unless $@
  def update
    pre_confhud_sm_update
    update_hud
    update_hud_input
    update_hud_transition
  end
 
  alias :pre_confhud_sm_update_basic :update_basic unless $@
  def update_basic(*args)
    pre_confhud_sm_update_basic
    update_hud
  end
 
  def show_hud
    trigger_scroll
  end
 
  def hide_hud
    trigger_scroll(true)
  end
 
  def trigger_scroll(force_hide=false)
    @@hud_moving = true
    if @hud_viewport.ox.zero?
      hud_rect = @player_hud.image_rect     
      left = HUD_SCROLL_DIRECTION  == ScrollDirection::Left       
      offset = left ? hud_rect.width + hud_rect.x : -(Graphics.width - hud_rect.x)
      @@target_hud_location = @hud_viewport.ox + offset
    elsif !force_hide
      @@target_hud_location = 0
    end                     
  end
 
  def update_hud
    @player_hud.hud_visible = hud_enabled?
    @player_hud.update
    @hud_viewport.update
  end
 
  def hud_enabled?(actor=nil)
    return false if !SHOW_IF_NO_LEADER && (actor ||= @player_hud.actor).nil?
    return false unless $game_map.display_hud?
    return false unless NO_SHOW_SWITCH.nil? || !$game_switches[NO_SHOW_SWITCH]   
    return true
  end
 
  def update_hud_input
    trigger_scroll if ALLOW_HUD_HIDE && Input.trigger?(HIDE_HUD_INPUT)               
  end
 
  def update_hud_transition
    @@hud_moving = @hud_viewport.ox != @@target_hud_location
    return unless @@hud_moving   
    incr = @hud_viewport.ox < @@target_hud_location ? HUD_HIDE_SPEED : -HUD_HIDE_SPEED   
    @hud_viewport.ox += [incr, (@hud_viewport.ox - @@target_hud_location).abs].min
  end
 
  alias :pre_confhud_sm_terminate :terminate unless $@
  def terminate
    pre_confhud_sm_terminate
    $game_party.party_leader_changed.remove_listener(self)
    @player_hud.dispose
    @@last_hud_ox = @hud_viewport.ox
  end
 
end



Potrzebna grafika

DEMO - 4shered
DEMO - Ultima
________________________
Chcesz wygrać grę wejdzie i zarejestruj się na start dostaniesz 5p.

Kliknij Pajacyka
Ostatnio zmieniony przez Ayene Sob 05 Maj, 2012 21:23, w całości zmieniany 2 razy  
 
 
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Sob 12 Lis, 2011 14:56
Ujdzie, ale nie ma paska EXP, jest tylko lvl, no i nie ma opcji że zamiast faceseta wyświetla się charset+nieprzetłumaczone... Skrypt ocenię na 2/10...
________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Thief Silver 



Preferowany:
RPG Maker VX

Dołączył: 09 Lis 2011
Posty: 7
Wysłany: Nie 13 Lis, 2011 13:11
heh,ciekawy,ciekawszy najciekawszy!
________________________
Mój obecny project:
Elemental Fantasy
 
 
kobor 



Preferowany:
RPG Maker VX

Dołączył: 27 Kwi 2011
Posty: 11
Wysłany: Nie 27 Lis, 2011 15:39
Dodaj pasek expa i będzie git
________________________
DSJ 4 - Najlepsza gra o skokach narciarskich!!!
 
 
Angius 

Nie wkurzać



Preferowany:
RPG Maker VX

Pomógł: 104 razy
Dołączył: 30 Paź 2010
Posty: 1276
Skąd: wROCK
Wysłany: Nie 27 Lis, 2011 15:42
Nietrudno zauważyć, że autor skryptu nie jest autorem tematu, więc pro14ab raczej go nie zmodyfikuje pod twoje widzimisię.
________________________
"Na trolla pewne są tylko dwie pewne metody, jedna samopowtarzalna i druga, wymagająca przeładowania ręcznego."


 
 
Danbo 



Preferowany:
RPG Maker XP

Pomógł: 1 raz
Dołączył: 26 Paź 2011
Posty: 16
Skąd: Wrocław
Wysłany: Czw 08 Gru, 2011 15:40
Skrypt mi działa dobrze aż do zakończenia 1 walki. Gdy ją skończe gra mi się wyłącza.
Lub zamiast się wyłączyć pojawia sie błąd ????? 'Scene_File'? 219??? TypeError???????? no marshal_dump is defined for class proc
________________________
Już niedłguo.
 
 
kamokeg 



Preferowany:
RPG Maker VXAce

Dołączył: 04 Lut 2012
Posty: 43
Skąd: Włocławek
Wysłany: Pią 13 Kwi, 2012 14:43
Czemu wszyscy tak bardzo potrzebują expa??? ja np. w ogóle go nie mam w grze więc dla mnie git. Oceniam na 8/10
________________________
 
 
tracersgta 




Preferowany:
RPG Maker VX

Pomógł: 45 razy
Dołączył: 10 Sty 2011
Posty: 612
Skąd: mam wiedzieć?
Wysłany: Pią 13 Kwi, 2012 16:06
Ponieważ doświadczenie to STAŁY aspekt gry RPG? Jeżeli nie robisz doświadczenia w swojej grze, to nie robisz gry RPG...
________________________
I'm a tiger! I roar. I hunt, I climb, I eat, I wash, I sleep!

Gość, jeżeli pomogłem daj "Pomógł" ;-)
 
 
 
Wyświetl posty z ostatnich:   
Odpowiedz do tematu
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Nie możesz załączać plików na tym forum
Możesz ściągać załączniki na tym forum
Dodaj temat do Ulubionych
Wersja do druku

Skocz do:  

Powered by phpBB modified by Przemo © 2003 phpBB Group | Template Klam by Ayene