#=============================================================================== # # Yanfly Engine RD - Animation Fix # Last Date Updated: 2009.05.30 # Level: Easy # # This is just a small animation fix to something that was done terribly by # Enterbrain. This also lets you check whether or not you want enemies to play # animations on themselves when they're using skills. This script is just made # shorter and cleaner than the protoype Yanfly Engine version. # # This script also provides for three new features. Skills and items can now # play different animations depending on whether or not an actor is using it or # an enemy is using it. This will provide more varying animations each skill. # The third feature takes something back from RPG Maker XP, casting animations. # Now, actors and enemies can have a casting animation played on them before # they use their skills or items. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.05.24 - Updated to include . # o 2009.05.20 - Added and . # Converted ENEMY_ATTACK_CUSTOM to . # o 2009.05.07 - Added compatibility with YERD System Menu Options. # o 2009.04.19 - Added enemy normal attack animations. # o 2009.04.13 - Started script. #=============================================================================== # Instructions #=============================================================================== # # The following are tags you may input into your skills' notebox. # # # This will cause actors to play a different animation when using this skill # or item. x is the animation ID to be played. # # # This will cause enemies to play a different animation when using this skill. # x is the animation ID to be played. # # # This will display a animation when the skill or item is casted. # # The following are tags you may input into the enemy notebox. # # # This will give the enemy an attack animation other than the default. # #=============================================================================== # # Compatibility # - Alias: Scene_Battle, display_animation # - Overwrites: Scene_Battle, display_attack_animation # - Overwrites: Scene_Battle, display_normal_animation # #=============================================================================== $imported = {} if $imported == nil $imported["AnimationFix"] = true module YE module FIX # Set this to true if you want enemies to play animations on themselves when # they use a skill. ENEMY_SELF = false # Set this to true if you want enemies to have attack animations when they # strike their targets. ENEMY_ANI = true # If the above was set to true, this is the animation ID for enemy attacks # when they use only a normal attack. ENEMY_ATTACK_ANI = 36 # This will determine whether or not actors will have casting animations # if the skill/item has a casting animation. ACTOR_CAST_ANI = false # This adjusts where animations are played when the enemy attacks the # actor with a skill. ACTOR_SCREEN_Y = 288 end #module FIX end #module YE #=============================================================================== # Editting anything past this point may potentially result in causing computer # damage, incontinence, explosion of user's head, coma, death, and/or halitosis. # Therefore, edit at your own risk. #=============================================================================== module YE module REGEXP module BASEITEM ACTOR_ANI = /<(?:ACTOR_ANIMATION|actor animation)[ ]*(\d+)>/i ENEMY_ANI = /<(?:ENEMY_ANIMATION|enemy animation)[ ]*(\d+)>/i ANI_CASTING = /<(?:ANI_CASTING|ani casting)[ ]*(\d+)>/i end module ENEMY ATTACK_ANI = /<(?:ATTACK_ANIMATION|attack animation)[ ]*(\d+)>/i end end end #=============================================================================== # RPG::BaseItem #=============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # Yanfly_Cache_ANIFIX #-------------------------------------------------------------------------- def yanfly_cache_baseitem_anifix @actor_ani = 0; @enemy_ani = 0; @ani_casting = 0 self.note.split(/[\r\n]+/).each { |line| case line when YE::REGEXP::BASEITEM::ACTOR_ANI @actor_ani = $1.to_i when YE::REGEXP::BASEITEM::ENEMY_ANI @enemy_ani = $1.to_i when YE::REGEXP::BASEITEM::ANI_CASTING @ani_casting = $1.to_i end } end #-------------------------------------------------------------------------- # definitions #-------------------------------------------------------------------------- def actor_ani yanfly_cache_baseitem_anifix if @actor_ani == nil return @actor_ani end def enemy_ani yanfly_cache_baseitem_anifix if @enemy_ani == nil return @enemy_ani end def ani_casting yanfly_cache_baseitem_anifix if @ani_casting == nil return @ani_casting end end #=============================================================================== # RPG::Enemy #=============================================================================== class RPG::Enemy #-------------------------------------------------------------------------- # Yanfly_Cache_ANIFIX #-------------------------------------------------------------------------- def yanfly_cache_enemy_anifix @attack_ani = 0 self.note.split(/[\r\n]+/).each { |line| case line when YE::REGEXP::ENEMY::ATTACK_ANI @attack_ani = $1.to_i end } end #-------------------------------------------------------------------------- # definitions #-------------------------------------------------------------------------- def attack_ani yanfly_cache_enemy_anifix if @attack_ani == nil return @attack_ani end end #============================================================================== # Game_Actor #============================================================================== if !$imported["AnimationBattleConstruct"] and !$imported["SceneBattleReDux"] and YE::FIX::ENEMY_ANI class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # battler name, hue #-------------------------------------------------------------------------- def battler_name; return ""; end def battler_hue; return 0; end def use_sprite?; return true; end def screen_y; return YE::FIX::ACTOR_SCREEN_Y; end def screen_z; return 0; end #-------------------------------------------------------------------------- # screen x #-------------------------------------------------------------------------- def screen_x n = (544 - ($game_party.members.size * 124)) / 2 n += 62 n += self.index * 124 return n end end end #=============================================================================== # Scene_Battle #=============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # display attack animation rewritten #-------------------------------------------------------------------------- def display_attack_animation(targets) if @active_battler.is_a?(Game_Enemy) if YE::FIX::ENEMY_ANI if @active_battler.enemy.attack_ani > 0 ani_id = @active_battler.enemy.attack_ani else ani_id = YE::FIX::ENEMY_ATTACK_ANI end display_normal_animation(targets, ani_id, false) else Sound.play_enemy_attack wait(15, true) end else aid1 = @active_battler.atk_animation_id aid2 = @active_battler.atk_animation_id2 display_normal_animation(targets, aid1, false) display_normal_animation(targets, aid2, true) end wait_for_animation end #-------------------------------------------------------------------------- # display normal animation rewritten #-------------------------------------------------------------------------- def display_normal_animation(targets, animation_id, mirror = false) if $imported["MenuSystemOptions"] and $game_switches[YE::SYSTEM::ANI_SWITCH] return end skill_casting_animation if @active_battler.action.skill? item_casting_animation if @active_battler.action.item? animation = $data_animations[animation_id] if animation != nil to_screen = (animation.position == 3) ani_check = false for target in targets.uniq if target.is_a?(Game_Actor) and @active_battler.is_a?(Game_Enemy) target = @active_battler if YE::FIX::ENEMY_SELF end unless ani_check target.animation_id = animation_id target.animation_mirror = mirror end ani_check = true if to_screen wait(20, true) unless to_screen end wait(20, true) if to_screen end end #-------------------------------------------------------------------------- # display animation #-------------------------------------------------------------------------- alias display_animation_anifix display_animation unless $@ def display_animation(targets, animation_id) animation_id = different_animation(animation_id) display_animation_anifix(targets, animation_id) end #-------------------------------------------------------------------------- # different animation #-------------------------------------------------------------------------- def different_animation(animation_id) if @active_battler.action.skill? obj = @active_battler.action.skill elsif @active_battler.action.item? obj = @active_battler.action.item else return animation_id end if @active_battler.actor? and obj.actor_ani > 0 return obj.actor_ani elsif !@active_battler.actor? and obj.enemy_ani > 0 return obj.enemy_ani end return animation_id end #-------------------------------------------------------------------------- # skill_casting_animation #-------------------------------------------------------------------------- def skill_casting_animation return if @active_battler.actor? and !YE::FIX::ACTOR_CAST_ANI skill = @active_battler.action.skill if skill.ani_casting > 0 @active_battler.animation_id = skill.ani_casting @active_battler.animation_mirror = false while @active_battler.action.skill? update_basic break if !@spriteset.animation? end end end #-------------------------------------------------------------------------- # item_casting_animation #-------------------------------------------------------------------------- def item_casting_animation return if @active_battler.actor? and !YE::FIX::ACTOR_CAST_ANI item = @active_battler.action.item if item.ani_casting > 0 @active_battler.animation_id = item.ani_casting @active_battler.animation_mirror = false while @active_battler.action.item? update_basic break if !@spriteset.animation? end end end end #=============================================================================== # # END OF FILE # #===============================================================================