赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 3348 |
最后登录 | 2018-6-2 |
在线时间 | 21 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 55
- 在线时间
- 21 小时
- 注册时间
- 2016-10-13
- 帖子
- 28
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 sam870716 于 2017-4-11 17:40 编辑
不好意思就是...
我想把Taroxd大大跟殇殃大大的腳本做結合...
以下是Taroxd大大給我的動態血量槽腳本~~
#-------------------------------------------------------------------------- # ● require Taroxd基础设置,动态值槽 # 战斗中敌人显示血条 # 如不想显示,可在敌人处备注 <hide hp> # 可在敌人处备注 <hp width w>、<hp height h>、<hp dxy dx dy> 调整血槽。 # 其中 w 表示宽度、h 表示高度,dx、dy 表示坐标的偏移。 #-------------------------------------------------------------------------- Taroxd::EnemyHP = true class RPG::Enemy < RPG::BaseItem note_any :hp_dxy, [0, 0], /\s+(-?\d+)\s+(-?\d+)/, '[$1.to_i, $2.to_i]' note_i :hp_width, 80 note_i :hp_height, 6 note_bool :hide_hp? # 初始化并获取战斗图的尺寸 def init_width_height bitmap = Bitmap.new("Graphics/Battlers/#{@battler_name}") @width = bitmap.width [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height bitmap.dispose end def width return @width if @width init_width_height @width end def height return @height if @height init_width_height @height end end class Sprite_EnemyHP < Sprite include Taroxd::RollGauge include Taroxd::DisposeBitmap HP_COLOR1 = Color.new(223, 127, 63) HP_COLOR2 = Color.new(239, 191, 63) BACK_COLOR = Color.new(31, 31, 63) def initialize(viewport, enemy) @enemy = enemy super(viewport) data = enemy.enemy @width = data.hp_width @height = data.hp_height self.bitmap = Bitmap.new(@width, @height) dx, dy = enemy.enemy.hp_dxy self.ox = @width / 2 self.oy = @height self.x = enemy.screen_x + dx self.y = enemy.screen_y + dy self.z = enemy.screen_z + 10 refresh end def make_gauge_transitions Transition.new(gauge_roll_times) do @enemy.hp.fdiv(@enemy.mhp) end end def update_gauge_transitions gauge_transitions.update end def refresh bitmap.clear rate = gauge_transitions.value return if rate.zero? fill_w = (bitmap.width * rate).to_i bitmap.fill_rect(fill_w, 0, @width - fill_w, @height, BACK_COLOR) bitmap.gradient_fill_rect(0, 0, fill_w, @height, HP_COLOR1, HP_COLOR2) end end class Spriteset_Battle # 导入精灵组 def_after :create_enemies do @enemy_hp_sprites = $game_troop.members.map { |enemy| Sprite_EnemyHP.new(@viewport1, enemy) unless enemy.enemy.hide_hp? }.compact end def_after(:update_enemies) { @enemy_hp_sprites.each(&:update) } def_after(:dispose_enemies) { @enemy_hp_sprites.each(&:dispose) } end
#--------------------------------------------------------------------------
# ● require Taroxd基础设置,动态值槽
# 战斗中敌人显示血条
# 如不想显示,可在敌人处备注 <hide hp>
# 可在敌人处备注 <hp width w>、<hp height h>、<hp dxy dx dy> 调整血槽。
# 其中 w 表示宽度、h 表示高度,dx、dy 表示坐标的偏移。
#--------------------------------------------------------------------------
Taroxd::EnemyHP = true
class RPG::Enemy < RPG::BaseItem
note_any :hp_dxy, [0, 0], /\s+(-?\d+)\s+(-?\d+)/, '[$1.to_i, $2.to_i]'
note_i :hp_width, 80
note_i :hp_height, 6
note_bool :hide_hp?
# 初始化并获取战斗图的尺寸
def init_width_height
bitmap = Bitmap.new("Graphics/Battlers/#{@battler_name}")
@width = bitmap.width
[url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
bitmap.dispose
end
def width
return @width if @width
init_width_height
@width
end
def height
return @height if @height
init_width_height
@height
end
end
class Sprite_EnemyHP < Sprite
include Taroxd::RollGauge
include Taroxd::DisposeBitmap
HP_COLOR1 = Color.new(223, 127, 63)
HP_COLOR2 = Color.new(239, 191, 63)
BACK_COLOR = Color.new(31, 31, 63)
def initialize(viewport, enemy)
@enemy = enemy
super(viewport)
data = enemy.enemy
@width = data.hp_width
@height = data.hp_height
self.bitmap = Bitmap.new(@width, @height)
dx, dy = enemy.enemy.hp_dxy
self.ox = @width / 2
self.oy = @height
self.x = enemy.screen_x + dx
self.y = enemy.screen_y + dy
self.z = enemy.screen_z + 10
refresh
end
def make_gauge_transitions
Transition.new(gauge_roll_times) do
@enemy.hp.fdiv(@enemy.mhp)
end
end
def update_gauge_transitions
gauge_transitions.update
end
def refresh
bitmap.clear
rate = gauge_transitions.value
return if rate.zero?
fill_w = (bitmap.width * rate).to_i
bitmap.fill_rect(fill_w, 0, @width - fill_w, @height, BACK_COLOR)
bitmap.gradient_fill_rect(0, 0, fill_w, @height, HP_COLOR1, HP_COLOR2)
end
end
class Spriteset_Battle
# 导入精灵组
def_after :create_enemies do
@enemy_hp_sprites = $game_troop.members.map { |enemy|
Sprite_EnemyHP.new(@viewport1, enemy) unless enemy.enemy.hide_hp?
}.compact
end
def_after(:update_enemies) { @enemy_hp_sprites.each(&:update) }
def_after(:dispose_enemies) { @enemy_hp_sprites.each(&:dispose) }
end
以下是爬文找到殇殃大大的血量 hp mp槽數值顯示腳本~~
#============================================================================== # 功能:战斗中显示敌人血和蓝于敌人脚下 # 适用:RMVX Ace # 作者:殇殃 2012.3.10 # 使用方法:复制整个脚本插入到Main之前 # 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。 # 可以自行更改坐标修改显示位置、血条的颜色等。 #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # 游戏中全部窗口的超级类。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 描绘敌人HP #-------------------------------------------------------------------------- def draw_enemy_hp(enemy, x, y, width = 80) draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a) self.contents.font.color = hp_color(enemy) self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2) #一个数字占16像素 end #-------------------------------------------------------------------------- # ● 绘制敌人MP #-------------------------------------------------------------------------- def draw_enemy_mp(enemy, x, y, width = 80) draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2) self.contents.font.color = system_color self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a) self.contents.font.color = mp_color(enemy) self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2) end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ # 战斗显示用活动块。Game_Battler 类的实例监视、 # 活动块的状态的监视、活动块状态自动变化。 #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ● 初始化对象 # viewport : 视区 # battler : 战斗者 (Game_Battler) #-------------------------------------------------------------------------- def initialize(viewport, battler = nil) super(viewport) [url=home.php?mod=space&uid=133701]@battler[/url] = battler @battler_visible = false @effect_type = nil @effect_duration = 0 if @battler.is_a?(Game_Enemy) width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义) height = 24 + 24*2 #边距12*2+line_height*2 x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置 y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框 @enemy_hpmp_window = Window_Base.new(x, y, width, height) @enemy_hpmp_window.opacity = 0 @enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框 @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0) @old_hp = -1 @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24) @old_mp = -1 end end #-------------------------------------------------------------------------- # ● 释放 #-------------------------------------------------------------------------- def dispose if self.bitmap != nil self.bitmap.dispose @enemy_hpmp_window.dispose end super end #-------------------------------------------------------------------------- # ● 更新画面 #-------------------------------------------------------------------------- def update super if @battler == nil self.bitmap = nil else @use_sprite = @battler.use_sprite? if @use_sprite update_bitmap update_origin update_position end setup_new_effect setup_new_animation update_effect if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp) if @battler.hp == 0 @enemy_hpmp_window.hide else @enemy_hpmp_window.contents.clear @enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0) @old_hp = @battler.hp @enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24) @old_mp = @battler.mp @enemy_hpmp_window.show #怪物死后再被复活 end #if battler.hp == 0 end end #if @battler == nil end end
#==============================================================================
# 功能:战斗中显示敌人血和蓝于敌人脚下
# 适用:RMVX Ace
# 作者:殇殃 2012.3.10
# 使用方法:复制整个脚本插入到Main之前
# 注意:由于血条是显示在敌人脚下,所以敌群的位置不能太靠底部,不然会被挡住。
# 可以自行更改坐标修改显示位置、血条的颜色等。
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● 描绘敌人HP
#--------------------------------------------------------------------------
def draw_enemy_hp(enemy, x, y, width = 80)
draw_gauge(x, y, width, enemy.hp_rate, hp_gauge_color1, hp_gauge_color2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, line_height, Vocab::hp_a)
self.contents.font.color = hp_color(enemy)
self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.hp, 2)
#一个数字占16像素
end
#--------------------------------------------------------------------------
# ● 绘制敌人MP
#--------------------------------------------------------------------------
def draw_enemy_mp(enemy, x, y, width = 80)
draw_gauge(x, y, width, enemy.mp_rate, mp_gauge_color1, mp_gauge_color2)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 30, line_height, Vocab::mp_a)
self.contents.font.color = mp_color(enemy)
self.contents.draw_text(x + width - 64, y, 64, line_height, enemy.mp, 2)
end
end
#==============================================================================
# ■ Sprite_Battler
#------------------------------------------------------------------------------
# 战斗显示用活动块。Game_Battler 类的实例监视、
# 活动块的状态的监视、活动块状态自动变化。
#==============================================================================
class Sprite_Battler < Sprite_Base
#--------------------------------------------------------------------------
# ● 初始化对象
# viewport : 视区
# battler : 战斗者 (Game_Battler)
#--------------------------------------------------------------------------
def initialize(viewport, battler = nil)
super(viewport)
[url=home.php?mod=space&uid=133701]@battler[/url] = battler
@battler_visible = false
@effect_type = nil
@effect_duration = 0
if @battler.is_a?(Game_Enemy)
width = 24 + 80 #边距12*2+血条的长度(在draw_enemy_hp中定义)
height = 24 + 24*2 #边距12*2+line_height*2
x = @battler.screen_x - width/2 #screen_x是怪物图片水平方向上的中点位置
y = @battler.screen_y - 12 #边距12,显示HP/MP的窗口无边框
@enemy_hpmp_window = Window_Base.new(x, y, width, height)
@enemy_hpmp_window.opacity = 0
@enemy_hpmp_window.contents = Bitmap.new(width - 24, height - 24)#位图比窗口小24像素取消边框
@enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
@old_hp = -1
@enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
@old_mp = -1
end
end
#--------------------------------------------------------------------------
# ● 释放
#--------------------------------------------------------------------------
def dispose
if self.bitmap != nil
self.bitmap.dispose
@enemy_hpmp_window.dispose
end
super
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if @battler == nil
self.bitmap = nil
else
@use_sprite = @battler.use_sprite?
if @use_sprite
update_bitmap
update_origin
update_position
end
setup_new_effect
setup_new_animation
update_effect
if @enemy_hpmp_window != nil and (@old_hp != @battler.hp or @old_mp != @battler.mp)
if @battler.hp == 0
@enemy_hpmp_window.hide
else
@enemy_hpmp_window.contents.clear
@enemy_hpmp_window.draw_enemy_hp(@battler, 0, 0)
@old_hp = @battler.hp
@enemy_hpmp_window.draw_enemy_mp(@battler, 0, 24)
@old_mp = @battler.mp
@enemy_hpmp_window.show #怪物死后再被复活
end #if battler.hp == 0
end
end #if @battler == nil
end
end
我想要就是...讓殇殃大大的腳本變得有辦法滾動這樣
還有就是 可以再備註欄輸入一串字或者其他方法下可以讓這個腳本對這個怪物暫時失效(BOSS怪物 然後採用另一串BOSS血條腳本...)
[[url= https://rpg.blue/forum.php?mod=v ... d=398718&extra= ] 另一串BOSS用血條腳本[/url]--- 3F(須搭配8f素材使用)
求幫助!!! {:2_259:} 感謝
|
|