设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 5163|回复: 10
打印 上一主题 下一主题

[已经解决] 血条美化

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
107 小时
注册时间
2012-8-20
帖子
54
跳转到指定楼层
1
发表于 2013-4-22 08:51:00 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如何在脚本中给血魔条加上一个值槽?用图片表示的槽。

Lv3.寻梦者

梦石
0
星屑
1882
在线时间
1552 小时
注册时间
2013-4-13
帖子
917
2
发表于 2013-4-22 09:27:20 | 只看该作者
本帖最后由 沉滞的剑 于 2013-4-22 09:30 编辑

RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 绘制值槽
  3.   #     rate   : 比率(1.0 为满值)
  4.   #     color1 : 渐变色的左端
  5.   #     color2 : 渐变色的右端
  6.   #--------------------------------------------------------------------------
  7.   def draw_gauge(x, y, width, rate, color1, color2)
  8.     fill_w = (width * rate).to_i
  9.     gauge_y = y + line_height - 8
  10.     contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  11.     contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  12.   end


Window_Base 里有,所有子类公用

修改一下,加入插入bitmap替代原有的fillrect。
可以修改图片长度达到比例效果,也可以设置透明通道让fill rect代替显示
夏普的道具店

塞露提亚-道具屋的经营妙方同人作品
发布帖:点击这里
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
107 小时
注册时间
2012-8-20
帖子
54
3
 楼主| 发表于 2013-4-22 09:30:26 | 只看该作者
不是这个,我是要个用图片显示槽值的。就是给gauge一个定义,给他添加一张图片。就像网游中的血条一样。有个框框。

点评

图片中间是透明的对吧?  发表于 2013-4-22 10:02
我不知道那个图片是什么样的,是一个框么?你在这个函数内部添加图片,然后修改rect当槽值不行么?  发表于 2013-4-22 10:01
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
107 小时
注册时间
2012-8-20
帖子
54
4
 楼主| 发表于 2013-4-22 12:41:27 | 只看该作者
千古一帝 发表于 2013-4-22 09:30
不是这个,我是要个用图片显示槽值的。就是给gauge一个定义,给他添加一张图片。就像网游中的血条一样。有 ...

不好意思,应该是你说的那种。不过不知道怎么改,能发个脚本吗?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4557
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

5
发表于 2013-4-22 12:58:45 | 只看该作者
如果只是加一个框的话应该用不着图片的吧。
  1. #==============================================================================
  2. # F01 - 细节美化 - By芙蕾娅
  3. #------------------------------------------------------------------------------
  4. #  ★ - 新增  ☆ - 修改  ■ - 删除 ● - 无变更
  5. #==============================================================================
  6. module Freya
  7.   # 值槽的种类
  8.   # 0 = 默认
  9.   # 1 = 描绘边框
  10.   # 2 = 渐变
  11.   # 3 = 描绘边框 + 渐变
  12.   Gauge_Type = 3
  13. end
  14. #==============================================================================
  15. # ■ Window_Base
  16. #------------------------------------------------------------------------------
  17. #  游戏中所有窗口的父类
  18. #==============================================================================
  19. class Window_Base < Window
  20.   #--------------------------------------------------------------------------
  21.   # ☆ 放大字体尺寸
  22.   #    放大字体尺寸从8更改为4
  23.   #--------------------------------------------------------------------------
  24.   def make_font_bigger
  25.     contents.font.size += 4 if contents.font.size <= 64
  26.   end
  27.   #--------------------------------------------------------------------------
  28.   # ☆ 缩小字体尺寸
  29.   #    缩小字体尺寸从8更改为4
  30.   #--------------------------------------------------------------------------
  31.   def make_font_smaller
  32.     contents.font.size -= 4 if contents.font.size >= 16
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ☆ 绘制值槽
  36.   #     rate   : 比率(1.0 为满值)
  37.   #     color1 : 渐变色的左端
  38.   #     color2 : 渐变色的右端
  39.   #    增加了绘制种类
  40.   #--------------------------------------------------------------------------
  41.   def draw_gauge(x, y, width, rate, color1, color2)
  42.     if Freya::Gauge_Type == 0
  43.       fill_w = (width * rate).to_i
  44.       gauge_y = y + line_height - 8
  45.       contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  46.       contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
  47.     elsif Freya::Gauge_Type == 1
  48.       fill_w = ((width - 2) * rate).to_i
  49.       gauge_y = y + line_height - 8
  50.       contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  51.       contents.gradient_fill_rect(x + 1, gauge_y + 1, fill_w, 4, color1, color2)
  52.     elsif Freya::Gauge_Type == 2
  53.       fill_w = ((width) * rate).to_i
  54.       gauge_y = y + line_height - 8
  55.       contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  56.       contents.gradient_fill_rect(x, gauge_y, fill_w / 2, 6, color1, color2)
  57.       contents.gradient_fill_rect(x + fill_w / 2, gauge_y, fill_w / 2, 6, color2, color1)
  58.     elsif Freya::Gauge_Type == 3
  59.       fill_w = ((width - 2) * rate).to_i
  60.       gauge_y = y + line_height - 8
  61.       contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
  62.       contents.gradient_fill_rect(x + 1, gauge_y + 1, fill_w / 2, 4, color1, color2)
  63.       contents.gradient_fill_rect(x + 1 + fill_w / 2, gauge_y + 1, fill_w / 2, 4, color2, color1)
  64.     end
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ☆ 以 当前值/最大值 这样的分数形式绘制当前值和最大值
  68.   #     current : 当前值
  69.   #     max     : 最大值
  70.   #     color1  : 当前值的颜色
  71.   #     color2  : 最大值的颜色
  72.   #    稍微缩小字体大小,移动一些坐标
  73.   #--------------------------------------------------------------------------
  74.   def draw_current_and_max_values(x, y, width, current, max, color1, color2)
  75.     change_color(color1)
  76.     xr = x + width
  77.     contents.font.size = 15
  78.     if width < 96
  79.       draw_text(xr - 40, y, 42, line_height, current, 2)
  80.     else
  81.       draw_text(xr - 92, y, 42, line_height, current, 2)
  82.       change_color(color2)
  83.       draw_text(xr - 52, y, 12, line_height, "/", 2)
  84.       draw_text(xr - 42, y, 42, line_height, max, 2)
  85.     end
  86.     contents.font.size = Font.default_size
  87.   end
  88. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
