[RESOLVED][XP]increase Animation frame rate script

Started by hirasu, November 02, 2013, 07:03:40 pm

Previous topic - Next topic

hirasu

November 02, 2013, 07:03:40 pm Last Edit: November 03, 2013, 12:28:46 am by hirasu
Hey dudes :)
I need a script to make animations play at a faster rate , i found a script but is for VX ,someone know a script like this or can someone tell me how i can increase the rate in the Standart Codes please?

Spoiler: ShowHide
#Animation Frame Rate v1.1
#----------#
#Features: Make animations play at a faster rate allowing smoother animations
#           and now allowing animations to play behind their targets.
#
#Usage:    Place #number in the name of any animation you want to change the
#           frame rate of (i.e. #1)
#          Place @ in the name of any animation you want to have play behind
#           it's target.
#          Place NM in the name if FLIP_ANIMATIONS is true and you don't wish
#           an animation to be mirrored.
#        
#Customization: DEFAULT_RATE below for animations without # in their name
#               FLIP_ANIMATIONS is for Side View Battle Systems that don't
#                automatically mirror animations on enemies.
#
#Examples: Sword Slash #3
#          Aura Boost @
#          Combination! #1 @
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    posted on the thread for the script
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#    posed on site: daimonioustails.wordpress.com
#
#--- Free to use in any project, commercial or non-commercial, with credit given
# - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)

class Sprite_Base

 #Change the default frame_rate for all animations here:
 DEFAULT_RATE = 4
 FLIP_ANIMATIONS = false

 alias new_asp animation_set_sprites

 def set_animation_rate
   name = @animation.name
   index = name.index("#")
   index.nil? ? rate = DEFAULT_RATE : rate = name[index+1,1].to_i
   index = name.index("@")
   index.nil? ? z = 300 : z = -20
   index = name.index("NM")
   if index.nil? && FLIP_ANIMATIONS && @battler
     @ani_mirror = true if @battler.is_a?(Game_Enemy)
   end
   @ani_z = z
   @ani_rate = rate
 end

 def animation_set_sprites(frame)
   new_asp(frame)
   @ani_sprites.each_with_index do |sprite, i|
     next unless sprite
     sprite.z = self.z + @ani_z + i
   end
 end

end


PS: sorry for my bad english im from germany  :shy:

KK20

You don't have to keep apologizing for your English.
1) There are plenty of users here that are not native English speakers.
2) Your English is actually really good.
3) We don't insult others for poor English here--we're not that heartless. :)

Anywho, RMXP's animations update every two frames. You can cut that time in half by adding this edit. Place just above Main.

module RPG
  class Sprite < ::Sprite
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      if @_damage_duration > 0
        @_damage_duration -= 1
        case @_damage_duration
        when 38..39
          @_damage_sprite.y -= 4
        when 36..37
          @_damage_sprite.y -= 2
        when 34..35
          @_damage_sprite.y += 2
        when 28..33
          @_damage_sprite.y += 4
        end
        @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
        if @_damage_duration == 0
          dispose_damage
        end
      end
#-----------------------------
# EDIT MADE HERE
#-----------------------------
      if @_animation != nil #and (Graphics.frame_count % 2 == 0)    #<===== No longer need the Graphics.frame_count check
        @_animation_duration -= 1
        update_animation
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end
  end
end

Any faster and you will have to change your game's frame rate: Graphics.frame_rate = SOME_NUMBER

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

hirasu

November 02, 2013, 08:35:43 pm #2 Last Edit: November 02, 2013, 08:43:09 pm by hirasu
Thank you again ! Level Up for you  ;)

But what I need to change if I want to have it only 25% faster?

KK20

You will need to change the frame rate of your game. There really is no way to get a speed that precise with only 40 frames per second to work with.

I mean, think about it: Normal animation speed means that 20 frames of animation will play in 1 second (40 frames per second / 2 frames to update animation frame in default RMXP)

If you want 25% faster, that means 25 frames of animation are played in 1 second.
40 / X = 25
X = 40 / 25
X = 1.6

How in the world do you display 0.6 frames of an animation? Answer: you can't.

Do note that increasing the frame rate of your game will make the computer work harder and will affect other aspects of your game as well (e.g. the event commands that require N amount of frames to process such as "Wait" or "Tint Screen") without proper edits.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!