Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> 


———
Before you ask! Read! ;)

You must have 30+ Posts to create a topic here!

Thanks for reading!
———

 
Reply to this topicStart new topic
> Enemy battler animation, Add Animation to enemy battlers in standard battle system
TheCretanHound
post Apr 11 2012, 06:57 PM
Post #1



Group Icon

Group: Member
Posts: 4
Type: Artist
RM Skill: Beginner




Hi I want to add attack animations to the enemy battlers in the standard or yanfly style battle system. Can someone send me to the right place or forward me the script? Thanks!
Attached File(s)
Attached File  abe_01.jpg ( 108.74K ) Number of downloads: 16
 
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Apr 12 2012, 06:03 AM
Post #2


Level 50
Group Icon

Group: +Gold Member
Posts: 1,521
Type: Scripter
RM Skill: Undisclosed




For anyone looking for the back story see the topic here

CODE
#==============================================================================
# ** VXAce: Animated Enemy Battlers
#------------------------------------------------------------------------------
# History:
#  Date Created: 13/Apr/2012
#  Created for: TheCretanHound
#   @> http://www.rpgrevolution.com/forums/index.php?showtopic=56171
#
# Description:
#  This script is designed to animate the enemy battlers in the default
#   RMVX Ace battle system.
#
# How to Install:
#  Copy this entire script. In your game editor select Tools >> Script Editor.
#   Along the left, scroll down to the bottom, right click on 'Main', and
#   select 'Insert'. Paste the code on the right.
#
# How to Use:
#  Please see below for the default number of frames per step, and the
#   default number of steps per graphic.
#  To set the number of frames per step and the number of steps per graphic
#   for an individual battler, change their name to:
#      Slime[100, 2].png
#   Where Slime is their normal name, 100 is the number of frames to wait
#   per animation, and 2 is the number of frames per graphic.
#==============================================================================



#==============================================================================
# ** Customisation
#==============================================================================

module NR_AnimEnemies
  DEFAULT_FRAMES = 20
  DEFAULT_STEPS = 4
end



#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
#  Edited to have animated battlers.
#==============================================================================

class Sprite_Battler
  #--------------------------------------------------------------------------
  # * Alias Methods
  #--------------------------------------------------------------------------
  alias nr_animEnemy_update_bitmap  update_bitmap  unless $@
  #--------------------------------------------------------------------------
  # * Update Transfer Origin Bitmap
  #--------------------------------------------------------------------------
  def update_bitmap(*args)
    # Restore the bitmap to the whole bitmap (if it exists)
    self.bitmap = @whole_bitmap unless @last_bitmap.nil?
    # Run the original update_bitmap
    nr_animEnemy_update_bitmap(*args)
    # Return if appropriate
    return if self.bitmap.nil?
    return if @battler.is_a? Game_Actor
    # If the bitmap name has changed
    if @old_bitmap_name != @battler.battler_name or
        @old_battler_hue != @battler.battler_hue
      # Backup their name & hue
      @old_bitmap_name = @battler.battler_name
      @old_battler_hue = @battler.battler_hue
      # Get the note for this enemy
      notebox = $data_enemies[@battler.enemy_id].note.to_s
      # Read the number of frames
      frames = @battler.battler_name.match( /\[(.*)\]$/ )
      if frames.nil?
        @animation_frames = NR_AnimEnemies::DEFAULT_FRAMES
        @animation_steps = NR_AnimEnemies::DEFAULT_STEPS
      else
        @animation_frames, @animation_steps = eval(frames[0])
      end
      # Reset the frames_since_anim
      @frames_since_anim = -1
      @current_anim_index = -1
      # Backup the un-segmented battler
      @whole_bitmap = self.bitmap.clone
    # If the battler hasn't changed
    else
      # Restore the bitmap to the segmented battler
      self.bitmap = @segmented_bitmap
    end
    # If it's time for an update
    if @frames_since_anim == -1 or @frames_since_anim > @animation_frames
      # Update the current anim index
      @current_anim_index = (@current_anim_index + 1) % @animation_steps
      # Reset the update counter
      @frames_since_anim = 0
      # Get the dimensions of the whole bitmap
      r = Rect.new(0, 0, @whole_bitmap.width, @whole_bitmap.height)
      # Create a rect to get the segmented battler
      x = @current_anim_index * r.width / @animation_steps
      source_x = Rect.new(x, r.y, r.width, r.height)
      # Create the bitmap with the segmented battler and set it as active
      a_bitmap = Bitmap.new(r.width / @animation_steps, r.height)
      a_bitmap.blt(0, 0, @whole_bitmap, source_x)
      self.bitmap = a_bitmap
      @segmented_bitmap = self.bitmap.clone
    end
    # Increment the frames since an animation
    @frames_since_anim += 1
  end
end



#==============================================================================
# ** End of Script.
#==============================================================================


And since you like my scripts so much, have a fresh one ^_^


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
TheCretanHound
post Apr 12 2012, 07:09 AM
Post #3



Group Icon

Group: Member
Posts: 4
Type: Artist
RM Skill: Beginner





Thanks Night Runner! You = Kick ass!

This post has been edited by TheCretanHound: Apr 12 2012, 07:10 AM
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 21st May 2013 - 02:13 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker