gregory | Membres | 39 messages postés |
| Posté le 12-07-2006 à 13:20:34
| Insérez ce script au dessus de Main et nommez-le Momo_Change_Tone. Puis collz ce code: Code #バトラー色調変化 # #バトラーの残り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 |
|