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

Project1

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

[已经过期] 请人帮忙看下这个脚本是做什么的

[复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
182 小时
注册时间
2009-4-22
帖子
208
跳转到指定楼层
1
发表于 2012-7-9 18:37:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 gz29767562 于 2012-7-9 18:38 编辑
  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
复制代码
我不知道这个脚本是做什么的,希望大家能告诉我下,谢谢了
似乎还有段
  1. #==============================================================================
  2. # Compatibility Patch :                                          v1.1 (1/15/12)
  3. #   YEA Battle Engine + KMS Generic Gauge
  4. #==============================================================================
  5. # Script by:
  6. #     Mr. Bubble
  7. #--------------------------------------------------------------------------
  8. # Place this script below both YEA Battle Engine and Generic Gauge in
  9. # the script edtior.
  10. #==============================================================================

  11. $imported = {} if $imported.nil?
  12. $kms_imported = {} if $kms_imported.nil?

  13. class Window_BattleStatus < Window_Selectable
  14.   if $imported["YEA-BattleEngine"] && $kms_imported["GenericGauge"]
  15.   #--------------------------------------------------------------------------
  16.   # overwrite method: draw_actor_hp
  17.   #--------------------------------------------------------------------------
  18.   def draw_actor_hp(actor, dx, dy, width = 124)
  19.     super(actor, dx, dy, width - 4)
  20.   end
  21.    
  22.   #--------------------------------------------------------------------------
  23.   # overwrite method: draw_actor_mp
  24.   #--------------------------------------------------------------------------
  25.   def draw_actor_mp(actor, dx, dy, width = 124)
  26.     super(actor, dx, dy, width - 4)
  27.   end
  28.    
  29.   #--------------------------------------------------------------------------
  30.   # overwrite method: draw_actor_tp
  31.   #--------------------------------------------------------------------------
  32.   def draw_actor_tp(actor, dx, dy, width = 124)
  33.     super(actor, dx, dy, width - 4)
  34.   end
  35.   
  36.   end # if $imported
  37. end
复制代码

Lv1.梦旅人

梦石
0
星屑
49
在线时间
342 小时
注册时间
2012-3-18
帖子
114
2
发表于 2012-7-9 23:21:03 | 只看该作者
似乎像是五人战斗脚本和脸图战斗脚本啊...看着像...我脚本不怎么行...似乎是这两个脚本...
LZ的脚本从哪找来的?不是应该是有说明的么...
南村群童欺我老无力、啪啪啪啪啪啪啪...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
54
在线时间
434 小时
注册时间
2011-7-9
帖子
161
3
发表于 2012-7-10 02:19:36 | 只看该作者
本帖最后由 s05s0039 于 2012-7-10 02:20 编辑

#  This script provides groundwork code for simple gauge graphics based
#  off images placed in the Graphics/System folder. By default, this script
#  provides gauges for HP, MP, TP, and EXP.

http://translate.google.cn/?sourceid=cnhp/
D
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-16 14:01

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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