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

Project1

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

血条脚本怎么在SP显示的下面再加"EXP显示"?

 关闭 [复制链接]

Lv2.观梦者

梦石
0
星屑
253
在线时间
574 小时
注册时间
2006-8-25
帖子
969
跳转到指定楼层
1
发表于 2007-8-25 01:24:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个脚本,在战斗的时候会显示
HP条=========
SP条=========
状态[****]
可以改成
HP条=========
SP条=========
EXP条========
状态[****]
这样吗?
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土

  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base
  11.   #--------------------------------------------------------------------------
  12.   # ● 公開インスタンス変数
  13.   #--------------------------------------------------------------------------
  14.   attr_accessor :update_cp_only # CPメーターのみの更新
  15.   #--------------------------------------------------------------------------
  16.   # ● オブジェクト初期化
  17.   #--------------------------------------------------------------------------
  18.   alias xrxs_bp7_initialize initialize
  19.   def initialize
  20.     # 初期化
  21.     @previous_hp = []
  22.     @previous_sp = []
  23.     # 呼び戻す
  24.     xrxs_bp7_initialize
  25.     # ↓Full-Viewの場合は下二行の # を消してください。
  26.     #self.opacity = 0
  27.     #self.back_opacity = 0
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● リフレッシュ
  31.   #--------------------------------------------------------------------------
  32.   alias xrxs_bp7_refresh refresh
  33.   def refresh
  34.     # CPメーターの更新のみ の場合
  35.     if @update_cp_only
  36.       xrxs_bp7_refresh
  37.       return
  38.     end
  39.     # 変更するものがない場合、飛ばす
  40.     @item_max = $game_party.actors.size
  41.     bool = false
  42.     for i in 0...@item_max
  43.       actor = $game_party.actors[i]
  44.       if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  45.         bool = true
  46.       end
  47.     end
  48.     return if bool == false
  49.     # 描写を開始
  50.     self.contents.clear
  51.     for i in 0...@item_max
  52.       actor = $game_party.actors[i]
  53.       actor_x = i * 160 + 35
  54.       # 歩行キャラグラフィックの描写
  55.       draw_actor_battlegraphic(actor, actor_x - 40, 0)
  56.       # HP/SPメーターの描写
  57.       draw_actor_hp_meter_line(actor, actor_x, 62, 96, 10)
  58.       draw_actor_sp_meter_line(actor, actor_x, 80, 96, 10)
  59.       # HP数値の描写
  60.       self.contents.font.size = 12 # HP/SP数値の文字の大きさ
  61.       self.contents.font.color = Color.new(0,0,0,192)
  62.       self.contents.draw_text(actor_x-2, 56, 96, 24, actor.hp.to_s, 2)
  63.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  64.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  65.       self.contents.draw_text(actor_x-4, 54, 96, 24, actor.hp.to_s, 2)
  66.       # SP数値の描写
  67.       self.contents.font.color = Color.new(0,0,0,192)
  68.       self.contents.draw_text(actor_x-2, 74, 96, 24, actor.sp.to_s, 2)
  69.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  70.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  71.       self.contents.draw_text(actor_x-4, 72, 96, 24, actor.sp.to_s, 2)
  72.       # 用語「HP」と用語「SP」の描写
  73.       self.contents.font.size = 17 # 用語「HP/SP」の文字の大きさ
  74.       self.contents.font.color = Color.new(0,0,0,0)
  75.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  76.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  77.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  78.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.hp)
  79.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.sp)
  80.       # ステートの描写
  81.       draw_actor_state(actor, actor_x - 14, 102)
  82.       # 値を更新
  83.       @previous_hp[i] = actor.hp
  84.       @previous_hp[i] = actor.hp
  85.     end
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Window_Base
  90. #==============================================================================
  91. class Window_Base < Window
  92.   #--------------------------------------------------------------------------
  93.   # ● HPメーター の描画
  94.   #--------------------------------------------------------------------------
  95.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  96.     w = width * actor.hp / [actor.maxhp,1].max
  97.     hp_color_1 = Color.new(255, 255, 0, 192)
  98.     hp_color_2 = Color.new(255, 0, 0, 192)
  99.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  100.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  101.     x -= 1
  102.     y += (height/4).floor
  103.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  104.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  105.     x -= 1
  106.     y += (height/4).ceil
  107.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  108.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  109.     x -= 1
  110.     y += (height/4).ceil
  111.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  112.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● SPメーター の描画
  116.   #--------------------------------------------------------------------------
  117.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  118.     w = width * actor.sp / [actor.maxsp,1].max
  119.     hp_color_1 = Color.new( 0, 255, 255, 192)
  120.     hp_color_2 = Color.new( 0, 0, 255, 192)
  121.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  122.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  123.     x -= 1
  124.     y += (height/4).floor
  125.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  126.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  127.     x -= 1
  128.     y += (height/4).ceil
  129.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  130.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  131.     x -= 1
  132.     y += (height/4).ceil
  133.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  134.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 名前の描画
  138.   #--------------------------------------------------------------------------
  139.   alias xrxs_bp7_draw_actor_name draw_actor_name
  140.   def draw_actor_name(actor, x, y)
  141.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● ステートの描画
  145.   #--------------------------------------------------------------------------
  146.   alias xrxs_bp7_draw_actor_state draw_actor_state
  147.   def draw_actor_state(actor, x, y, width = 120)
  148.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● HP の描画
  152.   #--------------------------------------------------------------------------
  153.   alias xrxs_bp7_draw_actor_hp draw_actor_hp
  154.   def draw_actor_hp(actor, x, y, width = 144)
  155.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● SP の描画
  159.   #--------------------------------------------------------------------------
  160.   alias xrxs_bp7_draw_actor_sp draw_actor_sp
  161.   def draw_actor_sp(actor, x, y, width = 144)
  162.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  163.   end
  164. end
  165. #==============================================================================
  166. # ■ Scene_Battle
  167. #==============================================================================
  168. class Scene_Battle
  169.   #--------------------------------------------------------------------------
  170.   # ● フレーム更新
  171.   #--------------------------------------------------------------------------
  172.   alias xrxs_bp7_update update
  173.   def update
  174.     xrxs_bp7_update
  175.     # メッセージウィンドウ表示中の場合
  176.     if $game_temp.message_window_showing
  177.       @status_window.update_cp_only = true      
  178.     else
  179.       @status_window.update_cp_only = false
  180.     end
  181.   end
  182. end
  183. #==============================================================================
  184. # ◇ 外部ライブラリ
  185. #==============================================================================
  186. class Window_Base
  187.   #--------------------------------------------------------------------------
  188.   # ● ライン描画 軽量版 by 桜雅 在土
  189.   #--------------------------------------------------------------------------
  190.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  191.     # 描写距離の計算。大きめに直角時の長さ。
  192.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  193.     # 描写開始
  194.     for i in 1..distance
  195.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  196.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  197.       self.contents.set_pixel(x, y, start_color)
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● ライン描画 by 桜雅 在土
  202.   #--------------------------------------------------------------------------
  203.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  204.     # 描写距離の計算。大きめに直角時の長さ。
  205.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  206.     # 描写開始
  207.     if end_color == start_color
  208.       for i in 1..distance
  209.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  210.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  211.         if width == 1
  212.           self.contents.set_pixel(x, y, start_color)
  213.         else
  214.           self.contents.fill_rect(x, y, width, width, start_color)
  215.         end
  216.       end
  217.     else
  218.       for i in 1..distance
  219.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  220.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  221.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  222.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  223.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  224.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  225.         if width == 1
  226.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  227.         else
  228.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  229.         end
  230.       end
  231.     end
  232.   end
  233. end


  234. #==============================================================================
  235. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  236. #==============================================================================  
复制代码

Lv2.观梦者

梦石
0
星屑
253
在线时间
574 小时
注册时间
2006-8-25
帖子
969
2
 楼主| 发表于 2007-8-25 01:24:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个脚本,在战斗的时候会显示
HP条=========
SP条=========
状态[****]
可以改成
HP条=========
SP条=========
EXP条========
状态[****]
这样吗?
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土

  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base
  11.   #--------------------------------------------------------------------------
  12.   # ● 公開インスタンス変数
  13.   #--------------------------------------------------------------------------
  14.   attr_accessor :update_cp_only # CPメーターのみの更新
  15.   #--------------------------------------------------------------------------
  16.   # ● オブジェクト初期化
  17.   #--------------------------------------------------------------------------
  18.   alias xrxs_bp7_initialize initialize
  19.   def initialize
  20.     # 初期化
  21.     @previous_hp = []
  22.     @previous_sp = []
  23.     # 呼び戻す
  24.     xrxs_bp7_initialize
  25.     # ↓Full-Viewの場合は下二行の # を消してください。
  26.     #self.opacity = 0
  27.     #self.back_opacity = 0
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● リフレッシュ
  31.   #--------------------------------------------------------------------------
  32.   alias xrxs_bp7_refresh refresh
  33.   def refresh
  34.     # CPメーターの更新のみ の場合
  35.     if @update_cp_only
  36.       xrxs_bp7_refresh
  37.       return
  38.     end
  39.     # 変更するものがない場合、飛ばす
  40.     @item_max = $game_party.actors.size
  41.     bool = false
  42.     for i in 0...@item_max
  43.       actor = $game_party.actors[i]
  44.       if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  45.         bool = true
  46.       end
  47.     end
  48.     return if bool == false
  49.     # 描写を開始
  50.     self.contents.clear
  51.     for i in 0...@item_max
  52.       actor = $game_party.actors[i]
  53.       actor_x = i * 160 + 35
  54.       # 歩行キャラグラフィックの描写
  55.       draw_actor_battlegraphic(actor, actor_x - 40, 0)
  56.       # HP/SPメーターの描写
  57.       draw_actor_hp_meter_line(actor, actor_x, 62, 96, 10)
  58.       draw_actor_sp_meter_line(actor, actor_x, 80, 96, 10)
  59.       # HP数値の描写
  60.       self.contents.font.size = 12 # HP/SP数値の文字の大きさ
  61.       self.contents.font.color = Color.new(0,0,0,192)
  62.       self.contents.draw_text(actor_x-2, 56, 96, 24, actor.hp.to_s, 2)
  63.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  64.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  65.       self.contents.draw_text(actor_x-4, 54, 96, 24, actor.hp.to_s, 2)
  66.       # SP数値の描写
  67.       self.contents.font.color = Color.new(0,0,0,192)
  68.       self.contents.draw_text(actor_x-2, 74, 96, 24, actor.sp.to_s, 2)
  69.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  70.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  71.       self.contents.draw_text(actor_x-4, 72, 96, 24, actor.sp.to_s, 2)
  72.       # 用語「HP」と用語「SP」の描写
  73.       self.contents.font.size = 17 # 用語「HP/SP」の文字の大きさ
  74.       self.contents.font.color = Color.new(0,0,0,0)
  75.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  76.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  77.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  78.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.hp)
  79.       self.contents.draw_text(actor_x, 200, 196, 24, $data_system.words.sp)
  80.       # ステートの描写
  81.       draw_actor_state(actor, actor_x - 14, 102)
  82.       # 値を更新
  83.       @previous_hp[i] = actor.hp
  84.       @previous_hp[i] = actor.hp
  85.     end
  86.   end
  87. end
  88. #==============================================================================
  89. # ■ Window_Base
  90. #==============================================================================
  91. class Window_Base < Window
  92.   #--------------------------------------------------------------------------
  93.   # ● HPメーター の描画
  94.   #--------------------------------------------------------------------------
  95.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  96.     w = width * actor.hp / [actor.maxhp,1].max
  97.     hp_color_1 = Color.new(255, 255, 0, 192)
  98.     hp_color_2 = Color.new(255, 0, 0, 192)
  99.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  100.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  101.     x -= 1
  102.     y += (height/4).floor
  103.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  104.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  105.     x -= 1
  106.     y += (height/4).ceil
  107.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  108.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  109.     x -= 1
  110.     y += (height/4).ceil
  111.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  112.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● SPメーター の描画
  116.   #--------------------------------------------------------------------------
  117.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  118.     w = width * actor.sp / [actor.maxsp,1].max
  119.     hp_color_1 = Color.new( 0, 255, 255, 192)
  120.     hp_color_2 = Color.new( 0, 0, 255, 192)
  121.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  122.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  123.     x -= 1
  124.     y += (height/4).floor
  125.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  126.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  127.     x -= 1
  128.     y += (height/4).ceil
  129.     self.contents.fill_rect(x, y, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  130.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  131.     x -= 1
  132.     y += (height/4).ceil
  133.     self.contents.fill_rect(x, y, width, (height/4).floor, Color.new(0, 0, 0, 128))
  134.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  135.   end
  136.   #--------------------------------------------------------------------------
  137.   # ● 名前の描画
  138.   #--------------------------------------------------------------------------
  139.   alias xrxs_bp7_draw_actor_name draw_actor_name
  140.   def draw_actor_name(actor, x, y)
  141.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● ステートの描画
  145.   #--------------------------------------------------------------------------
  146.   alias xrxs_bp7_draw_actor_state draw_actor_state
  147.   def draw_actor_state(actor, x, y, width = 120)
  148.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● HP の描画
  152.   #--------------------------------------------------------------------------
  153.   alias xrxs_bp7_draw_actor_hp draw_actor_hp
  154.   def draw_actor_hp(actor, x, y, width = 144)
  155.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● SP の描画
  159.   #--------------------------------------------------------------------------
  160.   alias xrxs_bp7_draw_actor_sp draw_actor_sp
  161.   def draw_actor_sp(actor, x, y, width = 144)
  162.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  163.   end
  164. end
  165. #==============================================================================
  166. # ■ Scene_Battle
  167. #==============================================================================
  168. class Scene_Battle
  169.   #--------------------------------------------------------------------------
  170.   # ● フレーム更新
  171.   #--------------------------------------------------------------------------
  172.   alias xrxs_bp7_update update
  173.   def update
  174.     xrxs_bp7_update
  175.     # メッセージウィンドウ表示中の場合
  176.     if $game_temp.message_window_showing
  177.       @status_window.update_cp_only = true      
  178.     else
  179.       @status_window.update_cp_only = false
  180.     end
  181.   end
  182. end
  183. #==============================================================================
  184. # ◇ 外部ライブラリ
  185. #==============================================================================
  186. class Window_Base
  187.   #--------------------------------------------------------------------------
  188.   # ● ライン描画 軽量版 by 桜雅 在土
  189.   #--------------------------------------------------------------------------
  190.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  191.     # 描写距離の計算。大きめに直角時の長さ。
  192.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  193.     # 描写開始
  194.     for i in 1..distance
  195.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  196.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  197.       self.contents.set_pixel(x, y, start_color)
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● ライン描画 by 桜雅 在土
  202.   #--------------------------------------------------------------------------
  203.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  204.     # 描写距離の計算。大きめに直角時の長さ。
  205.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  206.     # 描写開始
  207.     if end_color == start_color
  208.       for i in 1..distance
  209.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  210.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  211.         if width == 1
  212.           self.contents.set_pixel(x, y, start_color)
  213.         else
  214.           self.contents.fill_rect(x, y, width, width, start_color)
  215.         end
  216.       end
  217.     else
  218.       for i in 1..distance
  219.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  220.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  221.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  222.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  223.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  224.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  225.         if width == 1
  226.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  227.         else
  228.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  229.         end
  230.       end
  231.     end
  232.   end
  233. end


  234. #==============================================================================
  235. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  236. #==============================================================================  
复制代码

Lv2.观梦者

梦石
0
星屑
253
在线时间
574 小时
注册时间
2006-8-25
帖子
969
3
 楼主| 发表于 2007-8-25 21:44:54 | 只看该作者
游戏急需....请各位大大帮忙写出来吧....
下面是一个有关显示HPSPEXP的脚本...希望能做参考....

  1. #################################################################
  2. #地图界面的状态显示脚本(暴动冲锋NANKONGX/坂崎由丽NKX注释)
  3. #本脚本来自66rpg.com,使用时请带上本信息。
  4. #关于本脚本的使用:
  5. # 本状态脚本是受开关控制的,默认开关编号为2,在脚本里可以修改。
  6. # 一旦制定开关打开,在普通地图显示的状态下屏幕下方会显示主角状态。
  7. #################################################################

  8. #==============================================================================
  9. # ■ Scene_Map
  10. #------------------------------------------------------------------------------
  11. #  处理地图画面的类。
  12. #==============================================================================
  13. class Scene_Map
  14.   #--------------------------------------------------------------------------
  15.   # ● 在这里控制脚本的属性
  16.   #--------------------------------------------------------------------------
  17.   SWITCH_ID = 2 #在这里设定开关的编号……
  18.   $center_hud = true #这里决定是否将HUD(状态窗口)居中显示……
  19.   #--------------------------------------------------------------------------
  20.   # ● 初始化别名
  21.   #--------------------------------------------------------------------------
  22.   alias raz_hud_main main
  23.   alias raz_hud_update update
  24.   #--------------------------------------------------------------------------
  25.   # ● 主进程
  26.   #--------------------------------------------------------------------------  
  27.   def main
  28.     @size = $game_party.actors.size
  29.     raz_hud_main
  30.     @hud_window.dispose
  31.     for i in 0...$game_party.actors.size
  32.       @hud_dummy[i].dispose
  33.     end #for
  34.   end #def
  35.   #--------------------------------------------------------------------------
  36.   # ● 刷新画面
  37.   #--------------------------------------------------------------------------  
  38.   def update
  39.     if @size != $game_party.actors.size
  40.       @hud_window.refresh
  41.       show_window
  42.     end #if
  43.     if @hud != true
  44.       main_window
  45.     end #if
  46.     turn_hud_on_off
  47.     @hud_window.update
  48.     raz_hud_update
  49.   end #def
  50.   #--------------------------------------------------------------------------
  51.   # ● 与状态窗口的显示行为相关的语句
  52.   #--------------------------------------------------------------------------   
  53.   def show_window
  54.     @size = $game_party.actors.size
  55.     for i in 0..3
  56.       @hud_dummy[i].visible = ($game_party.actors[i] != nil)
  57.     end #for
  58.   end #def
  59.   #--------------------------------------------------------------------------
  60.   # ● 与状态窗口的创建相关的语句
  61.   #--------------------------------------------------------------------------     
  62.   def main_window
  63.     @opacity = 200
  64.     @hud_dummy = []
  65.     for i in 0...4
  66.       y = $game_party.actors.size - 1
  67.       x = 240 - (y * 80)
  68.       if $center_hud == true
  69.         @hud_dummy[i] = Window_Base.new(160 * i + x, 372,160, 108)
  70.       else
  71.         @hud_dummy[i] = Window_Base.new(160 * i, 372,160, 108)
  72.       end #if
  73.       @hud_dummy[i].opacity = @opacity
  74.       @hud_dummy[i].visible = false
  75.     end #for
  76.     @hud_window = Window_HUD.new
  77.     for i in 0...$game_party.actors.size
  78.       @hud_dummy[i].visible = $game_party.actors[i] != nil
  79.     end #for
  80.     @hud = true
  81.   end #def
  82.   #--------------------------------------------------------------------------
  83.   # ● 与状态窗口的开关相关的语句
  84.   #--------------------------------------------------------------------------   
  85.   def turn_hud_on_off
  86.    if $game_switches[SWITCH_ID] == false #关掉开关
  87.     @hud_window.visible = false
  88.       for i in 0...$game_party.actors.size
  89.         @hud_dummy[i].visible = false
  90.       end #for
  91.     end #if
  92.    if $game_switches[SWITCH_ID] == true #打开开关
  93.      @hud_window.visible = true
  94.      for i in 0...$game_party.actors.size
  95.        @hud_dummy[i].visible = true
  96.      end #for
  97.    end #if
  98.   end #def
  99. end #class
  100. #==============================================================================
  101. # ■ Window_HUD
  102. #------------------------------------------------------------------------------
  103. #  地图画面中显示的状态窗口。
  104. #==============================================================================
  105. class Window_HUD < Window_Base
  106.   #--------------------------------------------------------------------------
  107.   # ● 初始化对象
  108.   #--------------------------------------------------------------------------
  109.   def initialize
  110.     super(0, 0, 800, 600)
  111.     self.contents = Bitmap.new(width - 32, height - 32)
  112.     self.opacity = 0
  113.     for i in 0...$game_party.actors.size
  114.       actor = $game_party.actors[i]
  115.       eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
  116.     end #for
  117.     refresh
  118.   end #def
  119.   #--------------------------------------------------------------------------
  120.   # ● 刷新
  121.   #--------------------------------------------------------------------------
  122.   def refresh
  123.     self.contents.clear
  124.     for i in 0...$game_party.actors.size
  125.       a = $game_party.actors.size - 1
  126.       actor = $game_party.actors[i]
  127.       if $center_hud == true
  128.               x = (i * 160 + 25) + (240 - (a * 80))
  129.       else
  130.               x = i * 160 + 25
  131.       end #if
  132.       self.contents.font.size = 21
  133.       draw_actor_graphic(actor, x - 15, 445)
  134.       self.contents.font.color = normal_color
  135.       self.contents.draw_text(x - 25, 360, 100, 32, actor.name)
  136.       width = 100
  137.       height = 6
  138.       draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
  139.       draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
  140.       unless actor.level == 99
  141.         draw_slant_bar(x + 8, 436, actor.now_exp, actor.next_exp, width, height, Color.new(0, 150, 0), Color.new(60, 255, 60))
  142.       else
  143.         draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 6, Color.new(0, 150, 0), Color.new(60, 255, 60))
  144.       end #unless
  145.       self.contents.font.size = 16
  146.       draw_actor_state(actor, x + 45, 360)
  147.       self.contents.font.color = normal_color
  148.       self.contents.font.bold = true
  149.       self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  150.       self.contents.draw_text(x + 16, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
  151.       self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  152.       self.contents.draw_text(x + 16, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
  153.       self.contents.font.color = system_color
  154.       self.contents.font.size = 20
  155.       self.contents.font.bold = false
  156.       self.contents.draw_text(x, 384, 50, 32, "HP") #HP的显示文本,可修改。
  157.       self.contents.draw_text(x, 404, 50, 32, "PP") #SP的显示文本,可修改。
  158.       self.contents.draw_text(x, 424, 50, 32, "EXP") #EXP的显示文本,可修改。
  159.     end #for
  160.   end #def
  161.   #--------------------------------------------------------------------------
  162.   # ● 刷新画面
  163.   #--------------------------------------------------------------------------
  164.   def update
  165.     super
  166.     for i in 0...$game_party.actors.size
  167.       actor = $game_party.actors[i]
  168.       if (eval("@old_hp#{i+1}") != actor.hp or eval("@old_sp#{i+1}") != actor.sp or
  169.         eval("@old_exp#{i+1}") != actor.now_exp)
  170.         refresh
  171.         eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
  172.       end #if
  173.     end #super
  174.   end #def
  175. end #class
  176. #==============================================================================
  177. # ■ Window_Base
  178. #------------------------------------------------------------------------------
  179. #  游戏中全部窗口的超级类。
  180. #==============================================================================
  181. class Window_Base < Window
  182.   #状态条的绘制
  183.   def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  184.       bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  185.     for i in 0..height
  186.       self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  187.     end #for
  188.     for i in 1..(height - 1)
  189.       r = 100 * (height - i) / height + 0 * i / height
  190.       g = 100 * (height - i) / height + 0 * i / height
  191.       b = 100 * (height - i) / height + 0 * i / height
  192.       a = 255 * (height - i) / height + 255 * i / height
  193.       self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  194.     end #for
  195.     for i in 1..( (min / max.to_f) * width - 1)
  196.       for j in 1..(height - 1)
  197.         r = bar_color.red * (width - i) / width + end_color.red * i / width
  198.         g = bar_color.green * (width - i) / width + end_color.green * i / width
  199.         b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  200.         a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  201.         self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  202.       end #for
  203.     end #for
  204.   end #def
  205. end #class
  206. #==============================================================================
  207. # ■ Game_Actor
  208. #------------------------------------------------------------------------------
  209. #  处理角色的类。本类在 Game_Actors 类 ($game_actors)
  210. # 的内部使用、Game_Party 类请参考 ($game_party) 。
  211. #==============================================================================
  212. class Game_Actor
  213.   #获取当前EXP
  214.   def now_exp
  215.     return @exp - @exp_list[@level]
  216.   end #def
  217.   #获取下一级需要EXP的数值
  218.   def next_exp
  219.     return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  220.   end #def
  221. end
  222. #################################################################
  223. #本脚本来自66rpg.com,使用时请带上本信息。
  224. #################################################################
复制代码
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-24 06:16

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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