Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Use all State animations at once!

In RMXP, I find myself doing a lot of things with creative use of States.  But I can only have one State animation visible at a time, which limits a lot of things. 

Is there any way that some kind soul could help me with a script that would make all applicable State animations run at the same time?
 
I have alternating animations in my BS, each lasting for one second (that could be easily changed though). Would that be ok? Because if you want all animations at the same time that would be scripting-wise a bit too complicated and sometimes not very good loking too.

I could extrapolate the code from the bs...
 
That would be good for some things, at least.  (I use states for things like being transformed into other forms, or shifting one's weapon into blocking mode, so it wouldn't be perfect, but I'll settle for what I can get...)
 
Code:
CYCLING_FRAMES=20

class Game_Battler
  attr_accessor :state_shown
  alias cycling_anim_initialize initialize
  def initialize
    cycling_anim_initialize
    @state_shown=0
  end

  def state_animation_id
    # If no states are added
    if @states.size == 0
      return 0
    end
    # Return 0 if dead
    if @states.include?(0)
      return 0
    end    
    # Return state animation ID
    return $data_states[@states[(@state_shown-1)%@states.size()]].animation_id
  end
  
  def cycle_state
    @state_shown+=1
  end    
end

class Scene_Battle
  alias cycling_main main
  def main
    @cycling_anim_counter=CYCLING_FRAMES
    cycling_main
  end
  
  alias cycling_anim_update update
  def update
    cycling_anim_update
    @cycling_anim_counter-=1
    if @cycling_anim_counter==0
      for actor in $game_party.actors
        actor.cycle_state
      end
      @cycling_anim_counter=CYCLING_FRAMES
    end
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top