198 小时
注册时间
2011-7-28
帖子
120
6
发表于 2013-4-22 13:12:03 | 只看该作者
图片的那个谁用的不错~不过用了以后和各种头像战斗脚本有冲突的~因为那些脚本都定义了血条的显示吧~(可能~)我也和你一样找了很久~最后也是放弃那个血条了~
http://rpg.blue/thread-223368-1-1.html  这个贴子里就用了图片血条~我也是这里下的~
其实我想要这个战斗脸图~可惜不论怎么搞也搞不下来~(谁让你什么脚本都不懂啊~!)
嗳~这个血条唯一的问题就是和各种定义了战斗脸图显示血量的冲突~要是不懂脚本看上去是无解了~
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ Draw Generic Gauge - KMS_GenericGauge ◆ VX Ace ◆
  3. #_/    ◇ Last update : 2012/01/15 (TOMY@Kamesoft) ◇
  4. #_/    ◇ Website: http://ytomy.sakura.ne.jp/ ◇
  5. #_/    ◇ Translated by Mr. Bubble ◇
  6. #_/----------------------------------------------------------------------------
  7. #_/  Provides groundwork code for simple image-based gauges.
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  9. #  This script provides groundwork code for simple gauge graphics based
  10. #  off images placed in the Graphics/System folder. By default, this script
  11. #  provides gauges for HP, MP, TP, and EXP.
  12. #
  13. #  Scripters can utilize their own Generic Gauge for their
  14. #  own use. See the "Notes to Scripters" section below the customization
  15. #  section.
  16. #----------------------------------------------------------------------------
  17. #  !! WARNING !!
  18. #  If an error pops up saying "wrong number of arguments",
  19. #  please post in the topic you got this script in and ask for a
  20. #  compatibility patch with the other custom script you're trying to
  21. #  use.
  22. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  23. #==============================================================================
  24. # ★ BEGIN Setting ★
  25. #==============================================================================

  26. module KMS_GenericGauge
  27.   # * Gauge File Names
  28.   #   Images must be placed in the "Graphics/System" folder of your project
  29.   HP_IMAGE  = "GaugeHP"   # HP
  30.   MP_IMAGE  = "GaugeMP"   # MP
  31.   TP_IMAGE  = "GaugeTP"   # TP
  32.   EXP_IMAGE = "GaugeEXP"  # EXP

  33.   # * Gauge Position Offset [x, y]
  34.   HP_OFFSET  = [-23, -2]  # HP
  35.   MP_OFFSET  = [-23, -2]  # MP
  36.   TP_OFFSET  = [-23, -2]  # TP
  37.   EXP_OFFSET = [-23, -2]  # EXP

  38.   # * Gauge Length Adjustment
  39.   HP_LENGTH  = -4  # HP
  40.   MP_LENGTH  = -4  # MP
  41.   TP_LENGTH  = -4  # TP
  42.   EXP_LENGTH = -4  # EXP

  43.   # * Gauge Slope
  44.   #   Must be between -89 ~ 89 degrees
  45.   HP_SLOPE  = 30  # HP
  46.   MP_SLOPE  = 30  # MP
  47.   TP_SLOPE  = 30  # TP
  48.   EXP_SLOPE = 30  # EXP
  49. end

  50. #==============================================================================
  51. # ☆ END Setting ☆
  52. #==============================================================================

  53. $kms_imported = {} if $kms_imported == nil
  54. $kms_imported["GenericGauge"] = true

  55. # *****************************************************************************

  56.   #--------------------------------------------------------------------------
  57.   # Notes to Scripters
  58.   #--------------------------------------------------------------------------
  59.   # Drawing your own custom gauge within a window can be done by using a single
  60.   # method:
  61.   #
  62.   #   draw_gauge(file, x, y, width, rate, offset, len_offset,
  63.   #     slope, gauge_type = :normal)
  64.   #
  65.   # ++ Draw Generic Gauge Arguments
  66.   #     file       : Gauge image filename
  67.   #     x, y       : x, y draw coordinates
  68.   #     width      : Gauge width
  69.   #     rate       : Gauge fill ratio (0.0 ~ 1.0)
  70.   #     offset     : Gauge coordinate adjustment [x, y]
  71.   #     len_offset : Length Adjustment
  72.   #     slope      : Gauge slope degree (-89~89)
  73.   #     gauge_type : Gauge type ( :normal , :decrease , :increase )
  74.   #--------------------------------------------------------------------------
  75.   # gauge_type determines how the gauge fills depending on the current
  76.   # value of the gauge.
  77.   #--------------------------------------------------------------------------
  78.   # This script overwrites Window_Base#draw_gauge and adds 2 extra args
  79.   # which will cause compatibility issues with other scripts that uses
  80.   # the default draw_gauge method and args.
  81.   #--------------------------------------------------------------------------

  82. #==============================================================================
  83. # ■ Bitmap
  84. #==============================================================================

  85. unless $kms_imported["BitmapExtension"]
  86. class Bitmap
  87.   #--------------------------------------------------------------------------
  88.   # ○ 平行四辺形転送
  89.   #--------------------------------------------------------------------------
  90.   def skew_blt(x, y, src_bitmap, src_rect, slope, opacity = 255)
  91.     slope = [[slope, -90].max, 90].min
  92.     sh    = src_rect.height
  93.     off  = sh / Math.tan(Math::PI * (90 - slope.abs) / 180.0)
  94.     if slope >= 0
  95.       dx   = x + off.round
  96.       diff = -off / sh
  97.     else
  98.       dx   = x
  99.       diff = off / sh
  100.     end
  101.     rect = Rect.new(src_rect.x, src_rect.y, src_rect.width, 1)

  102.     sh.times { |i|
  103.       blt(dx + (diff * i).round, y + i, src_bitmap, rect, opacity)
  104.       rect.y += 1
  105.     }
  106.   end
  107. end
  108. end

  109. #==============================================================================
  110. # ■ Game_Actor
  111. #==============================================================================

  112. class Game_Actor < Game_Battler
  113.   #--------------------------------------------------------------------------
  114.   # ○ 現在のレベルから次のレベルまでの全必要経験値取得
  115.   #--------------------------------------------------------------------------
  116.   def next_level_exp_full
  117.     return next_level_exp - current_level_exp
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ○ 次のレベルまでの残り経験値取得
  121.   #--------------------------------------------------------------------------
  122.   def next_level_exp_rest
  123.     return next_level_exp - exp
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ○ 次のレベルまでの経験値取得率取得
  127.   #--------------------------------------------------------------------------
  128.   def exp_rate
  129.     diff = [next_level_exp_full, 1].max
  130.     rest = [next_level_exp_rest, 1].max
  131.     return (diff - rest) * 1.0 / diff
  132.   end
  133. end

  134. #==============================================================================
  135. # ■ Window_Base
  136. #==============================================================================

  137. class Window_Base < Window
  138.   #--------------------------------------------------------------------------
  139.   # ○ 定数
  140.   #--------------------------------------------------------------------------
  141.   # ゲージ転送元座標 [x, y]
  142.   GAUGE_SRC_POS = {
  143.     :normal   => [ 0, 24],
  144.     :decrease => [ 0, 48],
  145.     :increase => [72, 48],
  146.   }
  147.   #--------------------------------------------------------------------------
  148.   # ○ クラス変数
  149.   #--------------------------------------------------------------------------
  150.   @@__gauge_buf = Bitmap.new(320, 24)
  151.   #--------------------------------------------------------------------------
  152.   # ○ ゲージ描画
  153.   #     file       : ゲージ画像ファイル名
  154.   #     x, y       : 描画先 X, Y 座標
  155.   #     width      : 幅
  156.   #     ratio      : 割合
  157.   #     offset     : 座標調整 [x, y]
  158.   #     len_offset : 長さ調整
  159.   #     slope      : 傾き
  160.   #     gauge_type : ゲージタイプ
  161.   #--------------------------------------------------------------------------
  162.   def draw_gauge(file, x, y, width, ratio, offset, len_offset, slope,
  163.                  gauge_type = :normal)
  164.     img    = Cache.system(file)
  165.     x     += offset[0]
  166.     y     += offset[1]
  167.     width += len_offset
  168.     draw_gauge_base(img, x, y, width, slope)
  169.     gw = (width * ratio).to_i
  170.     draw_gauge_bar(img, x, y, width, gw, slope, GAUGE_SRC_POS[gauge_type])
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ ゲージベース描画
  174.   #     img   : ゲージ画像
  175.   #     x, y  : 描画先 X, Y 座標
  176.   #     width : 幅
  177.   #     slope : 傾き
  178.   #--------------------------------------------------------------------------
  179.   def draw_gauge_base(img, x, y, width, slope)
  180.     rect = Rect.new(0, 0, 24, 24)
  181.     if slope != 0
  182.       contents.skew_blt(x, y, img, rect, slope)
  183.       rect.x = 96
  184.       contents.skew_blt(x + width + 24, y, img, rect, slope)
  185.       rect.x     = 24
  186.       rect.width = 72
  187.       dest_rect = Rect.new(0, 0, width, 24)
  188.       @@__gauge_buf.clear
  189.       @@__gauge_buf.stretch_blt(dest_rect, img, rect)
  190.       contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
  191.     else
  192.       contents.blt(x, y, img, rect)
  193.       rect.x = 96
  194.       contents.blt(x + width + 24, y, img, rect)
  195.       rect.x     = 24
  196.       rect.width = 72
  197.       dest_rect = Rect.new(x + 24, y, width, 24)
  198.       contents.stretch_blt(dest_rect, img, rect)
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ○ ゲージ内部描画
  203.   #     img     : ゲージ画像
  204.   #     x, y    : 描画先 X, Y 座標
  205.   #     width   : 全体幅
  206.   #     gw      : 内部幅
  207.   #     slope   : 傾き
  208.   #     src_pos : 転送元座標 [x, y]
  209.   #     start   : 開始位置
  210.   #--------------------------------------------------------------------------
  211.   def draw_gauge_bar(img, x, y, width, gw, slope, src_pos, start = 0)
  212.     rect = Rect.new(src_pos[0], src_pos[1], 72, 24)
  213.     dest_rect = Rect.new(0, 0, width, 24)
  214.     @@__gauge_buf.clear
  215.     @@__gauge_buf.stretch_blt(dest_rect, img, rect)
  216.     dest_rect.x     = start
  217.     dest_rect.width = gw
  218.     x += start
  219.     if slope != 0
  220.       contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
  221.     else
  222.       contents.blt(x + 24, y, @@__gauge_buf, dest_rect)
  223.     end
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● HP の描画
  227.   #--------------------------------------------------------------------------
  228.   def draw_actor_hp(actor, x, y, width = 124)
  229.     draw_actor_hp_gauge(actor, x, y, width)
  230.     change_color(system_color)
  231.     draw_text(x, y, 30, line_height, Vocab::hp_a)
  232.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  233.       hp_color(actor), normal_color)
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● MP の描画
  237.   #--------------------------------------------------------------------------
  238.   def draw_actor_mp(actor, x, y, width = 124)
  239.     draw_actor_mp_gauge(actor, x, y, width)
  240.     change_color(system_color)
  241.     draw_text(x, y, 30, line_height, Vocab::mp_a)
  242.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  243.       mp_color(actor), normal_color)
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● TP の描画
  247.   #--------------------------------------------------------------------------
  248.   def draw_actor_tp(actor, x, y, width = 124)
  249.     draw_actor_tp_gauge(actor, x, y, width)
  250.     change_color(system_color)
  251.     draw_text(x, y, 30, line_height, Vocab::tp_a)
  252.     change_color(tp_color(actor))
  253.     draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ HP ゲージの描画
  257.   #     actor : アクター
  258.   #     x, y  : 描画先 X, Y 座標
  259.   #     width : 幅
  260.   #--------------------------------------------------------------------------
  261.   def draw_actor_hp_gauge(actor, x, y, width = 120)
  262.     draw_gauge(KMS_GenericGauge::HP_IMAGE,
  263.       x, y, width, actor.hp_rate,
  264.       KMS_GenericGauge::HP_OFFSET,
  265.       KMS_GenericGauge::HP_LENGTH,
  266.       KMS_GenericGauge::HP_SLOPE
  267.     )
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ MP ゲージの描画
  271.   #     actor : アクター
  272.   #     x, y  : 描画先 X, Y 座標
  273.   #     width : 幅
  274.   #--------------------------------------------------------------------------
  275.   def draw_actor_mp_gauge(actor, x, y, width = 120)
  276.     draw_gauge(KMS_GenericGauge::MP_IMAGE,
  277.       x, y, width, actor.mp_rate,
  278.       KMS_GenericGauge::MP_OFFSET,
  279.       KMS_GenericGauge::MP_LENGTH,
  280.       KMS_GenericGauge::MP_SLOPE
  281.     )
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ○ TP ゲージの描画
  285.   #     actor : アクター
  286.   #     x, y  : 描画先 X, Y 座標
  287.   #     width : 幅
  288.   #--------------------------------------------------------------------------
  289.   def draw_actor_tp_gauge(actor, x, y, width = 120)
  290.     draw_gauge(KMS_GenericGauge::TP_IMAGE,
  291.       x, y, width, actor.tp_rate,
  292.       KMS_GenericGauge::TP_OFFSET,
  293.       KMS_GenericGauge::TP_LENGTH,
  294.       KMS_GenericGauge::TP_SLOPE
  295.     )
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ○ Exp の描画
  299.   #     actor : アクター
  300.   #     x, y  : 描画先 X, Y 座標
  301.   #     width : 幅
  302.   #--------------------------------------------------------------------------
  303.   def draw_actor_exp(actor, x, y, width = 180)
  304.     str = actor.max_level? ? "-------" : actor.exp
  305.     change_color(normal_color)
  306.     draw_text(x, y, width, line_height, str, 2)
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ○ NextExp の描画
  310.   #     actor : アクター
  311.   #     x, y  : 描画先 X, Y 座標
  312.   #     width : 幅
  313.   #--------------------------------------------------------------------------
  314.   def draw_actor_next_exp(actor, x, y, width = 180)
  315.     draw_actor_exp_gauge(actor, x, y, width)
  316.     change_color(system_color)
  317.     draw_text(x, y, 80, line_height, "Next")
  318.     str = actor.max_level? ? "-------" : actor.next_level_exp_rest
  319.     change_color(normal_color)
  320.     draw_text(x, y, width, line_height, str, 2)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ○ Exp ゲージの描画
  324.   #     actor : アクター
  325.   #     x, y  : 描画先 X, Y 座標
  326.   #     width : 幅
  327.   #--------------------------------------------------------------------------
  328.   def draw_actor_exp_gauge(actor, x, y, width = 180)
  329.     draw_gauge(KMS_GenericGauge::EXP_IMAGE,
  330.       x, y, width, actor.exp_rate,
  331.       KMS_GenericGauge::EXP_OFFSET,
  332.       KMS_GenericGauge::EXP_LENGTH,
  333.       KMS_GenericGauge::EXP_SLOPE
  334.     )
  335.   end
  336. end

  337. #==============================================================================
  338. # ■ Window_Status
  339. #==============================================================================

  340. class Window_Status < Window_Selectable
  341.   #--------------------------------------------------------------------------
  342.   # ● 経験値情報の描画
  343.   #--------------------------------------------------------------------------
  344.   def draw_exp_info(x, y)
  345.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  346.     change_color(system_color)
  347.     draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  348.     draw_text(x, y + line_height * 2, 180, line_height, s_next)
  349.     change_color(normal_color)
  350.     draw_actor_exp(     @actor, x, y + line_height * 1)
  351.     draw_actor_next_exp(@actor, x, y + line_height * 3)
  352.   end
  353. end
复制代码
System.zip (3.42 KB, 下载次数: 97)
血条文件~放到G啥玩意的S目录下~其实你放了脚本以后没图他自然就提示路径了~还有这种血条你要会PS按道理应该可以画成各种样子~
所以样式是没有限制的~


回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
107 小时
注册时间
2012-8-20
帖子
54
7
 楼主| 发表于 2013-4-22 13:19:43 | 只看该作者
hcm 发表于 2013-4-22 12:58
如果只是加一个框的话应该用不着图片的吧。

应该是我口述不清楚吧,这次附上图。这是VX的内容,来自《六道》。

gauge.png (253 Bytes, 下载次数: 23)

guage图片

guage图片

QQ截图20130422131127.png (6.36 KB, 下载次数: 21)

没用脚本

没用脚本

QQ截图20130422131258.png (8.03 KB, 下载次数: 22)

用脚本后

用脚本后

QQ截图20130422131709.png (7.85 KB, 下载次数: 22)

脚本

脚本
回复 支持 反对

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4557
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

8
发表于 2013-4-22 13:30:02 | 只看该作者
那就这个吧。
图片为Gauge+HP/MP/TP
不过需要在同一图片的下半部画上血条本身的形状,值槽框在上半部。
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ Draw Generic Gauge - KMS_GenericGauge ◆ VX Ace ◆
  3. #_/    ◇ Last update : 2012/01/15 (TOMY@Kamesoft) ◇
  4. #_/    ◇ Website: http://ytomy.sakura.ne.jp/ ◇
  5. #_/    ◇ Translated by Mr. Bubble ◇
  6. #_/----------------------------------------------------------------------------
  7. #_/  Provides groundwork code for simple image-based gauges.
  8. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  9. #  This script provides groundwork code for simple gauge graphics based
  10. #  off images placed in the Graphics/System folder. By default, this script
  11. #  provides gauges for HP, MP, TP, and EXP.
  12. #
  13. #  Scripters can utilize their own Generic Gauge for their
  14. #  own use. See the "Notes to Scripters" section below the customization
  15. #  section.
  16. #----------------------------------------------------------------------------
  17. #  !! WARNING !!
  18. #  If an error pops up saying "wrong number of arguments",
  19. #  please post in the topic you got this script in and ask for a
  20. #  compatibility patch with the other custom script you're trying to
  21. #  use.
  22. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  23. #==============================================================================
  24. # ★ BEGIN Setting ★
  25. #==============================================================================

  26. module KMS_GenericGauge
  27.   # * Gauge File Names
  28.   #   Images must be placed in the "Graphics/System" folder of your project
  29.   HP_IMAGE  = "GaugeHP"   # HP
  30.   MP_IMAGE  = "GaugeMP"   # MP
  31.   TP_IMAGE  = "GaugeTP"   # TP
  32.   EXP_IMAGE = "GaugeEXP"  # EXP

  33.   # * Gauge Position Offset [x, y]
  34.   HP_OFFSET  = [-23, -2]  # HP
  35.   MP_OFFSET  = [-23, -2]  # MP
  36.   TP_OFFSET  = [-23, -2]  # TP
  37.   EXP_OFFSET = [-23, -2]  # EXP

  38.   # * Gauge Length Adjustment
  39.   HP_LENGTH  = -4  # HP
  40.   MP_LENGTH  = -4  # MP
  41.   TP_LENGTH  = -4  # TP
  42.   EXP_LENGTH = -4  # EXP

  43.   # * Gauge Slope
  44.   #   Must be between -89 ~ 89 degrees
  45.   HP_SLOPE  = 30  # HP
  46.   MP_SLOPE  = 30  # MP
  47.   TP_SLOPE  = 30  # TP
  48.   EXP_SLOPE = 30  # EXP
  49. end

  50. #==============================================================================
  51. # ☆ END Setting ☆
  52. #==============================================================================

  53. $kms_imported = {} if $kms_imported == nil
  54. $kms_imported["GenericGauge"] = true

  55. # *****************************************************************************

  56.   #--------------------------------------------------------------------------
  57.   # Notes to Scripters
  58.   #--------------------------------------------------------------------------
  59.   # Drawing your own custom gauge within a window can be done by using a single
  60.   # method:
  61.   #
  62.   #   draw_gauge(file, x, y, width, rate, offset, len_offset,
  63.   #     slope, gauge_type = :normal)
  64.   #
  65.   # ++ Draw Generic Gauge Arguments
  66.   #     file       : Gauge image filename
  67.   #     x, y       : x, y draw coordinates
  68.   #     width      : Gauge width
  69.   #     rate       : Gauge fill ratio (0.0 ~ 1.0)
  70.   #     offset     : Gauge coordinate adjustment [x, y]
  71.   #     len_offset : Length Adjustment
  72.   #     slope      : Gauge slope degree (-89~89)
  73.   #     gauge_type : Gauge type ( :normal , :decrease , :increase )
  74.   #--------------------------------------------------------------------------
  75.   # gauge_type determines how the gauge fills depending on the current
  76.   # value of the gauge.
  77.   #--------------------------------------------------------------------------
  78.   # This script overwrites Window_Base#draw_gauge and adds 2 extra args
  79.   # which will cause compatibility issues with other scripts that uses
  80.   # the default draw_gauge method and args.
  81.   #--------------------------------------------------------------------------

  82. #==============================================================================
  83. # ■ Bitmap
  84. #==============================================================================

  85. unless $kms_imported["BitmapExtension"]
  86. class Bitmap
  87.   #--------------------------------------------------------------------------
  88.   # ○ 平行四辺形転送
  89.   #--------------------------------------------------------------------------
  90.   def skew_blt(x, y, src_bitmap, src_rect, slope, opacity = 255)
  91.     slope = [[slope, -90].max, 90].min
  92.     sh    = src_rect.height
  93.     off  = sh / Math.tan(Math::PI * (90 - slope.abs) / 180.0)
  94.     if slope >= 0
  95.       dx   = x + off.round
  96.       diff = -off / sh
  97.     else
  98.       dx   = x
  99.       diff = off / sh
  100.     end
  101.     rect = Rect.new(src_rect.x, src_rect.y, src_rect.width, 1)

  102.     sh.times { |i|
  103.       blt(dx + (diff * i).round, y + i, src_bitmap, rect, opacity)
  104.       rect.y += 1
  105.     }
  106.   end
  107. end
  108. end

  109. #==============================================================================
  110. # ■ Game_Actor
  111. #==============================================================================

  112. class Game_Actor < Game_Battler
  113.   #--------------------------------------------------------------------------
  114.   # ○ 現在のレベルから次のレベルまでの全必要経験値取得
  115.   #--------------------------------------------------------------------------
  116.   def next_level_exp_full
  117.     return next_level_exp - current_level_exp
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # ○ 次のレベルまでの残り経験値取得
  121.   #--------------------------------------------------------------------------
  122.   def next_level_exp_rest
  123.     return next_level_exp - exp
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ○ 次のレベルまでの経験値取得率取得
  127.   #--------------------------------------------------------------------------
  128.   def exp_rate
  129.     diff = [next_level_exp_full, 1].max
  130.     rest = [next_level_exp_rest, 1].max
  131.     return (diff - rest) * 1.0 / diff
  132.   end
  133. end

  134. #==============================================================================
  135. # ■ Window_Base
  136. #==============================================================================

  137. class Window_Base < Window
  138.   #--------------------------------------------------------------------------
  139.   # ○ 定数
  140.   #--------------------------------------------------------------------------
  141.   # ゲージ転送元座標 [x, y]
  142.   GAUGE_SRC_POS = {
  143.     :normal   => [ 0, 24],
  144.     :decrease => [ 0, 48],
  145.     :increase => [72, 48],
  146.   }
  147.   #--------------------------------------------------------------------------
  148.   # ○ クラス変数
  149.   #--------------------------------------------------------------------------
  150.   @@__gauge_buf = Bitmap.new(320, 24)
  151.   #--------------------------------------------------------------------------
  152.   # ○ ゲージ描画
  153.   #     file       : ゲージ画像ファイル名
  154.   #     x, y       : 描画先 X, Y 座標
  155.   #     width      : 幅
  156.   #     ratio      : 割合
  157.   #     offset     : 座標調整 [x, y]
  158.   #     len_offset : 長さ調整
  159.   #     slope      : 傾き
  160.   #     gauge_type : ゲージタイプ
  161.   #--------------------------------------------------------------------------
  162.   def draw_gauge(file, x, y, width, ratio, offset, len_offset, slope,
  163.                  gauge_type = :normal)
  164.     img    = Cache.system(file)
  165.     x     += offset[0]
  166.     y     += offset[1]
  167.     width += len_offset
  168.     draw_gauge_base(img, x, y, width, slope)
  169.     gw = (width * ratio).to_i
  170.     draw_gauge_bar(img, x, y, width, gw, slope, GAUGE_SRC_POS[gauge_type])
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ○ ゲージベース描画
  174.   #     img   : ゲージ画像
  175.   #     x, y  : 描画先 X, Y 座標
  176.   #     width : 幅
  177.   #     slope : 傾き
  178.   #--------------------------------------------------------------------------
  179.   def draw_gauge_base(img, x, y, width, slope)
  180.     rect = Rect.new(0, 0, 24, 24)
  181.     if slope != 0
  182.       contents.skew_blt(x, y, img, rect, slope)
  183.       rect.x = 96
  184.       contents.skew_blt(x + width + 24, y, img, rect, slope)
  185.       rect.x     = 24
  186.       rect.width = 72
  187.       dest_rect = Rect.new(0, 0, width, 24)
  188.       @@__gauge_buf.clear
  189.       @@__gauge_buf.stretch_blt(dest_rect, img, rect)
  190.       contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
  191.     else
  192.       contents.blt(x, y, img, rect)
  193.       rect.x = 96
  194.       contents.blt(x + width + 24, y, img, rect)
  195.       rect.x     = 24
  196.       rect.width = 72
  197.       dest_rect = Rect.new(x + 24, y, width, 24)
  198.       contents.stretch_blt(dest_rect, img, rect)
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ○ ゲージ内部描画
  203.   #     img     : ゲージ画像
  204.   #     x, y    : 描画先 X, Y 座標
  205.   #     width   : 全体幅
  206.   #     gw      : 内部幅
  207.   #     slope   : 傾き
  208.   #     src_pos : 転送元座標 [x, y]
  209.   #     start   : 開始位置
  210.   #--------------------------------------------------------------------------
  211.   def draw_gauge_bar(img, x, y, width, gw, slope, src_pos, start = 0)
  212.     rect = Rect.new(src_pos[0], src_pos[1], 72, 24)
  213.     dest_rect = Rect.new(0, 0, width, 24)
  214.     @@__gauge_buf.clear
  215.     @@__gauge_buf.stretch_blt(dest_rect, img, rect)
  216.     dest_rect.x     = start
  217.     dest_rect.width = gw
  218.     x += start
  219.     if slope != 0
  220.       contents.skew_blt(x + 24, y, @@__gauge_buf, dest_rect, slope)
  221.     else
  222.       contents.blt(x + 24, y, @@__gauge_buf, dest_rect)
  223.     end
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # ● HP の描画
  227.   #--------------------------------------------------------------------------
  228.   def draw_actor_hp(actor, x, y, width = 124)
  229.     draw_actor_hp_gauge(actor, x, y, width)
  230.     change_color(system_color)
  231.     draw_text(x, y, 60, line_height, Vocab::hp_a)
  232.     draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
  233.       hp_color(actor), normal_color)
  234.   end
  235.   #--------------------------------------------------------------------------
  236.   # ● MP の描画
  237.   #--------------------------------------------------------------------------
  238.   def draw_actor_mp(actor, x, y, width = 124)
  239.     draw_actor_mp_gauge(actor, x, y, width)
  240.     change_color(system_color)
  241.     draw_text(x, y, 60, line_height, Vocab::mp_a)
  242.     draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
  243.       mp_color(actor), normal_color)
  244.   end
  245.   #--------------------------------------------------------------------------
  246.   # ● TP の描画
  247.   #--------------------------------------------------------------------------
  248.   def draw_actor_tp(actor, x, y, width = 124)
  249.     draw_actor_tp_gauge(actor, x, y, width)
  250.     change_color(system_color)
  251.     draw_text(x, y, 60, line_height, Vocab::tp_a)
  252.     change_color(tp_color(actor))
  253.     draw_text(x + width - 42, y, 42, line_height, actor.tp.to_i, 2)
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ HP ゲージの描画
  257.   #     actor : アクター
  258.   #     x, y  : 描画先 X, Y 座標
  259.   #     width : 幅
  260.   #--------------------------------------------------------------------------
  261.   def draw_actor_hp_gauge(actor, x, y, width = 120)
  262.     draw_gauge(KMS_GenericGauge::HP_IMAGE,
  263.       x, y, width, actor.hp_rate,
  264.       KMS_GenericGauge::HP_OFFSET,
  265.       KMS_GenericGauge::HP_LENGTH,
  266.       KMS_GenericGauge::HP_SLOPE
  267.     )
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ○ MP ゲージの描画
  271.   #     actor : アクター
  272.   #     x, y  : 描画先 X, Y 座標
  273.   #     width : 幅
  274.   #--------------------------------------------------------------------------
  275.   def draw_actor_mp_gauge(actor, x, y, width = 120)
  276.     draw_gauge(KMS_GenericGauge::MP_IMAGE,
  277.       x, y, width, actor.mp_rate,
  278.       KMS_GenericGauge::MP_OFFSET,
  279.       KMS_GenericGauge::MP_LENGTH,
  280.       KMS_GenericGauge::MP_SLOPE
  281.     )
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ○ TP ゲージの描画
  285.   #     actor : アクター
  286.   #     x, y  : 描画先 X, Y 座標
  287.   #     width : 幅
  288.   #--------------------------------------------------------------------------
  289.   def draw_actor_tp_gauge(actor, x, y, width = 120)
  290.     draw_gauge(KMS_GenericGauge::TP_IMAGE,
  291.       x, y, width, actor.tp_rate,
  292.       KMS_GenericGauge::TP_OFFSET,
  293.       KMS_GenericGauge::TP_LENGTH,
  294.       KMS_GenericGauge::TP_SLOPE
  295.     )
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # ○ Exp の描画
  299.   #     actor : アクター
  300.   #     x, y  : 描画先 X, Y 座標
  301.   #     width : 幅
  302.   #--------------------------------------------------------------------------
  303.   def draw_actor_exp(actor, x, y, width = 200)
  304.     str = actor.max_level? ? "-------" : actor.exp
  305.     change_color(normal_color)
  306.     draw_text(x, y, width, line_height, str, 2)
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ○ NextExp の描画
  310.   #     actor : アクター
  311.   #     x, y  : 描画先 X, Y 座標
  312.   #     width : 幅
  313.   #--------------------------------------------------------------------------
  314.   def draw_actor_next_exp(actor, x, y, width = 200)
  315.     draw_actor_exp_gauge(actor, x, y, width)
  316.     change_color(system_color)
  317.     draw_text(x, y, 80, line_height, "Next")
  318.     str = actor.max_level? ? "-------" : actor.next_level_exp_rest
  319.     change_color(normal_color)
  320.     draw_text(x, y, width, line_height, str, 2)
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # ○ Exp ゲージの描画
  324.   #     actor : アクター
  325.   #     x, y  : 描画先 X, Y 座標
  326.   #     width : 幅
  327.   #--------------------------------------------------------------------------
  328.   def draw_actor_exp_gauge(actor, x, y, width = 180)
  329.     draw_gauge(KMS_GenericGauge::EXP_IMAGE,
  330.       x, y, width, actor.exp_rate,
  331.       KMS_GenericGauge::EXP_OFFSET,
  332.       KMS_GenericGauge::EXP_LENGTH,
  333.       KMS_GenericGauge::EXP_SLOPE
  334.     )
  335.   end
  336. end

  337. #==============================================================================
  338. # ■ Window_Status
  339. #==============================================================================

  340. class Window_Status < Window_Selectable
  341.   #--------------------------------------------------------------------------
  342.   # ● 経験値情報の描画
  343.   #--------------------------------------------------------------------------
  344.   def draw_exp_info(x, y)
  345.     s_next = sprintf(Vocab::ExpNext, Vocab::level)
  346.     change_color(system_color)
  347.     draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
  348.     draw_text(x, y + line_height * 2, 180, line_height, s_next)
  349.     change_color(normal_color)
  350.     draw_actor_exp(     @actor, x, y + line_height * 1)
  351.     draw_actor_next_exp(@actor, x, y + line_height * 3)
  352.   end
  353. end
复制代码

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 认可答案 附赠66RPG提供的精美好人卡一张^^.

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
107 小时
注册时间
2012-8-20
帖子
54
9
 楼主| 发表于 2013-4-22 13:38:36 | 只看该作者
hcm 发表于 2013-4-22 13:30
那就这个吧。
图片为Gauge+HP/MP/TP
不过需要在同一图片的下半部画上血条本身的形状,值槽框在上半部。 ...

不知能否就像上面的vx脚本一样直接给guage一个框的定义。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

虚空人形

梦石
0
星屑
4557
在线时间
2037 小时
注册时间
2011-8-11
帖子
3398

贵宾

10
发表于 2013-4-22 13:40:13 | 只看该作者
千古一帝 发表于 2013-4-22 13:38
不知能否就像上面的vx脚本一样直接给guage一个框的定义。

这个没有,不过多画一个矩形不难吧。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-8 07:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表