Floating Enemies?

To make it clear, I do NOT want a script that uses a separate spritesheet for each enemy like Yanfly's. What I want is just a slight up and down movement for all enemies on screen, like floating, without changing their image. If possible I'd like it to be a general script, without having to add notes on each individual enemy entry.

I searched multiple times but all I keep getting is complete conversion scripts like Yanfly's. If anyone has any ideas about this, it'd be a great help.
check moghunter's scripts - but I don't know if they can be used independently or are similiar to yanfly in that regard.

Otherwise you might have to wait until someone writes one if something like this is not yet on the master script list.
Soulpour777 also had a Animated Battler script that does this. Older links went to demos on a now-dead site, but thankfully, someone at Mundo-Maker posted a script, third in this topic.

THE ISSUE with Soulpour's version is that update_oy is written as oy = height, so it will always go to height regardless of changes in float (so it looks like twitching). Thankfully, it's easy to fix.

---

Taking another look at the script, you just want all battlers to float up and down. We could probably simplify the request since without the battler setup, it mainly takes place in Sprite_Battler. Just copy-paste this instead and credit Soulpour777:

Edit: Code corrected as I just checked the errors just now.

Code:
class Sprite_Battler < Sprite_Base
  alias :soulpour_battlerex_initialize                          :initialize
  alias :soulpour_battlerex_update                              :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport, battler = nil)
    soulpour_battlerex_initialize(viewport, battler)
    @oy_offset = 0
    float_effect_setup(battler)
  end
  def float_effect_setup(battler)
    @float_duration = rand(40)
    @float_speed = rand(3)
  end
  def update
    soulpour_battlerex_update
    update_float_effect if @battler.is_a?(Game_Enemy)   
  end
  def update_origin
    self.ox = bitmap.width / 2
    self.oy = height + @oy_offset
  end
  def update_float_effect
    return if @battler == nil
    return unless @battler.is_a?(Game_Enemy)
    @float_speed += 1
    return if @float_speed < 2
    @float_speed = 0
    @float_duration += 1
    case @float_duration
    when 0..15
      @oy_offset += 2
    when 16..20 
      @oy_offset += 1
    when 21..35
      @oy_offset -= 2
    when 36..40
      @oy_offset -= 1
    else
      @float_duration = 0
    end
  end
end
Soulpour777 also had a Animated Battler script that does this. Older links went to demos on a now-dead site, but thankfully, someone at Mundo-Maker posted a script, third in this topic.

THE ISSUE with Soulpour's version is that update_oy is written as oy = height, so it will always go to height regardless of changes in float (so it looks like twitching). Thankfully, it's easy to fix.

---

Taking another look at the script, you just want all battlers to float up and down. We could probably simplify the request since without the battler setup, it mainly takes place in Sprite_Battler. Just copy-paste this instead and credit Soulpour777:

Code:
class Sprite_Battler < Sprite_Base
  include Soulpour::AnimatedBattlers
  alias :soulpour_battlerex_initialize                          :initialize
  alias :soulpour_battlerex_update                              :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport, battler = nil)
    soulpour_battlerex_initialize(viewport, battler)
    @oy_offset = 0
    float_effect_setup(battler)
  end

  def float_effect_setup(battler)
    @float_duration = rand(40)
    @float_speed = rand(3)
  end

  def update
    soulpour_battlerex_update
    update_float_effect if @battler.is_a?(Game_Enemy)  
  end

  def update_origin
    self.ox = bitmap.width / 2
    self.oy = height + @oy_offset
  end

  def update_float_effect
    return if @battler == nil
    return unless @battler.is_a?(Game_Enemy)
    @float_speed += 1
    return if @float_speed < 2
    @float_speed = 0
    @float_duration += 1
    case @float_duration
    when 0..15
      @oy_offset += 2
    when 16..20
      @oy_offset += 1
    when 21..35
      @oy_offset.oy -= 2
    when 36..40
      @oy_offset.oy -= 1
    else
      @float_duration = 0
    end
  end

end

Took me quite a while to see that someone had actually replied to this. Thanks man! This is exactly what I needed!
Soulpour777 also had a Animated Battler script that does this. Older links went to demos on a now-dead site, but thankfully, someone at Mundo-Maker posted a script, third in this topic.

THE ISSUE with Soulpour's version is that update_oy is written as oy = height, so it will always go to height regardless of changes in float (so it looks like twitching). Thankfully, it's easy to fix.

---

Taking another look at the script, you just want all battlers to float up and down. We could probably simplify the request since without the battler setup, it mainly takes place in Sprite_Battler. Just copy-paste this instead and credit Soulpour777:

Code:
class Sprite_Battler < Sprite_Base
  include Soulpour::AnimatedBattlers
  alias :soulpour_battlerex_initialize                          :initialize
  alias :soulpour_battlerex_update                              :update
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(viewport, battler = nil)
    soulpour_battlerex_initialize(viewport, battler)
    @oy_offset = 0
    float_effect_setup(battler)
  end

  def float_effect_setup(battler)
    @float_duration = rand(40)
    @float_speed = rand(3)
  end

  def update
    soulpour_battlerex_update
    update_float_effect if @battler.is_a?(Game_Enemy)  
  end

  def update_origin
    self.ox = bitmap.width / 2
    self.oy = height + @oy_offset
  end

  def update_float_effect
    return if @battler == nil
    return unless @battler.is_a?(Game_Enemy)
    @float_speed += 1
    return if @float_speed < 2
    @float_speed = 0
    @float_duration += 1
    case @float_duration
    when 0..15
      @oy_offset += 2
    when 16..20
      @oy_offset += 1
    when 21..35
      @oy_offset.oy -= 2
    when 36..40
      @oy_offset.oy -= 1
    else
      @float_duration = 0
    end
  end

end
Thanks for the help! The only problem I have is that for some reason as I start the battle I can see the enemy battler float for about 2 frames, then this happens: What could be the cause?
Did you start a new game after installing the script, or did you try and use an existing save file? Trying to use an existing save file is the most common cause of NoMethodError.

EDIT
@coticka I have just seen that you are not, in fact, the OP and that your query is unrelated. Please do not hijack another member's thread. If you need help with this, please post a thread in RGSSx Script Support, not here, as you already have a script.
Did you start a new game after installing the script, or did you try and use an existing save file? Trying to use an existing save file is the most common cause of NoMethodError.

EDIT
@coticka I have just seen that you are not, in fact, the OP and that your query is unrelated. Please do not hijack another member's thread. If you need help with this, please post a thread in RGSSx Script Support, not here, as you already have a script.
Well, I'm cool with it.

Original thread: https://forums.rpgmakerweb.com/threads/floating-enemies.76423/