查看: 1933|回复: 5

[已经过期] 想結合兩個血量腳本...(就是讓他可以滾動這樣)

[复制链接]
梦石
0
星屑
55
在线时间
21 小时
注册时间
2016-10-13
回帖
24
发表于 2017-4-11 17:38:49 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 sam870716 于 2017-4-11 17:40 编辑

不好意思就是...
我想把Taroxd大大跟殇殃大大的腳本做結合...

以下是Taroxd大大給我的動態血量槽腳本~~
  1. #--------------------------------------------------------------------------
  2. # ● require Taroxd基础设置,动态值槽
  3. #    战斗中敌人显示血条
  4. #    如不想显示,可在敌人处备注 <hide hp>
  5. #    可在敌人处备注 <hp width w>、<hp height h>、<hp dxy dx dy> 调整血槽。
  6. #    其中 w 表示宽度、h 表示高度,dx、dy 表示坐标的偏移。
  7. #--------------------------------------------------------------------------

  8. Taroxd::EnemyHP = true

  9. class RPG::Enemy < RPG::BaseItem

  10.   note_any :hp_dxy, [0, 0], /\s+(-?\d+)\s+(-?\d+)/, '[$1.to_i, $2.to_i]'
  11.   note_i :hp_width, 80
  12.   note_i :hp_height, 6
  13.   note_bool :hide_hp?

  14.   # 初始化并获取战斗图的尺寸
  15.   def init_width_height
  16.     bitmap = Bitmap.new("Graphics/Battlers/#{@battler_name}")
  17.     @width = bitmap.width
  18.     [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  19.     bitmap.dispose
  20.   end

  21.   def width
  22.     return @width if @width
  23.     init_width_height
  24.     @width
  25.   end

  26.   def height
  27.     return @height if @height
  28.     init_width_height
  29.     @height
  30.   end
  31. end

  32. class Sprite_EnemyHP < Sprite

  33.   include Taroxd::RollGauge
  34.   include Taroxd::DisposeBitmap

  35.   HP_COLOR1 = Color.new(223, 127, 63)
  36.   HP_COLOR2 = Color.new(239, 191, 63)
  37.   BACK_COLOR = Color.new(31, 31, 63)

  38.   def initialize(viewport, enemy)
  39.     @enemy = enemy
  40.     super(viewport)
  41.     data = enemy.enemy
  42.     @width = data.hp_width
  43.     @height = data.hp_height
  44.     self.bitmap = Bitmap.new(@width, @height)
  45.     dx, dy = enemy.enemy.hp_dxy
  46.     self.ox = @width / 2
  47.     self.oy = @height
  48.     self.x = enemy.screen_x + dx
  49.     self.y = enemy.screen_y + dy
  50.     self.z = enemy.screen_z + 10
  51.     refresh
  52.   end

  53.   def make_gauge_transitions
  54.     Transition.new(gauge_roll_times) do
  55.       @enemy.hp.fdiv(@enemy.mhp)
  56.     end
  57.   end

  58.   def update_gauge_transitions
  59.     gauge_transitions.update
  60.   end

  61.   def refresh
  62.     bitmap.clear
  63.     rate = gauge_transitions.value
  64.     return if rate.zero?
  65.     fill_w = (bitmap.width * rate).to_i
  66.     bitmap.fill_rect(fill_w, 0, @width - fill_w, @height, BACK_COLOR)
  67.     bitmap.gradient_fill_rect(0, 0, fill_w, @height, HP_COLOR1, HP_COLOR2)
  68.   end
  69. end

  70. class Spriteset_Battle

  71.   # 导入精灵组
  72.   def_after :create_enemies do
  73.     @enemy_hp_sprites = $game_troop.members.map { |enemy|
  74.       Sprite_EnemyHP.new(@viewport1, enemy) unless enemy.enemy.hide_hp?
  75.     }.compact
  76.   end

  77.   def_after(:update_enemies)  { @enemy_hp_sprites.each(&:update)  }
  78.   def_after(:dispose_enemies) { @enemy_hp_sprites.each(&:dispose) }
  79. end
复制代码


以下是爬文找到殇殃大大的血量 hp mp槽數值顯示腳本~~
  1. #==============================================================================
  2. # 功能:战斗中显示敌人血和蓝于敌人脚下
  3. # 适用:RMVX Ace
  4. # 作者:殇殃 2012.3.10
  5. # 使用方法:复制整个脚本插入到Main之前
  6. # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
  7. #       可以自行更改坐标修改显示位置、血条的颜色等。
  8. #==============================================================================
  9. # ■ Window_Base
  10. #------------------------------------------------------------------------------
  11. #  游戏中全部窗口的超级类。
  12. #==============================================================================

  13. class Window_Base < Window
  14.   #--------------------------------------------------------------------------
  15.   # ● 描绘敌人HP
  16.   #--------------------------------------------------------------------------
  17.   def draw_enemy_hp(enemy, x, y, width = 80)
  18.     draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
  19.     self.contents.font.color = system_color
  20.     self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
  21.     self.contents.font.color = hp_color(enemy)
  22.     self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
  23.     #一个数字占16像素
  24.   end
  25.   #--------------------------------------------------------------------------
  26.   # ● 绘制敌人MP
  27.   #--------------------------------------------------------------------------
  28.   def draw_enemy_mp(enemy, x, y, width = 80)
  29.     draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
  30.     self.contents.font.color = system_color
  31.     self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
  32.     self.contents.font.color = mp_color(enemy)
  33.     self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
  34.   end
  35. end
  36. #==============================================================================
  37. # ■ Sprite_Battler
  38. #------------------------------------------------------------------------------
  39. #  战斗显示用活动块。Game_Battler 类的实例监视、
  40. # 活动块的状态的监视、活动块状态自动变化。
  41. #==============================================================================

  42. class Sprite_Battler < Sprite_Base
  43.   #--------------------------------------------------------------------------
  44.   # ● 初始化对象
  45.   #     viewport : 视区
  46.   #     battler  : 战斗者 (Game_Battler)
  47.   #--------------------------------------------------------------------------
  48.   def initialize(viewport, battler = nil)
  49.     super(viewport)
  50.     [url=home.php?mod=space&uid=133701]@battler[/url] = battler
  51.     @battler_visible = false
  52.     @effect_type = nil      
  53.     @effect_duration = 0   
  54.     if @battler.is_a?(Game_Enemy)
  55.       width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义)
  56.       height = 24 + 24*2 #边距12*2+line_height*2
  57.       x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置
  58.       y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框
  59.       @enemy_hpmp_window = Window_Base.new(x, y, width, height)
  60.       @enemy_hpmp_window.opacity = 0
  61.       @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框
  62.       @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  63.       @old_hp = -1
  64.       @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  65.       @old_mp = -1
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 释放
  70.   #--------------------------------------------------------------------------
  71.   def dispose
  72.     if self.bitmap != nil
  73.       self.bitmap.dispose
  74.       @enemy_hpmp_window.dispose
  75.     end
  76.     super
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● 更新画面
  80.   #--------------------------------------------------------------------------
  81.   def update
  82.     super
  83.     if @battler == nil
  84.       self.bitmap = nil
  85.     else
  86.       @use_sprite = @battler.use_sprite?
  87.       if @use_sprite
  88.         update_bitmap
  89.         update_origin
  90.         update_position
  91.       end
  92.       setup_new_effect
  93.       setup_new_animation
  94.       update_effect
  95.       if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
  96.         if @battler.hp == 0
  97.           @enemy_hpmp_window.hide
  98.         else
  99.           @enemy_hpmp_window.contents.clear
  100.           @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
  101.           @old_hp = @battler.hp
  102.           @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
  103.           @old_mp = @battler.mp
  104.           @enemy_hpmp_window.show #怪物死后再被复活
  105.         end #if battler.hp == 0
  106.       end
  107.     end #if @battler == nil
  108.   end

  109. end
复制代码


我想要就是...讓殇殃大大的腳本變得有辦法滾動這樣   
還有就是   可以再備註欄輸入一串字或者其他方法下可以讓這個腳本對這個怪物暫時失效(BOSS怪物 然後採用另一串BOSS血條腳本...)
[[url=  https://rpg.blue/forum.php?mod=v ... d=398718&extra=  ]    另一串BOSS用血條腳本[/url]--- 3F(須搭配8f素材使用)

  求幫助!!!  {:2_259:} 感謝
梦石
0
星屑
55
在线时间
21 小时
注册时间
2016-10-13
回帖
24
 楼主| 发表于 2017-4-19 02:36:12 | 显示全部楼层
推    刷新x1次

点评

阿 好的 因為製作進度緩慢 確實在台灣地區 這樣的話我集中多一點在一次訂好了(?) 畢竟匯款包括流程對我來說不是很容易(還是學生#) 感謝你^^  发表于 2017-4-21 00:31
要找到好心人抽時間完全照你的要求替你改到好比較困難,不過似乎你是台灣地區所以我可以接受你的匯款訂製  发表于 2017-4-21 00:23
如何訂製(?) 由於是新手(不管是rpg 還是這論壇都是@@)  发表于 2017-4-20 23:54
要定製嗎?  发表于 2017-4-19 21:04
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部