Animated Enemies

● ARCHIVED · READ-ONLY
Started by xazrael 11 posts View original ↗
  1. Okay, so I have probably read every post asking about animated battlers, but I still have yet to find a way to do what I am looking to do. I do not want any visual actor in my battles at all, however, I would like my monster battlers to be animated. I cannot seem to find a script that works. I did find 1 script that was supposed to do what I wanted, but wouldnt work with Yanfly's Battle System.

    Here is the script I tried using

    http://www.rpgmakervxace.net/topic/464-animate-enemies/

    I kept getting an error on Yanflys Script under (new method: update_popups)

    I assume it doesn't like the script.

    If anyone can figure out an edit to the script I linked here that would make it compatible with Yanfly, that would be great. Or if I maybe missed another script out there. Even if you could take http://www.rpgmakervxace.net/topic/500-animated-battlers/?pid=6454#entry6454 and make it enemies only that would work. I unfortunately tried but just kept getting errors.

    Thank you.
  2. I've been trying to get this working too, using Rhyme's animated enemies (same link as above) and the Yanfly Ace Battle Engine. Testing combat out resulted in errors in the main Yanfly Battle Engine script in reference to popups between the following lines (848-919):


    #--------------------------------------------------------------------------

    # alias method: setup_new_effect
    #--------------------------------------------------------------------------

    alias sprite_battler_setup_new_effect_abe setup_new_effect
    def setup_new_effect
    sprite_battler_setup_new_effect_abe
    setup_popups
    end

    #--------------------------------------------------------------------------
    # new method: setup_popups
    #--------------------------------------------------------------------------
    def setup_popups
    return unless @battler.use_sprite?
    @battler.popups = [] if @battler.popups.nil?
    return if @battler.popups == []
    array = @battler.popups.shift
    create_new_popup(array[0], array[1], array[2])
    end

    #--------------------------------------------------------------------------
    # new method: create_new_popup
    #--------------------------------------------------------------------------
    def create_new_popup(value, rules, flags)
    return if @battler == nil
    return if flags & @popup_flags != []
    array = YEA::BATTLE::pOPUP_RULES[rules]
    for popup in @popups
    popup.y -= 24
    end
    return unless SceneManager.scene.is_a?(Scene_Battle)
    return if SceneManager.scene.spriteset.nil?
    view = SceneManager.scene.spriteset.viewportPopups
    new_popup = Sprite_Popup.new(view, @battler, value, rules, flags)
    @popups.push(new_popup)
    @popup_flags.push("weakness") if flags.include?("weakness")
    @popup_flags.push("resistant") if flags.include?("resistant")
    @popup_flags.push("immune") if flags.include?("immune")
    @popup_flags.push("absorbed") if flags.include?("absorbed")
    end

    #--------------------------------------------------------------------------
    # alias method: update_effect
    #--------------------------------------------------------------------------
    alias sprite_battler_update_effect_abe update_effect
    def update_effect
    sprite_battler_update_effect_abe
    update_popups
    end

    #--------------------------------------------------------------------------
    # new method: update_popups
    #--------------------------------------------------------------------------
    def update_popups
    for popup in @popups
    popup.update
    next unless popup.opacity <= 0
    popup.bitmap.dispose
    popup.dispose
    @popups.delete(popup)
    popup = nil
    end
    @popup_flags = [] if @popups == [] && @popup_flags != []
    return unless SceneManager.scene_is?(Scene_Battle)
    if @current_active_battler != SceneManager.scene.subject
    @current_active_battler = SceneManager.scene.subject
    @popup_flags = []
    end
    end
     

    end # Sprite_Battler



     

    Commenting out that section of the script, I can actually get the combat working in game and the enemies animating fine (idle, defend, attack etc. animations all work), but obviously it's not an actual solution to just cut out that section from the core battle engine script. Besides popups not showing when that happens, I also run into a problem where when the enemy HP reaches 0 and toggles on the death state, the death animation frames cycle referenced by Rhyme's script will play on loop nonstop without the enemy collapsing/disappearing, Commenting out lines 158 & 159 in Rhyme's Script (self.opacity = 255 & self.visible = true) makes the enemy instantly disappear when dead instead of visibly looping its death frames, but upon killing every enemy in a troop the combat doesn't end and I'm given a choice to heal/use item/attack which crashes the game with a Divide by Zero since there are no targets left to attack :S

    I like the simplicity of Rhyme's animation script even though I really only need the enemy idle, damaged, and attack animations so I would love to find a way to make it compatible with Yanfly, even if it results in a compromise (I don't even mind the damage dealt/enemy HP bars etc not showing) but the bug with the sprites not disappearing or following their collapse animations after death and combat not ending once all enemies have been killed is a game-breaker and I don't know how to fix the compatibility issue for the update_popups/@popups/setup_popups errors in lines 848-919 without just removing the problematic lines.

    Edit: I may as well post my (slightly modified) Rhyme's animated enemies script, possibly somebody out there has a better modified version of it that's compatible with Yanfly or takes into account the above problems?

    Spoiler
    #==============================================================================

    # ■ Animated Enemy Sprites

    # Merry Christmas and happy holidays!

    #==============================================================================

    # Notebox Tag:

    # Enemy: !Flip

    #==============================================================================

    # Spritesheet Data for referencing

    #

    # 0. Idle

    # 1. Defend

    # 2. Weak

    # 3. Damaged/Dead

    # 4. Attack

    # 5. Item

    # 6. Skill

    # 7. Magic

    # 8. Advance (n/a)

    # 9. Retreat (n/a)

    # 10. Victory (n/a)

    # 11. Enter

    # 12. Dead

    # 13. Credits and/or etc (n/a)

    #==============================================================================

    #   ~rhyme

    #==============================================================================

    module Animated_Enemy_Sprites

      Delay = 15

      FrameSize = [3, 14]

      DefaultBlink = false

    end

    #==============================================================================

    # ■ Game_Battler

    #==============================================================================

    class Game_Battler < Game_BattlerBase

      attr_accessor :pose

      #--------------------------------------------------------------------------

      # ● Flip

      #--------------------------------------------------------------------------

      def flip_sprite

        return false

      end

      #--------------------------------------------------------------------------

      # ● Reset Pose

      #--------------------------------------------------------------------------

      def reset_pose

        @pose = 0

        @pose = 2 if @hp < mhp / 4

        if @states != nil

     @pose = 2 if @states.size > 0

        end

        @pose = 1 if guard?

        @pose = 3 if dead?

      end

      #--------------------------------------------------------------------------

      # ● Use Item

      #--------------------------------------------------------------------------

      alias use_item_ani use_item

      def use_item(item)

        if item.is_a?(RPG::Item)

     @pose = 4

        else

     if item.is_a?(RPG::Skill)

       if item.id == attack_skill_id

     @pose = 4

       elsif item.physical?

     @pose = 6

       elsif item.magical?

     @pose = 7

       end

     end

        end

        use_item_ani(item)

      end

      #--------------------------------------------------------------------------

      # ● Perform Damage

      #--------------------------------------------------------------------------

      alias perform_map_damage_effect_ani perform_map_damage_effect

      def perform_map_damage_effect

        perform_map_damage_effect_ani

        @pose = 3 unless @guarding

      end

      #--------------------------------------------------------------------------

      # ● Upon Damage

      #--------------------------------------------------------------------------

      alias on_damage_ani on_damage

      def on_damage(value)

        @pose = 3 unless @guarding

        on_damage_ani(value)

      end

    end

    #==============================================================================

    # ■ Game_Enemy

    #==============================================================================

    class Game_Enemy < Game_Battler

      #--------------------------------------------------------------------------

      # ● Flip

      #--------------------------------------------------------------------------

      def flip_sprite

        return true if Scan::string($data_enemies[@enemy_id].note, "!Flip")

        return super

      end

    end

    #==============================================================================

    # ■ Sprite_Battler

    #==============================================================================

    class Sprite_Battler < Sprite_Base

      attr_accessor :battler

      #--------------------------------------------------------------------------

      # ● Initialize

      #--------------------------------------------------------------------------

      def initialize(viewport, battler = nil)

        super(viewport)

        @battler = battler

        @battler_visible = false

        @effect_type = nil

        @effect_duration = 0

        @spritesheet = true

        @pose = 11

        @counter = 0

        @delay = Animated_Enemy_Sprites::Delay

        @frame_size = Animated_Enemy_Sprites::FrameSize

      end

      #--------------------------------------------------------------------------

      # ● Frame Update

      #--------------------------------------------------------------------------

      def update

        super

        if @battler

     @battler.reset_pose if @battler.pose == nil

     self.mirror = @battler.flip_sprite

     @use_sprite = @battler.use_sprite?

     if @spritesheet

       update_pose if @pose != 11

     end

     if Graphics.frame_count % @delay == 0

       @counter += 1

       if @counter >= @frame_size[0]

     @counter = 0

     if @pose == 11

       update_pose

     else

       @battler.reset_pose

     end

       end

     end

     if @use_sprite

       update_bitmap

       update_origin

       update_position

     end

     setup_new_effect

     setup_new_animation

     update_effect

        else

     @effect_type = nil

        end

        #self.opacity = 255

        #self.visible = true

      end

      #--------------------------------------------------------------------------

      # ● Update bitmap

      #--------------------------------------------------------------------------

      def update_bitmap

        if @spritesheet

     @spritesheet_bitmap = Cache.battler(@battler.battler_name + "-spritesheet", @battler.battler_hue)

     ss_size = [@spritesheet_bitmap.width, @spritesheet_bitmap.height]

     new_bitmap = Bitmap.new(ss_size[0] / @frame_size[0], ss_size[1] / @frame_size[1])

     cx = @counter * (ss_size[0] / @frame_size[0])

     cy = @pose * (ss_size[1] / @frame_size[1])

     crop_rect = Rect.new(cx, cy, ss_size[0], ss_size[1])

     new_bitmap.blt(0, 0, @spritesheet_bitmap, crop_rect)

        else

     new_bitmap = Cache.battler(@battler.battler_name, @battler.battler_hue)

        end

        if bitmap != new_bitmap

     self.bitmap = new_bitmap

     init_visibility

        end

      end

      #--------------------------------------------------------------------------

      # ● Update Pose

      #--------------------------------------------------------------------------

      def update_pose

        oldpose = @pose

        newpose = @battler.pose

        if newpose != oldpose

     @counter = 0

     @pose = newpose

        end

      end

      #--------------------------------------------------------------------------

      # ● Blink

      #--------------------------------------------------------------------------

      def update_blink

        self.opacity = (@effect_duration % 10 < 5) ? 255 : 0 if Animated_Enemy_Sprites::DefaultBlink

      end

    end

    #============================================================================

    # ▼ Scan

    #============================================================================

    module Scan

      #--------------------------------------------------------------------------

      # ● Scan.string(object, string)

      #--------------------------------------------------------------------------

      def self.string(object, string)

        if object[/#{Regexp.quote string}/]

     return true

        end

        return false

      end

    end
  3. I've moved this thread to RGSS3 Script Requests. Please be sure to post your threads in the correct forum next time. Thank you.
  4. I have Yanfly's scripts + Rhymes on one of my older projects, and I don't get errors.


    You could try to find another pop-up script and disable the popups from yanfly's.
  5. Do you remember if you edited Rhyme's script or Yanfly's? I don't like that Rhyme's leaves an enemy corpse behind in a death animation loop but I can at least make it invisible, however I really have no idea why the combat refuses to end when all enemies in a troop are dead
  6. The only thing I did as far as I can remember was that I modified the stances to only use idle since I actually only need the idle stance. I'm not sure if I included editing it to remove the sprites if the battler is already dead, but maybe I did coz I'm sure the sprites go away when the battler dies last time I tested it.

    As for the battles not ending, never had that problem.
  7. Mog hunter have a battler pose in is master demo he made 
  8. The only thing I did as far as I can remember was that I modified the stances to only use idle since I actually only need the idle stance. I'm not sure if I included editing it to remove the sprites if the battler is already dead, but maybe I did coz I'm sure the sprites go away when the battler dies last time I tested it.

    As for the battles not ending, never had that problem.
    Mog hunter have a battler pose in is master demo he made 

    Well, I made some progress and fixed the never-ending battle bug by changing around the load order of my scripts. The animated enemies actually * mostly* work with Yanfly, I am still missing popups and would like to get Rhyme's animated enemies to work with: http://www.rpgmakervxace.net/topic/19425-custom-collapse-effects/ instead of having them instantly vanish on death / be stuck in the death animation frames loop, but at least I am not getting any game-crashing errors right now =]

    Also both of those replies were helpful, since I realized a problem in the load order was causing the strange never-ending battle bug and not some lines in either of the scripts. I looked up and download mog's battlers demo and its waaaay more complicated than what I'm trying to do but has a lot of cool things in it, + it's the only front view battle i've seen that doesn't use actor animations in combat which is also what I am doing. It's useful but I'm so close to getting Rhyme's to work with Yanfly and now that I know its possible I'd rather stick with it.    
  9. Never used collapse effect so I can't help with that. For pop-ups, I'd really suggest using a stand-alone pop-up script in case Yanfly's doesn't really work with it. I'm going to check my old projects and see what scripts I have in there.

    I found it, the popup that I'm using which works fine with Rhymes was the stand-alone damage pop-up script add-on for BattleLuna. I forgot where I got it though, probably a member+ thingy. I placed it below Rhymes

    EDIT: Here's the github link: https://github.com/suppayami/rmvxa-collection/blob/master/Battle%20Damage%20Popup.rb
  10. Thanks for the script! Copied it into the game and looks like it works great, don't have time to test in depth until i'm not busy working later in the week. The collapse effect for the enemy death anims ~ right now with Rhyme's script I only have two options 1) Either the enemy will loop its "dead" animation forever until the battle ends, which i don't want a corpse left or 2) Enemy instantly becomes invisible when it dies, which looks really weird. I just want the dead enemy 'corpse' to disappear after disintegrating / fading into white/ collapsing / whatever, so its not as abrupt like instantly vanishing.

    Besides that one thing, Yanfly's (slightly altered) battle engine + addons, Rhyme's animated enemies and the BattleLuna popup add-on seem to be cooperating together. Which is amazing progress so far, since after trying myself and spending some time searching for a front view battle system with animated enemies only, I didn't find anything except some unanswered threads like this one :o
  11. Yeah, they're instagone when they die...