- 注册时间
- 2006-5-16
- 最后登录
- 2019-7-24
④见习
- 积分
- 483

|
档案 搜索 邮件 短信 引用 编辑 结贴 楼主
就是两个脚本放在一起会出现没效果的状态,能让两个脚本能不冲突吗? [s:3] [s:3]
单个用的时候就可以。
以下是动态伤害脚本:[]
---------------------------------------------
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 effect?
@_whiten_duration > 0 or
@_appear_duration > 0 or
@_escape_duration > 0 or
@_collapse_duration > 0 or
@_damage_duration > 0
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
@way = rand(3)
if @battler.damage.is_a?(Numeric)
@damage_temp = (@battler.damage+rand(8)) * (timing.flash_duration+rand(2))/10
@battler.hp -= @damage_temp
end
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
def dispose_animation
if @_animation_sprites != nil
sprite = @_animation_sprites[0]
if sprite != nil
@@_reference_count[sprite.bitmap] -= 1
if @@_reference_count[sprite.bitmap] == 0
sprite.bitmap.dispose
end
end
for sprite in @_animation_sprites
sprite.dispose
end
@_animation_sprites = nil
@_animation = nil
@battler.damage=nil
@damage_temp=nil
@battler.critical=nil
@battler.damage_pop = false
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
@way = 0
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
# 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
damage(@damage_temp, @battler.critical)
case @flash_shake
when 9..10
case @way
when 0
self.x = @battler.screen_x
self.y -=4
self.z = @battler.screen_z
when 1
self.x -= 4
self.y = @battler.screen_y
self.z = @battler.screen_z
when 2
self.x += 4
self.y = @battler.screen_y
self.z = @battler.screen_z
end
when 6..8
case @way
when 0
self.x = @battler.screen_x
self.y -=2
self.z = @battler.screen_z
when 1
self.x -= 2
self.y = @battler.screen_y
self.z = @battler.screen_z
when 2
self.x += 2
self.y = @battler.screen_y
self.z = @battler.screen_z
end
when 3..5
case @way
when 0
self.x = @battler.screen_x
self.y +=2
self.z = @battler.screen_z
when 1
self.x += 2
self.y = @battler.screen_y
self.z = @battler.screen_z
when 2
self.x -= 2
self.y = @battler.screen_y
self.z = @battler.screen_z
end
when 1..2
case @way
when 0
self.x = @battler.screen_x
self.y +=4
self.z = @battler.screen_z
when 1
self.x += 4
self.y = @battler.screen_y
self.z = @battler.screen_z
when 2
self.x -= 4
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
@flash_shake -= 1
end
end
end
以下是敌人血少时身体变红脚本:[]
-------------------------------------------
#バトラー色調変化
#
#バトラーの残りHPに応じて色調を変化させます。
#
#2005.4.14 バグ修正
#HPが減った状態で戦闘をはじめた時
#アクターの色調が変化してないバグを修正。
module Momo_Change_Tone
# 味方の色調変化をするか?
ACTOR_CHANGE_TONE = false
# 敵の色調変化をするか?
ENEMY_CHANGE_TONE = true
# 色調の赤成分
TONE_RED = 128
# 色調の緑成分
TONE_GREEN = 0
# 色調の青成分
TONE_BLUE = 0
end
class Game_Battler
attr_accessor :tone_change
alias game_battler_change_color_initialize initialize
def initialize
game_battler_change_color_initialize
# 色調変化要求フラグ
@tone_change = false
end
end
class Sprite_Battler < RPG::Sprite
alias sprite_battler_change_color_initialize initialize
def initialize(viewport, battler = nil)
sprite_battler_change_color_initialize(viewport, battler)
@change_tone = Tone.new(0, 0, 0)
end
alias sprite_battler_change_color_update update
def update
sprite_battler_change_color_update
tone_update
end
def tone_update
if @battler != nil
if rest_hp_tone_change?
if @battler.tone_change
rest_hp_tone_change_set
@battler.tone_change = false
end
self.tone = @change_tone
end
end
end
# 色調変化可能かどうか
def rest_hp_tone_change?
if (Momo_Change_Tone::ACTOR_CHANGE_TONE and @battler.is_a?(Game_Actor)) or
(Momo_Change_Tone::ENEMY_CHANGE_TONE and @battler.is_a?(Game_Enemy))
return true
end
return false
end
# 残りHPに応じて色調を変更
def rest_hp_tone_change_set
hp_rate = (@battler.hp.to_f / @battler.maxhp) * 100
rate = 100 - hp_rate
red = Momo_Change_Tone::TONE_RED * rate / 100
green = Momo_Change_Tone::TONE_GREEN * rate / 100
blue = Momo_Change_Tone::TONE_BLUE * rate / 100
@change_tone.set(red, green, blue)
end
end
class Spriteset_Battle
alias spriteset_battle_change_color_initialize initialize
def initialize
spriteset_battle_change_color_initialize
# アクタースプライトの更新
for sprite in @actor_sprites
if !sprite.battler.nil?
sprite.battler.tone_change = true
sprite.update
end
end
end
end
class Scene_Battle
alias scene_battle_change_color_update_phase4_step5 update_phase4_step5
def update_phase4_step5
scene_battle_change_color_update_phase4_step5
# ダメージ表示時に色調変更要求フラグを立てる
for target in @target_battlers
target.tone_change = true
end
end
end |
|