XP 스크립트

유명한 톱니바퀴성의 게이지 스크립트를 개량한 것입니다. (톱니바퀴성 게이지 스크립트가 게이지 하나당 100줄 가까이 먹으니......)  기존 게이지 스크립트 대신 사용하면 됩니다.


#==============================================================================
# ** COGWHEEL Plug 'n' Play Menu Bars (based on Syvkal's revisions)
#-------------------------------------------------------------------------------
# by DerVVulfman
# Version 1.1
# 06-28-06
#------------------------------------------------------------------------------
# This is a revision of Cogwheel's famous bargraph system, now set as an inser-
# table script to display bargraphs behind values in the menus.
#
# To prevent conflict with Cogwheel's RTAB system, two key definitions have been
# renamed: "gauge_rect" to "cw_gauge" & "gradation_rect" to "cw_grad_rect."
#
#
# Affected Systems:  Main Menu
#                    Skill Menu
#                    Status Menu
#                    Hero Select Menu (for Items & Skills)
#                    Equipment Menu
#                    BattleStatus Menu
#                   
# The system uses a series of CONSTANTS that can be edited here.  They control
# the basic gauge colors and the manner the gauge is filled:

  # Gauge Border Colors
    COG_COLOR1 = Color.new(0, 0, 0, 192)        # Outer Border
    COG_COLOR2 = Color.new(255, 255, 192, 192)  # Inner Border
  # Gauge Empty filler
    COG_COLOR3 = Color.new(0, 0, 0, 192)        # Half of Inner Shading
    COG_COLOR4 = Color.new(64, 0, 0, 192)        # Half of Inner Shading
  # Alignment
    COG_ALIGN1 = 1    # Type 1: (0: Left / 1: Center / 2: Right Justify)
    COG_ALIGN2 = 2    # Type 2: (0: Upper / 1: Central / 2: Lower)
    COG_ALIGN3 = 0    # FILL ALIGNMENT (0: Left Justify / 1: Right Justify)
  # Gauge Settings
    COG_GRADE1 = 1    # EMPTY  gauge (0: Side / 1: Vertical / 2: Slanted)
    COG_GRADE2 = 0    # FILLER gauge (0: Side / 1: Vertical / 2: Slanted)


#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
#  This class handles the actor. It's used within the Game_Actors class
#  ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Get EXP - numeric for calculations
  #-------------------------------------------------------------------------- 
  def now_exp
  return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get Next Level EXP - numeric for calculations
  #--------------------------------------------------------------------------
  def next_exp
  return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end


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

