赞 | 2 |
VIP | 0 |
好人卡 | 0 |
积分 | 10 |
经验 | 8174 |
最后登录 | 2024-3-9 |
在线时间 | 180 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 995
- 在线时间
- 180 小时
- 注册时间
- 2013-2-16
- 帖子
- 176
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 clear仔 于 2013-3-16 10:28 编辑
这个伤害美化脚本是我在别的游戏里找出来的
(因为它有显示SP伤害的功能么)
谁能告诉我它显示SP伤害的原理
这是一个XP脚本
module RPG class Sprite < ::Sprite def damage(value, critical) dispose_damage damage_string = value.to_s if damage_string[0].chr == "s" sp_recover = true damage_string = damage_string[1,damage_string.size] value = damage_string.to_i elsif damage_string[0].chr == "b" both = true damage_string = damage_string[1,damage_string.size] value = damage_string.to_i damage_string = (value/2).to_s elsif damage_string[0].chr == "g" gray = true damage_string = damage_string[1,damage_string.size] value = damage_string.to_i end bitmap = Bitmap.new(160, 48) if value.is_a?(Numeric) damage_string = value.abs.to_s unless both bitmap.font.name = "Arial Black" bitmap.font.size = 32 else bitmap.font.color.set(200, 200, 200) damage_string = value.to_s damage_string = "未命中" if damage_string == "Miss" bitmap.font.bold = true end bitmap.font.color.set(0, 0, 0) unless both bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1) end if sp_recover if value < 0 bitmap.font.color.set(100, 180, 255) elsif sp_recover>0 bitmap.font.color.set(100, 100, 255) elsif sp_recover<0 bitmap.font.color.set(207, 6, 142) end elsif gray bitmap.font.color.set(200, 200, 200) elsif both #bitmap.font.color.set(255, 100, 255) bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-20-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-20+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(-20-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(-20+1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(20-1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(20+1, 12-1, 160, 36, damage_string, 1) bitmap.draw_text(20-1, 12+1, 160, 36, damage_string, 1) bitmap.draw_text(20+1, 12+1, 160, 36, damage_string, 1) bitmap.font.color.set(255, 100, 100) bitmap.draw_text(-20, 12, 160, 36, damage_string, 1) bitmap.font.color.set(100, 100, 255) bitmap.draw_text(20, 12, 160, 36, damage_string, 1) elsif value.is_a?(Numeric) if value < 0 #bitmap.font.color.set(176, 255, 144) bitmap.font.color.set(144, 255, 176) elsif value == 0 bitmap.font.color.set(200, 200, 200) else bitmap.font.color.set(255, 100, 100) end else bitmap.font.color.set(255, 255, 255) end bitmap.draw_text(0, 12, 160, 36, damage_string, 1) unless both if critical bitmap.font.size = 20 bitmap.font.color.set(0, 0, 0) bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1) bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1) bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1) #bitmap.font.color.set(255, 255, 255) bitmap.font.color.set(86, 255, 42) bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) end @_damage_sprite = ::Sprite.new(self.viewport) @_damage_sprite.bitmap = bitmap @_damage_sprite.ox = 80 @_damage_sprite.oy = 20 @_damage_sprite.x = self.x @_damage_sprite.y = self.y - self.oy / 2 @_damage_sprite.z = 3000 @_damage_duration = 40 end end end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
damage_string = value.to_s
if damage_string[0].chr == "s"
sp_recover = true
damage_string = damage_string[1,damage_string.size]
value = damage_string.to_i
elsif damage_string[0].chr == "b"
both = true
damage_string = damage_string[1,damage_string.size]
value = damage_string.to_i
damage_string = (value/2).to_s
elsif damage_string[0].chr == "g"
gray = true
damage_string = damage_string[1,damage_string.size]
value = damage_string.to_i
end
bitmap = Bitmap.new(160, 48)
if value.is_a?(Numeric)
damage_string = value.abs.to_s unless both
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
else
bitmap.font.color.set(200, 200, 200)
damage_string = value.to_s
damage_string = "未命中" if damage_string == "Miss"
bitmap.font.bold = true
end
bitmap.font.color.set(0, 0, 0)
unless both
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
end
if sp_recover
if value < 0
bitmap.font.color.set(100, 180, 255)
elsif sp_recover>0
bitmap.font.color.set(100, 100, 255)
elsif sp_recover<0
bitmap.font.color.set(207, 6, 142)
end
elsif gray
bitmap.font.color.set(200, 200, 200)
elsif both
#bitmap.font.color.set(255, 100, 255)
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-20-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-20+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-20-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(-20+1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(20-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(20+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(20-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(20+1, 12+1, 160, 36, damage_string, 1)
bitmap.font.color.set(255, 100, 100)
bitmap.draw_text(-20, 12, 160, 36, damage_string, 1)
bitmap.font.color.set(100, 100, 255)
bitmap.draw_text(20, 12, 160, 36, damage_string, 1)
elsif value.is_a?(Numeric)
if value < 0
#bitmap.font.color.set(176, 255, 144)
bitmap.font.color.set(144, 255, 176)
elsif value == 0
bitmap.font.color.set(200, 200, 200)
else
bitmap.font.color.set(255, 100, 100)
end
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1) unless both
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
#bitmap.font.color.set(255, 255, 255)
bitmap.font.color.set(86, 255, 42)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
end
end
还有两个问题:
1.为什么在使用恢复SP的物品时,第9行的.chr为什么会报错,chr不是内部方法吗?
2.我在将其美化时,我在64行换成了:
if sp_recover > 0 bitmap.font.color.set(100, 100, 255) elsif sp_recover < 0 bitmap.font.color.set(241, 60, 255)
if sp_recover > 0
bitmap.font.color.set(100, 100, 255)
elsif sp_recover < 0
bitmap.font.color.set(241, 60, 255)
为什么会报错,而且是关于大于号和小于号的错误,我真是弄不明白
最后说一句:
如果原作者看到了请不要生气我拿了你的脚本,如果还能解决我的疑惑,那将是感激不尽。{:2_275:} |
|