赞 | 0 |
VIP | 21 |
好人卡 | 2 |
积分 | 1 |
经验 | 16112 |
最后登录 | 2021-11-19 |
在线时间 | 73 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 120
- 在线时间
- 73 小时
- 注册时间
- 2008-7-9
- 帖子
- 234
|
24# pudding
,少end。
算了,我把脚本完整贴一遍吧,我测试显示是正常的。- # ============================================================================
- # 伤害效果美化 v1.0 by SailCat
- # 整合 地图伤害 by carol3
- #============================================================================
- # 脚本使用说明:
- # 1.使用时需要将Damage.png复制到你的游戏的Graphics/Pictures目录下
- # 2.Damage.png文件的格式:
- # 大小为180 x 96
- # (0, 0) - (179, 31)为伤害值的数字表,其中每个数字宽18,高32
- # (0, 32) - (179, 63)为回复值(伤害负值)的数字表,其中每个数字宽18,高32
- # (0, 64) - (89, 95)为会心一击标记的图画,长宽为90 x 32
- # (90, 64) - (179, 95)为未命中标记的图画,长宽为90 x 32
- # ============================================================================
- # 伤害显示方法:
- # ★、对角色显示伤害:
- # 脚本:
- # $game_switches[10] = true #图片第4行效果,此时负数无效
- # $game_player.damage = 数值 #负数效果为图片第2行,若为负值,省略第一行。
- # $game_player.critical = true #会心一击,false则省略此行
- # $game_player.damage_pop = true
- #
- # ★、对普通NPC和事件进行伤害:
- # 脚本:
- # $game_map.events[事件编号].damage = 数值 #负数效果为图片第2行
- # $game_map.events[事件编号].critical = true/false #会心一击
- # $game_map.events[事件编号].damage_pop = true
- #
- # 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
- #
- # ============================================================================
- module RPG
- class Sprite < ::Sprite
- #--------------------------------------------------------------------------
- # ● 伤害值描画
- #--------------------------------------------------------------------------
- def damage(value, critical)
- # 释放伤害
- dispose_damage
- # 如果伤害值是数值
- if value.is_a?(Numeric)
- # 绝对值转为字符串
- damage_string = value.abs.to_s
- else
- # 转为字符串
- damage_string = value.to_s
- end
- # 初始化位图
- bitmap = Bitmap.new(180, 128)
- bitmap.font.name = "Arial Black"
- bitmap.font.size = 32
- # 伤害值是数值的情况下
- if value.is_a?(Numeric)
- # 分割伤害值字符串
- damage_array = damage_string.scan(/./)
- damage_x = 81 - damage_string.size * 9
- # 伤害值为负的情况下
- if value < 0
- # 调用回复数字表
- rect_y = 32
- else
- # 调用伤害数字表
- rect_y = 0
- end
- # 循环伤害值字符串
- for char in damage_array
- number = char.to_i
- # 显示伤害数字
- if $game_switches[10] == true
- bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
- Rect.new(number * 18, rect_y+32*3, 18, 32))
- else
- bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
- Rect.new(number * 18, rect_y, 18, 32))
- end
- # 后移一位
- damage_x += 18
- end
- # 伤害值不是数值的情况
- else
- # 如果伤害值不是 Miss
- unless value == "Miss"
- # 系统默认描画字符串
- bitmap.font.color.set(0, 0, 0)
- bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
- bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
- bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
- bitmap.font.color.set(255, 255, 255)
- bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
- # Miss 的情况下
- else
- # 显示未击中图画
- bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
- end
- end
- # 会心一击标志打开的情况
- if critical
- # 显示会心一击图画
- bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
- end
- # 伤害值定位
- @_damage_sprite = ::Sprite.new(self.viewport)
- @_damage_sprite.bitmap = bitmap
- @_damage_sprite.ox = 81
- @_damage_sprite.oy = 20
- @_damage_sprite.x = self.x
- @_damage_sprite.y = self.y - self.oy
- @_damage_sprite.z = 3000
- @_damage_duration = 40
- end
- #=================整合地图伤害==============================================
- alias carol3_66RPG_damage_pop_update update
- def update
- carol3_66RPG_damage_pop_update
- if @character.damage_pop
- damage(@character.damage, @character.critical)
- @character.damage = nil
- @character.critical = false
- @character.damage_pop = false
- #=================开关复位===================================================
- $game_switches[10] = false
- #============================================================================
- end
- #=================伤害跟随角色===============================================
- if @_damage_duration > 0
- @_damage_sprite.x = self.x
- case @_damage_duration
- when 0..32
- unless @_damage_sprite.y == self.y - self.oy
- @_damage_sprite.y -= (@_damage_sprite.y - self.y + self.oy)/8
- end
- end
- end
- #============================================================================
- end
- end
- end
- #=================整合地图伤害===============================================
- class Game_Character
- attr_accessor :damage_pop
- attr_accessor :damage
- attr_accessor :critical
- alias carol3_66RPG_damage_pop_initialize initialize
- def initialize
- @damage_pop = false
- @damage = 0
- @critical = false
- carol3_66RPG_damage_pop_initialize
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
|