State Name Cycling

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
200
Reaction score
328
First Language
English
Primarily Uses
RMVXA
So do you know how XP shows only one state on enemies and actors alike? I know the state icons script exist, but I want to keep the [State Name] but have it cycle through all of them. There is this script by Atoa that does something similar but does it for the state animations instead. I would like them to be compatible and ideally in unison so the name and animations changes at the same time.

Code:
#==============================================================================
# Atoa State Cycling
# by Atoa
#==============================================================================
module Atoa
  # Increase the time between the animation change.
  State_Cycle_Time = 4
end

#==============================================================================
# Game_Battler
#==============================================================================
class Game_Battler
  #--------------------------------------------------------------------------
  include Atoa
  #--------------------------------------------------------------------------
  attr_accessor :state_animation_id
  #--------------------------------------------------------------------------
  alias atoa_state_initialize initialize
  def initialize
    atoa_state_initialize
    @state_frame = @state_animation_id = 0
    @anim_states = []
  end
  #--------------------------------------------------------------------------
  def state_animation_id
    return 0 if @states.empty?
    return 0 if @states.include?(1)
    @state_frame -= 1 if @state_frame > 0
    return @state_animation_id if @state_frame > 0
    if @anim_states.empty?
      for state in @states
        @anim_states << state if $data_states[state].animation_id > 0
      end
    end
    now_state = @anim_states.shift
    return 0 if now_state.nil?
    @state_animation_id = $data_states[now_state].animation_id
    return 0 if $data_animations[@state_animation_id].nil?
    @state_frame = $data_animations[@state_animation_id].frame_max * State_Cycle_Time * 2
    return @state_animation_id
  end
end
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

"Your service has been identified as part of an outage. This is expected to be restored by 7pm IN SEVEN DAYS!!!" Guess I won't be around as much over the next week :(
Ami
tethering is my lifesaver,especially when computer or laptop doesn't support internet connection.
convention concluded, i'm glad the books well received and sold out
not every content is decent, but i'll be better for the next work.

now back to game developing
I hope to be able to post my vxace resource edits this Wednesday.
Not sure if I'll get to the library though.
Me: Man, I'm definitely burned out this time. Time for a break. Me three hours later: I'm ready to work again, let's go! Me another hour later: Okay, I can't do this anymore. Repeat for infinity.

Forum statistics

Threads
94,462
Messages
921,105
Members
124,291
Latest member
brittellis
Top