赞 | 6 |
VIP | 1 |
好人卡 | 14 |
积分 | 7 |
经验 | 2666 |
最后登录 | 2018-6-28 |
在线时间 | 215 小时 |
Lv2.观梦者 仙木精灵
- 梦石
- 0
- 星屑
- 651
- 在线时间
- 215 小时
- 注册时间
- 2012-4-16
- 帖子
- 502
|
对于默认脚本全局搜索 【hp -=】,里边属于Game_Battler的是战斗时攻击、特技、物品、连续伤害(如中毒)等的伤害处理,
Interper的是事件指令进行伤害,如果乃用了有关事件指令造成伤害的类似战斗特效,那这里也是伤害触发点。
试试这个脚本吧!- #===========================================================================
- #动态伤害效果加强版
- #原作者:柳柳
- #加强:sdxsdx
- #加了震动功能,仿GBA。
- #我总觉得有点怪怪的(汗|||)
- #===========================================================================
- module RPG
- class Sprite < ::Sprite
- def initialize(viewport = nil)
- super(viewport)
- @flash_shake = 0
- @_whiten_duration = 0
- @_appear_duration = 0
- @_escape_duration = 0
- @_collapse_duration = 0
- @_damage_duration = 0
- @_animation_duration = 0
- @_blink = false
- end
- def animation_process_timing(timing, hit)
- if (timing.condition == 0) or
- (timing.condition == 1 and hit == true) or
- (timing.condition == 2 and hit == false)
- if timing.se.name != ""
- se = timing.se
- Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
- end
- case timing.flash_scope
- when 1
- self.flash(timing.flash_color, timing.flash_duration * 2)
- @flash_shake_switch = true
- @flash_shake = 10
- when 2
- if self.viewport != nil
- self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
- end
- when 3
- self.flash(nil, timing.flash_duration * 2)
- end
- end
- end
- end
- end
- #==============================================================================
- # ■ Sprite_Battler
- #------------------------------------------------------------------------------
- # 战斗显示用活动块。Game_Battler 类的实例监视、
- # 活动块的状态的监视。
- #==============================================================================
- class Sprite_Battler < RPG::Sprite
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # viewport : 显示端口
- # battler : 战斗者 (Game_Battler)
- #--------------------------------------------------------------------------
- def initialize(viewport, battler = nil)
- super(viewport)
- @battler = battler
- @battler_visible = false
- @flash_shake_switch = true
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- super
- # 战斗者为 nil 的情况下
- if @battler == nil
- self.bitmap = nil
- loop_animation(nil)
- return
- end
- # 文件名和色相与当前情况有差异的情况下
- if @battler.battler_name != @battler_name or
- @battler.battler_hue != @battler_hue
- # 获取、设置位图
- @battler_name = @battler.battler_name
- @battler_hue = @battler.battler_hue
- self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
- @width = bitmap.width
- @height = bitmap.height
- self.ox = @width / 2
- self.oy = @height
- # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
- if @battler.dead? or @battler.hidden
- self.opacity = 0
- end
- end
- # 动画 ID 与当前的情况有差异的情况下
- if @battler.damage == nil and
- @battler.state_animation_id != @state_animation_id
- @state_animation_id = @battler.state_animation_id
- loop_animation($data_animations[@state_animation_id])
- end
- # 应该被显示的角色的情况下
- if @battler.is_a?(Game_Actor) and @battler_visible
- # 不是主状态的时候稍稍降低点透明度
- if $game_temp.battle_main_phase
- self.opacity += 3 if self.opacity < 255
- else
- self.opacity -= 3 if self.opacity > 207
- end
- end
- # 明灭
- if @battler.blink
- blink_on
- else
- blink_off
- end
- # 不可见的情况下
- unless @battler_visible
- # 出现
- if not @battler.hidden and not @battler.dead? and
- (@battler.damage == nil or @battler.damage_pop)
- appear
- @battler_visible = true
- end
- end
- # 可见的情况下
- if @battler_visible
- # 逃跑
- if @battler.hidden
- $game_system.se_play($data_system.escape_se)
- escape
- @battler_visible = false
- end
- # 白色闪烁
- if @battler.white_flash
- whiten
- @battler.white_flash = false
- end
- # 动画
- if @battler.animation_id != 0
- animation = $data_animations[@battler.animation_id]
- animation(animation, @battler.animation_hit)
- @battler.animation_id = 0
- end
- # 伤害
- if @battler.damage_pop
- damage(@battler.damage, @battler.critical)
- @battler.damage = nil
- @battler.critical = false
- @battler.damage_pop = false
- end
- # korapusu
- if @battler.damage == nil and @battler.dead?
- if @battler.is_a?(Game_Enemy)
- $game_system.se_play($data_system.enemy_collapse_se)
- else
- $game_system.se_play($data_system.actor_collapse_se)
- end
- collapse
- @battler_visible = false
- end
- end
- # 设置活动块的坐标
- if @flash_shake_switch == true
- self.x = @battler.screen_x
- self.y = @battler.screen_y
- self.z = @battler.screen_z
- @flash_shake_switch = false
- end
- if @flash_shake != 0
- @battler.battler_name = @battler.battler_name + "_on_hit" if [email protected]_name[/_on_hit/]
- @flash_shake -= 1
- else
- @battler.battler_name = @battler.battler_name.split("_on_hit")[0]
- end
- end
- end
- class Game_Battler
- attr_accessor :battler_name
- end
复制代码 再在Graphics/Battlers加入战斗者_on_hit命名的文件 |
|