class Window_Base < Window
 
 
  #--------------------------------------------------------------------------
  # * Draw EXP w/ Bars
  #    actor : actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #--------------------------------------------------------------------------
  alias draw_actor_exp_original draw_actor_exp
  def draw_actor_exp(actor, x, y, width = 204)
    if actor.next_exp != 0
      rate = actor.now_exp.to_f / actor.next_exp
    else
      rate = 1
    end
    # Calculate Bar Gradiation
    if actor.next_exp != 0
      rate = actor.now_exp.to_f / actor.next_exp
    else
      rate = 1
    end
    # Adjust Bar Color based on Gradiation
    color1 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
    color2 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
    # Calculate Bar Width
    if actor.next_exp != 0
      exp = width * actor.now_exp / actor.next_exp
    else
      exp = width
    end
    # Draw Bar Graph
    cw_gauge(x, y + 25, width, 10, exp, color1, color2)
    # Call original EXP               
    draw_actor_exp_original(actor, x, y)
  end 
 
  #--------------------------------------------------------------------------
  # * Draw HP w/ Bars
  #    actor : actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #    width : draw spot width
  #--------------------------------------------------------------------------
  alias draw_actor_hp_original draw_actor_hp
  def draw_actor_hp(actor, x, y, width = 144)
    # Calculate Bar Gradiation
    if actor.maxhp != 0
      rate = actor.hp.to_f / actor.maxhp
    else
      rate = 0
    end
    # Adjust Bar Color based on Gradiation
    color1 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
    color2 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
    # Calculate Bar Width
    if actor.maxhp != 0
      hp = width * actor.hp / actor.maxhp
    else
      hp = 0
    end
    # Draw Bar Graph
    cw_gauge(x, y + 25, width, 10, hp, color1, color2)
    # Call original HP
    draw_actor_hp_original(actor, x, y, width)
  end

  #--------------------------------------------------------------------------
  # * Draw SP w/ Bars
  #    actor : actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #    width : draw spot width
  #--------------------------------------------------------------------------
  alias draw_actor_sp_original draw_actor_sp
  def draw_actor_sp(actor, x, y, width = 144)
    # Calculate Bar Gradiation
    if actor.maxsp != 0
      rate = actor.sp.to_f / actor.maxsp
    else
      rate = 1
    end 
    # Adjust Bar Color based on Gradiation
    color1 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
    color2 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
    # Calculate Bar Width
    if actor.maxsp != 0
      sp = width * actor.sp / actor.maxsp
    else
      sp = width 
    end
    # Draw Bar Graph
    cw_gauge(x + width * 0 / 100, y + 25, width, 10, sp, color1, color2)
    # Call original SP               
    draw_actor_sp_original(actor, x, y, width)
  end

  #--------------------------------------------------------------------------
  # * Draw Parameter w/ Bars
  #    actor : actor
  #    x    : draw spot x-coordinate
  #    y    : draw spot y-coordinate
  #    type  : parameter type (0-6)
  #--------------------------------------------------------------------------
  alias draw_actor_parameter_original draw_actor_parameter
  def draw_actor_parameter(actor, x, y, type)
    # Choose Color & Parameter Type
    case type
    when 0
      e1 = actor.atk
      c6 = Color.new(253, 53, 56, 192)
      c5 = Color.new(242, 2, 6, 192)
    when 1
      e1 = actor.pdef
      c6 = Color.new(238, 254, 124, 192)
      c5 = Color.new(228, 253, 48, 192)
    when 2
      e1 = actor.mdef
      c6 = Color.new(150, 37, 184, 192)
      c5 = Color.new(170, 57, 204, 192)
    when 3
      e1 = actor.str
      c6 = Color.new(253, 163, 33, 192)
      c5 = Color.new(254, 209, 154, 192)
    when 4
      e1 = actor.dex
      c6 = Color.new(255, 255, 255, 192)
      c5 = Color.new(222, 222, 222, 192)
    when 5
      e1 = actor.agi
      c6 = Color.new(124, 254, 155, 192)
      c5 = Color.new(33, 253, 86, 192)
    when 6
      e1 = actor.int
      c6 = Color.new(119, 203, 254, 192)
      c5 = Color.new(8, 160, 253, 192)
    end
    # Calculate Bar Gradiation
    e2 = 999
    if e1.to_f != 0
      rate = e1.to_f / e2.to_f
    else
      rate = 1
    end
    # Adjust Bar Color based on Gradiation & Parameter Type
    for i in 0..7
      r = c6.red * rate
      g = (c6.green - 10) * rate
      b = c6.blue  * rate
      a = c6.alpha
    end
    # Calculate Bar Width
    width = 168
    if e1.to_f != 0
      par = width * e1.to_f / e2.to_f
    else
      par = width
    end
    # Equipment Calc Fix   
    case type
    when 0
      if e1 == 0
        par = 0
      end
    when 1
      if e1 == 0
        par = 0
      end
    when 2
      if e1 == 0
        par = 0
      end
    end
    # Draw Bar Graph
    cw_gauge(x , y + 25, width, 7, par, c5, Color.new(r, g, b, a))
    # Call Original Parameter           
    draw_actor_parameter_original(actor, x, y, type)
  end

  #--------------------------------------------------------------------------
  # * Gauge Rectangle (New to Class)
  #--------------------------------------------------------------------------
  def cw_gauge(x, y, width, height, gauge, color1, color2)

    # Use Cogwheel PRESETS
    color3 = COG_COLOR1
    color4 = COG_COLOR2
    color5 = COG_COLOR3
    color6 = COG_COLOR4
    align1 = COG_ALIGN1
    align2 = COG_ALIGN2
    align3 = COG_ALIGN3
    grade1 = COG_GRADE1
    grade2 = COG_GRADE2
   
    # Create Rectangle Width based on gauge max.
    rect_width = width
   
    case align1
    when 1
      x += (rect_width - width) / 2
    when 2
      x += rect_width - width
    end
    case align2
    when 1
      y -= height / 2
    when 2
      y -= height
    end
    self.contents.fill_rect(x, y, width, height, color3)
    self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color4)
    if align3 == 0
      if grade1 == 2
        grade1 = 3
      end
      if grade2 == 2
        grade2 = 3
      end
    end
    if (align3 == 1 and grade1 == 0) or grade1 > 0
      color = color5
      color5 = color6
      color6 = color
    end
    if (align3 == 1 and grade2 == 0) or grade2 > 0
      color = color1
      color1 = color2
      color2 = color
    end
    self.contents.cw_grad_rect(x + 2, y + 2, width - 4, height - 4, color5, color6, grade1)
    if align3 == 1
      x += width - gauge
    end
    self.contents.cw_grad_rect(x + 2, y + 2, gauge - 4, height - 4, color1, color2, grade2)
  end
 
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end


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

  #--------------------------------------------------------------------------
  # * Gradation Rectangle
  #--------------------------------------------------------------------------
  def cw_grad_rect(x, y, width, height, color3, color4, align = 0)
  if align == 0
    for i in x...x + width
      red  = color3.red + (color4.red - color3.red) * (i - x) / (width - 1)
      green = color3.green +
              (color4.green - color3.green) * (i - x) / (width - 1)
      blue  = color3.blue +
              (color4.blue - color3.blue) * (i - x) / (width - 1)
      alpha = color3.alpha +
              (color4.alpha - color3.alpha) * (i - x) / (width - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(i, y, 1, height, color)
    end
  elsif align == 1
    for i in y...y + height
      red  = color3.red +
              (color4.red - color3.red) * (i - y) / (height - 1)
      green = color3.green +
              (color4.green - color3.green) * (i - y) / (height - 1)
      blue  = color3.blue +
              (color4.blue - color3.blue) * (i - y) / (height - 1)
      alpha = color3.alpha +
              (color4.alpha - color3.alpha) * (i - y) / (height - 1)
      color = Color.new(red, green, blue, alpha)
      fill_rect(x, i, width, 1, color)
    end
  elsif align == 2
    for i in x...x + width
      for j in y...y + height
        red  = color3.red + (color4.red - color3.red) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color3.green + (color4.green - color3.green) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color3.blue + (color4.blue - color3.blue) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color3.alpha + (color4.alpha - color3.alpha) *
                ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  elsif align == 3
    for i in x...x + width
      for j in y...y + height
        red  = color3.red + (color4.red - color3.red) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        green = color3.green + (color4.green - color3.green) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        blue  = color3.blue + (color4.blue - color3.blue) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        alpha = color3.alpha + (color4.alpha - color3.alpha) *
              ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
        color = Color.new(red, green, blue, alpha)
        set_pixel(i, j, color)
      end
    end
  end
 end
 
  #--------------------------------------------------------------------------
  # * End of Class
  #--------------------------------------------------------------------------
end

Who's 백호

?

이상혁입니다.

http://elab.kr

Comment '2'

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6203
88 메뉴 메이플스토리처럼 메뉴를^^ 57 file 딸기님 2010.07.13 7145
87 메뉴 온라인메뉴처럼!! 메이플 메뉴처럼!! 변신~스크립트 33 WMN 2008.03.17 6824
86 메뉴 새로운 메뉴 15 file 또라에몽 2010.07.17 5307
85 메뉴 제가추천하는 메뉴스크립트 11 file 백호 2009.02.22 5299
84 메뉴 1인 캐릭터 메뉴 스크립트 27 file - 하늘 - 2009.08.06 4790
83 메뉴 메뉴에 그림넣기 4 file 백호 2009.02.22 4415
82 메뉴 기본메뉴 뜯어고친것. (스샷추가) 6 file 백호 2009.02.22 4315
81 메뉴 메뉴를 바꾸는 스크립트 14 №1 2012.08.04 4214
80 메뉴 3D Menu Script 7 현문 2010.10.06 4079
79 메뉴 [메뉴] 간단한 형식의 CoaMenu2Scroll 버젼 20 file 코아 코스튬 2010.10.24 3527
78 메뉴 링 메뉴 16 Neowitch* 2008.04.18 3478
77 메뉴 자작 메뉴 스크립트들(L's Simple CMS and menu scenes) (SDK 호환?) 10 Alkaid 2010.09.02 3461
76 메뉴 스탯올리기 시스템 (액알가능) 27 file 백호 2009.02.22 3406
75 메뉴 [자작]명성치 사용 스크립트 16 Rainsy 2009.03.22 3390
74 메뉴 메뉴화면에 '해야 할 일' 알려주는 창 넣기 11 하진 2012.04.23 3257
73 메뉴 파이널 판타지 7 스타일 메뉴 7 아방스 2009.01.12 3238
72 메뉴 메뉴등에서 움직이는 엑터 9 file 백호 2009.02.22 3164
71 메뉴 메뉴에 얼굴 그래픽 표시 4 file 백호 2009.02.21 3113
70 메뉴 제가 쓰고있는 메뉴 13 file 백호 2009.02.21 3030
69 메뉴 링 메뉴 소지금,플레이시간 추가 버젼 17 Neowitch* 2008.04.20 3022
Board Pagination Prev 1 2 3 4 5 Next
/ 5