State Name Cycling

Lord Vectra

Master Eventer
Veteran
Joined
Dec 6, 2015
Messages
199
Reaction score
327
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


The main character of the book)
Things you can say about your rpg maker project but not your bf/gf: I'm not super committed but it's fun to play around with it.
putting a puzzle in my game that BSODs the player's computer if they complete it
I finally got a book out the door after seven years of nothing \^-^/ Now if I can get a game out the door too, that'd be great...

Forum statistics

Threads
94,366
Messages
920,300
Members
124,131
Latest member
Tharene
Top