RMRK is retiring.
Server is paid up for the rest of 2026, but the forum may go after that. See here for more information. Please archive or save anything you would like to keep before 2027.
Main Menu
  • Welcome to The RPG Maker Resource Kit.

HELP: Animation Battler Effects of Fomar0153

Started by therufianx, August 15, 2014, 07:33:57 AM

0 Members and 1 Guest are viewing this topic.

therufianx

Animation Battler Effectst




Help

Basically I need help to run a script that is sure going to help a lot. Personally this script has interesting effects that remind me of Pokemon as soon as the zoom effect and reduction of sprite in battle, giving you a funny and interesting touch to the game.

Script

Video of script: https://www.youtube.com/watch?v=dYHfNgAOk_4

As you can see in the video, the script lets give various interesting effects to sprites. But to install the script I get the following error:

"NoMethodError occurred at line 141 in this script Because HAD Been undefined effect."

It's very annoying because the script is very good, but I can not fix it. Hope you can help

Code script

=begin
Animation Battler Effects
by Fomar0153
Version 1.0
----------------------
Notes
----------------------
Makes animations more interesting by letting you
modify a targets battler as part of the animation,.
----------------------
Instructions
----------------------
Basically you need to "nametag" the animations (how very RPG Maker XP)
the guidelines for the tag are below.

<effect effect,start_frame,length,reset_on_end>
e.g.
<effect hop,1,6,true>

effect can be one of: flatten, zoomin, zoomout, bulge or hop
More effects can be added later.

start_frame refers to the frame this effect is applied to the battler.
length refers to frames of the animation not actual game frames
reset_on_end when true will reset the battler as soon as the battler effect
is finished. When false it will reset the battler when the whole animation is
finished.
----------------------
Known bugshop
----------------------
None
=end
module AnimationEffects
 
  def self.applyeffect(sprite, effect, frame, length = 1)
    case effect
    when "flatten"
      case frame
      when -1 # end
        sprite.zoom_y = 1.0
        sprite.zoom_x = 1.0
      else
        sprite.zoom_y = [1.0 - (frame / length.to_f),0.1].max
        sprite.zoom_x = [1.0 + 0.2 * (frame / length.to_f),1.2].min
      end # flatten
    when "zoomin"
      case frame
      when -1 # end
        sprite.zoom_y = 1.0
        sprite.zoom_x = 1.0
      else
        sprite.zoom_x = [1.0 + (frame / length.to_f),2].min
        sprite.zoom_y = [1.0 + (frame / length.to_f),2].min
      end # zoomin
    when "zoomout"
      case frame
      when -1 # end
        sprite.zoom_y = 1.0
        sprite.zoom_x = 1.0
      else
        sprite.zoom_x = [1.0 - (frame / length.to_f),0.1].max
        sprite.zoom_y = [1.0 - (frame / length.to_f),0.1].max
      end # zoomout
    when "bulge"
      case frame
      when -1 # end
        sprite.zoom_y = 1.0
        sprite.zoom_x = 1.0
      else
        if frame < length / 2
          rate = 2 * (frame / length.to_f)
          sprite.zoom_x = [1.0 - 0.5 * rate,0.5].max
          sprite.zoom_y = [1.0 + 0.5 * rate,1.5].min
        else
          rate = ((frame-length / 2) / (length.to_f-length / 2))
          sprite.zoom_x = [0.5 + 0.5 * rate,1.0].min
          sprite.zoom_y = [1.5 - 0.5 * (frame / length.to_f),1.0].max
        end
      end # bulge
    when "hop"
      case frame
      when -1 # end
        sprite.y = sprite.animation_settings['y']
      when 0
        sprite.animation_settings['y'] = sprite.y
        sprite.y -= 200 / length.to_f
      else
        if frame < length / 2
          sprite.y -= 200 / length.to_f
        else
          sprite.y += 200 / length.to_f
        end
      end # hop
    end
  end
 
  def self.endeffect(sprite, effect)
    self.applyeffect(sprite, effect, -1)
    sprite.animation_settings = {}
  end
 
end


class Sprite_Base < Sprite
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :animation_settings
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias se_initialize initialize
  def initialize(viewport = nil)
    se_initialize(viewport)
    @animation_settings = {}
  end
  #--------------------------------------------------------------------------
  # * Update Animation
  #--------------------------------------------------------------------------
  alias se_update_animation update_animation
  def update_animation
    return unless animation?
    if @animation.effect.size > 0
      frame_index = @animation.frame_max - ((@ani_duration + @ani_rate - 2) / @ani_rate)
      if frame_index >= @animation.effect[1].to_i and frame_index < @animation.effect[1].to_i + @animation.effect[2].to_i
        @ani_frames = @ani_duration if @ani_frames.nil?
        AnimationEffects.applyeffect(self,@animation.effect[0],(@ani_frames - @ani_duration)+(frame_index - @animation.effect[1].to_i),@animation.effect[2].to_i * @ani_rate)
      end
      if (@animation.effect[3] == "true" and frame_index == @animation.effect[1].to_i + @animation.effect[2].to_i)  and (@ani_duration - 1) % @ani_rate == 0
        AnimationEffects.endeffect(self,@animation.effect[0])
      end
    end
    se_update_animation
  end
  #--------------------------------------------------------------------------
  # * End Animation
  #--------------------------------------------------------------------------
  alias se_end_animation end_animation
  def end_animation
    if @animation.effect.size > 0 and !(@animation.effect[3] == "true")
      AnimationEffects.endeffect(self,@animation.effect[0])
    end
    @ani_frames = nil
    se_end_animation
  end
end

class Sprite_Battler < Sprite_Base
  #--------------------------------------------------------------------------
  # * Update Position
  #--------------------------------------------------------------------------
  alias se_update_position update_position
  def update_position
    return if animation?
    se_update_position
  end
end

class RPG::Animation
  def effect
    if @effect.nil?
      if @name =~ /<effect (.*)>/i
        @effect = $1.split(",")
      else
        @effect = []
      end
    end
    @effect
  end
end
Power of dogs!


Euphoria

So are you getting the error upon starting the game? If so it's probably due to another script you have since I just ran an empty game with it fine. I haven't tried using the animations yet though. Let me know when the problem happens and I'll see if I can help!
My Website:

:tinysmile:

&&&&&&&&&&&&&

I am currently annoyed, and announcing my emotions.

I placed it in a new project and also got the error. The thing I'm wondering is, is this even VXAce?
&&&&&&&&&&&&&&&&

Euphoria

#3
Weird, since it worked for me fine :o

I'll try it again, but the game started up for me a second ago.

It should be for Ace, I'm pretty sure I saw it in one of RMW's restaffs.

Edit: Still runs fine for me O_o

Edit2: Just got the error when trying to access a shop? Lol... well now I can start trying to figure it out at least.
My Website:

:tinysmile:

therufianx

I speak Spanish, sorry for my ignorance and the truth is not good if Reproduce the instructions to install the script, but would greatly appreciate if you do a little tutorial or let out a demo with the script in use, since truth and have tried a lot to install for nothing  :-\
Power of dogs!


Euphoria

I'm really sorry I forgot to reply!

There's not much I can do, I really don't understand the way Fomar coded this well enough to fix the issue.

Sorry I couldn't have been of more help.
My Website:

:tinysmile: