Project1
标题:
敌人血条问题
[打印本页]
作者:
冰水金刚
时间:
2014-2-14 17:35
标题:
敌人血条问题
本帖最后由 冰水金刚 于 2014-2-14 17:39 编辑
我设置了关于战斗中的敌人的血条(也设置了释放),选择敌人时血条出现,结束选择敌人时血条却不会立刻消失,总要过几秒才消失,这是怎么回事?
Scripts.rxdata
(120.22 KB, 下载次数: 30)
2014-2-14 17:33 上传
点击文件名下载附件
(我在脚本最上面写了修改注释,我也设置了角色血条,这个的释放和战斗画面更改却没有时间差)
作者:
1340124207
时间:
2014-2-15 13:44
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
# 重新定义的内容,可以显示敌人的HP\MP百分比
# 你可以改脚本的开头部分定义生命、精神描述词。只和敌人描述有关,可随意修改
#==============================================================================
class Window_Help < Window_Base
def set_enemy(actor)
#--------------------------------------------------------------------
# 在这里修改描述文字,比如@生命描述词="敌人生命"
#--------------------------------------------------------------------
@生命描述词 = $data_system.words.hp
@精神描述词 = $data_system.words.sp
#--------------------------------------------------------------------
#--------------------------------------------------------------------
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
carol3_draw_hp_bar(actor, 284, 12)
carol3_draw_sp_bar(actor, 460, 12)
@text = nil
self.visible = true
end
def carol3_draw_hp_bar(actor, x, y, width = 128, height = 14) #宽度可调
w = width * actor.hp / [actor.maxhp,1].max
hp_color_1 = Color.new(255, 0, 0, 192)
hp_color_2 = Color.new(255, 255, 0, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x+2,-3,128,32,@生命描述词,1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x,-4,128,32,@生命描述词,1)
end
def carol3_draw_sp_bar(actor, x, y, width = 128, height=14)
w = width * actor.sp / [actor.maxsp,1].max
hp_color_1 = Color.new( 0, 0, 255, 192)
hp_color_2 = Color.new( 0, 255, 255, 192)
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
x -= 1
y += (height/4).floor
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
x -= 1
y += (height/4).ceil
self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x+2,-3,128,32,@精神描述词,1)
self.contents.font.color = Color.new(255,255,255,255)
self.contents.draw_text(x,-4,128,32,@精神描述词,1)
end
#--------------------------------------------------------------------------
# ● ライン描画 by 桜雅 在土
#--------------------------------------------------------------------------
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
# 描写距離の計算。大きめに直角時の長さ。
distance = (start_x - end_x).abs + (start_y - end_y).abs
# 描写開始
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.contents.set_pixel(x, y, start_color)
else
self.contents.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.contents.set_pixel(x, y, Color.new(r, g, b, a))
else
self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================
复制代码
要不你把你那个脚本换了吧,我这个脚本应该不会出现错误。
作者:
冰水金刚
时间:
2014-2-15 16:20
你确定没问题?
用这脚本刚战斗就提示错误了
作者:
断电
时间:
2014-2-15 17:46
直接用.visible=false试试呢?
作者:
1340124207
时间:
2014-2-15 19:46
冰水金刚 发表于 2014-2-15 16:20
你确定没问题?
用这脚本刚战斗就提示错误了
额,为啥我用就没问题....,可能似脚本冲突吧
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1