RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[REQUEST] Simple Add-On for Default Battle System

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 73
RMRK Junior
Hi all!

Didn't have too much success with my requests so far, but I figured this one should be fairly easy:

I'm looking to use the default battle system (rather than the Tankentai system). My only real gripe with it is that the enemies don't have any attack animation. Is there a way that I can appoint a battle animation to an enemy?

When I add a skill to an enemy now, it only shows the screen flashes, but not the actual images that come with the original animation. I don't need a completely new battle system or anything like that, I only want the ability to play an attack animation for the enemy. Would be nice if an enemy could have a couple of different ones like, say, up to 3?

Any help is much appreciated!

***
Rep:
Level 69
RESIDENT ADONKADONK
I am not sure if this it is but here is Yanfly's Monster Animation fix
Code: [Select]
#===============================================================================
#
# 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 <ani casting x>.
# o 2009.05.20 - Added <actor animation x> and <enemy animation x>.
#                Converted ENEMY_ATTACK_CUSTOM to <attack animation x>.
# 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.
#
# <actor animation x>
# This will cause actors to play a different animation when using this skill
# or item. x is the animation ID to be played.
#
# <enemy animation x>
# This will cause enemies to play a different animation when using this skill.
# x is the animation ID to be played.
#
# <ani casting x>
# This will display a animation when the skill or item is casted.
#
# The following are tags you may input into the enemy notebox.
#
# <attack animation x>
# 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
#
#===============================================================================

I'm back.

**
Rep: +0/-0Level 73
RMRK Junior
Thanks a bunch! I will try this out and report with the results asap!

EDIT: It seems to be working just like I want it to! Thanks again!
« Last Edit: July 28, 2011, 08:45:00 PM by memberp »