[XP]Please help me !(SDK Removal)

Started by Rudria, September 03, 2011, 11:53:41 pm

Previous topic - Next topic

Rudria

September 03, 2011, 11:53:41 pm Last Edit: September 03, 2011, 11:58:39 pm by game_guy
For expert scripter,
Should you remove SDK need from this script,

State Cycling by Trickster

Part 1 (Setup)
Spoiler: ShowHide

#==============================================================================
# ●● State Cycling
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 4.1
# Date 4/27/07
# Goto RMXP.org for updates/bug reports/comment
#==============================================================================
#--------------------------------------------------------------------------
# * Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('State Cycling', 'Trickster', 4.1, '4.27.07')

#--------------------------------------------------------------------------
# * Begin SDK Requirement Check
#--------------------------------------------------------------------------
SDK.check_requirements(2.0, [1, 2, 3])

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?('State Cycling')
 
module State_Cycling
 #--------------------------------------------------------------------------
 # * State Change Speed
 #--------------------------------------------------------------------------
 Speed = 100
 #--------------------------------------------------------------------------
 # * High Priority States
 #--------------------------------------------------------------------------
 High_Priority = [1]
 #--------------------------------------------------------------------------
 # * Use Viewport
 #   - Use A Viewport for the Sprite (For Side View Battle Systems
 #--------------------------------------------------------------------------
 Use_Viewport = true
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end



Part 2 (Sprite_ActorStateText)
Spoiler: ShowHide

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?('State Cycling')
 
class Sprite_ActorStateText < Sprite
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :level_up
 #--------------------------------------------------------------------------
 # * Initialize
 #--------------------------------------------------------------------------
 def initialize(actor, x, y, width)
   # Get Actor Viewport if in scene battle else nil
   viewport = $game_temp.in_battle ? $scene.spriteset.viewport2 : nil
   # Set Viewport to nil if not using viewport
   viewport = nil if not State_Cycling::Use_Viewport
   # Call Sprite#initialize
   super(viewport)
   # Set Position
   self.x, self.y, self.z = x, y, actor.screen_z + 1
   # Set Z to 101 if no viewport defined
   self.z = 101 if viewport.nil?
   # Setup Width
   @width = width
   # Setup Bitmap
   self.bitmap = Bitmap.new(@width, 32)
   # Setup Actor Instance Variable
   @actor = actor
   # Set Counter
   @count = 0
   # Set Level Up Flag
   @level_up = false
   # Refresh
   refresh
 end
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 def update
   # Call Sprite#update
   super
   # Increase counter
   @count = (@count + 1) % State_Cycling::Speed
   # Refresh if @count is 0
   refresh if @count == 0 || @actor.state_changed || @level_up
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   # Clear Bitmap
   self.bitmap.clear
   # Get State
   state = $data_states[@actor.current_state]
   # If state is nil then Normal else Name
   text = state.nil? ? '[Normal]' : '[' + state.name + ']'
   # Draw Text from Memory (MACL)
   self.bitmap.draw_text_memory(0, 0, @width, 32, text)
   # Reset Actor State Changed Flag
   @actor.state_changed = false
 end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end



Part 3 (Edits To Classes)
Spoiler: ShowHide

#--------------------------------------------------------------------------
# * Begin SDK Enable Test
#--------------------------------------------------------------------------
if SDK.enabled?('State Cycling')
 
class Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_base_initialize, :initialize
 def initialize(*args)
   # Setup Bar Sprites
   @state_sprites = {}
   # The Usual
   trick_cycle_base_initialize(*args)
 end
 #--------------------------------------------------------------------------
 # * Draw State
 #     actor : actor
 #     x     : draw spot x-coordinate
 #     y     : draw spot y-coordinate
 #     width : draw spot width
 #--------------------------------------------------------------------------
 def draw_actor_state(actor, x, y, width = 120)
   # Return if sprite is already set up
   return if @state_sprites[actor] != nil
   # Setup the bar
   dx, dy = self.x + x + 16, self.y + y + 16
   # Create Sprite
   sprite = Sprite_ActorStateText.new(actor, dx, dy, width)
   # Tag Sprite
   sprite.tag(self)
   # Set Reference
   @state_sprites[actor] = sprite
   # Add Sprite to Window Sprites
   @window_sprites << sprite
 end
 #--------------------------------------------------------------------------
 # * Dispose
 #--------------------------------------------------------------------------  
 alias_method :trick_cycle_base_dispose, :dispose
 def dispose
   # The Usual
   trick_cycle_base_dispose
   # Clear Text Memory
   # (Removes all items drawn by <bitmap>.draw_text_memory)
   Bitmap.clear_text_memory if not @state_sprites.empty?
 end
end

class Window_BattleStatus
 #--------------------------------------------------------------------------
 # * Level Up
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battlestatus_level_up, :level_up
 def level_up(actor_index)
   # The Usual
   trick_cycle_battlestatus_level_up(actor_index)
   # Get Actor
   actor = $game_party.actors[actor_index]
   # Set State Sprite to Invisible if exists and has key
   if @state_sprites != nil and @state_sprites.has_key?(actor)
     # Set Level Up Flag
     @state_sprites[actor].level_up = true
   end
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battlestatus_refresh, :refresh
 def refresh
   # The Usual
   trick_cycle_battlestatus_refresh
   # If Sprites is not nil
   if @state_sprites != nil
     # Run Through Each Actor
     $game_party.actors.each do |actor|
       # If Sprite Level Up Flag set Invisible
       @state_sprites[actor].visible = !@state_sprites[actor].level_up
     end
   end
 end
end

class Window_Help < Window_Base
 #--------------------------------------------------------------------------
 # * Alias Listings
 #--------------------------------------------------------------------------
 if @trick_state_cycle_help.nil?
   alias_method :trick_cycle_help_visible=, :visible=
   @trick_state_cycle_help = true
 end
 #--------------------------------------------------------------------------
 # * Set Visibility
 #--------------------------------------------------------------------------
 def visible=(bool)
   # The Usual
   self.trick_cycle_help_visible = bool
   # If Setting to Invisible
   if bool == false
     # Dispose All
     @state_sprites.each_value {|sprite| sprite.dispose}
     # Remove Each From Window Sprites
     @state_sprites.each_value {|sprite| @window_sprites.delete(sprite)}
     # Clear Hash
     @state_sprites.clear
   # If Actor Defined
   elsif @actor != nil
     # Set All to Invisible
     @state_sprites.each_value {|sprite| sprite.visible = false}
     # Set State sprite to Visible
     @state_sprites[@actor].visible = true
   end
 end
 #--------------------------------------------------------------------------
 # * Set Actor
 #     actor : status displaying actor
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_help_set_actor, :set_actor
 def set_actor(actor)
   # If Actor Change and An Actor
   if actor != @actor and @actor != nil
     # Set Old Actor State to invisible
     @state_sprites[@actor].visible = false
     # Set New Actor State to visible if sprite exists
     @state_sprites[actor].visible = true if @hp_bar_sprites.has_key?(actor)
   end
   # The Usual
   trick_cycle_help_set_actor(actor)
 end
 #--------------------------------------------------------------------------
 # * Set Text
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_help_set_text, :set_text
 def set_text(*args)
   # Dispose All
   @state_sprites.each_value {|sprite| sprite.dispose}
   # Remove Each From Window Sprites
   @state_sprites.each_value {|sprite| @window_sprites.delete(sprite)}
   # Clear Hash
   @state_sprites.clear
   # The Usual
   trick_cycle_help_set_text(*args)
 end
end

class Game_Battler
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :state_changed
 attr_accessor :state_index
 attr_accessor :state_count
 attr_accessor :shown_states
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battler_initialize, :initialize
 def initialize
   # The Usual
   trick_cycle_battler_initialize
   # Setup Instance Variables
   @state_changed = false
   @state_index = 0
   @state_count = 0
   @shown_states = []
 end
 #--------------------------------------------------------------------------
 # * Reset States
 #--------------------------------------------------------------------------
 def reset_states
   # Clear
   @shown_states.clear
   # Return if states size is 0
   return if states.size == 0
   # Run Through High Priority States
   State_Cycling::High_Priority.each do |state_id|
     # if included?
     if @shown_states.include?(state_id)
       # Set to only that state
       @shown_states = [state_id]
       # Break
       break
     end
   end
   # If Shown States are empty?
   if @shown_states.empty?
     # Run through all states
     states.each do |state_id|
       # Get State
       state = $data_states[state_id]
       # Push State Id if rating is not 0
       @shown_states << state_id if state.rating >= 1
     end
   end
   # If Count is zero Increment State Index Restrict to [0, states.size-1]
   @state_index = (@state_index + 1) % @shown_states.size if @state_count == 0
 end
 #--------------------------------------------------------------------------
 # * Current State
 #--------------------------------------------------------------------------
 def current_state
   # Reset States
   reset_states
   # Return 0 if empty or current state
   return @shown_states.empty? ? 0 : @shown_states[@state_index].to_i
 end
 #--------------------------------------------------------------------------
 # * Get State Animation ID
 #--------------------------------------------------------------------------
 def state_animation_id
   # If no states are added
   return 0 if states.size == 0
   # Get State
   state = $data_states[current_state]
   # Return state animation ID
   return state.nil? ? 0 : state.animation_id
 end
 #--------------------------------------------------------------------------
 # * Add State
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battler_add_state, :add_state
 def add_state(*args)
   # Create Copy of States
   states = self.states.dup
   # The Usual
   trick_cycle_battler_add_state(*args)
   # If An Actor and in battle
   if self.is_a?(Game_Actor) and $game_temp.in_battle
     # Set State Changed Flag
     self.state_changed = self.states != states
   end
 end
 #--------------------------------------------------------------------------
 # * Remove State
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battler_remove_state, :remove_state
 def remove_state(*args)
   # Create Copy of States
   states = self.states.dup
   # The Usual
   trick_cycle_battler_remove_state(*args)
   # If An Actor and in battle
   if self.is_a?(Game_Actor) and $game_temp.in_battle
     # Set State Changed Flag
     self.state_changed = self.states != states
   end
 end
end

class Sprite_Battler
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_battler_update, :update
 def update
   # If Battler is defined
   if @battler != nil
     # Add 1 to state count
     @battler.state_count = (@battler.state_count + 1) % State_Cycling::Speed
   end
   # The Usual
   trick_cycle_battler_update
 end
end
 
class Scene_Battle
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader :spriteset
end

class SDK::Scene_Base
 #--------------------------------------------------------------------------
 # * Main Processing
 #--------------------------------------------------------------------------
 alias_method :trick_cycle_skill_main_variable, :main_variable
 def main_variable
   # If Game Party is not nil
   unless $game_party.nil?
     # Run Through Each Actor
     $game_party.actors.each do |actor|
       # State Changed
       actor.state_changed = false
       # Reset State index
       actor.state_index = 0
       # Reset State Count
       actor.state_count = 0
     end
   end
   # The Usual
   trick_cycle_skill_main_variable
 end
end
#--------------------------------------------------------------------------
# * End SDK Enable Test
#--------------------------------------------------------------------------
end



That all !!!
Hey, My picture is NOT cloud, it real my face.
(before My face burned)

G_G

Please use code tags when posting scripts. I did it for you. I'll take a look at the script and see what I can do.

Rudria

Haha... sorry ! :^_^':
and thankyou for fixing it ! :haha:
Hey, My picture is NOT cloud, it real my face.
(before My face burned)

G_G

September 04, 2011, 12:21:46 am #3 Last Edit: September 04, 2011, 12:23:12 am by game_guy
I removed all of the SDK parts. But there was a class in part 3 that is only found in the SDK. I went ahead and removed it but I'm positive the script won't work that well. So what I did was just add a few classes for a work around.

Part 1: ShowHide
#==============================================================================
# ?? State Cycling
#------------------------------------------------------------------------------
# Trickster (tricksterguy@hotmail.com)
# Version 4.1
# Date 4/27/07
# Goto RMXP.org for updates/bug reports/comment
#==============================================================================

module State_Cycling
 #--------------------------------------------------------------------------
 # * State Change Speed
 #--------------------------------------------------------------------------
 Speed = 100
 #--------------------------------------------------------------------------
 # * High Priority States
 #--------------------------------------------------------------------------
 High_Priority = [1]
 #--------------------------------------------------------------------------
 # * Use Viewport
 #   - Use A Viewport for the Sprite (For Side View Battle Systems
 #--------------------------------------------------------------------------
 Use_Viewport = true
end


Part 2: ShowHide

class Sprite_ActorStateText < Sprite
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_accessor :level_up
 #--------------------------------------------------------------------------
 # * Initialize
 #--------------------------------------------------------------------------
 def initialize(actor, x, y, width)
   # Get Actor Viewport if in scene battle else nil
   viewport = $game_temp.in_battle ? $scene.spriteset.viewport2 : nil
   # Set Viewport to nil if not using viewport
   viewport = nil if not State_Cycling::Use_Viewport
   # Call Sprite#initialize
   super(viewport)
   # Set Position
   self.x, self.y, self.z = x, y, actor.screen_z + 1
   # Set Z to 101 if no viewport defined
   self.z = 101 if viewport.nil?
   # Setup Width
   @width = width
   # Setup Bitmap
   self.bitmap = Bitmap.new(@width, 32)
   # Setup Actor Instance Variable
   @actor = actor
   # Set Counter
   @count = 0
   # Set Level Up Flag
   @level_up = false
   # Refresh
   refresh
 end
 #--------------------------------------------------------------------------
 # * Update
 #--------------------------------------------------------------------------
 def update
   # Call Sprite#update
   super
   # Increase counter
   @count = (@count + 1) % State_Cycling::Speed
   # Refresh if @count is 0
   refresh if @count == 0 || @actor.state_changed || @level_up
 end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   # Clear Bitmap
   self.bitmap.clear
   # Get State
   state = $data_states[@actor.current_state]
   # If state is nil then Normal else Name
   text = state.nil? ? '[Normal]' : '[' + state.name + ']'
   # Draw Text from Memory (MACL)
   self.bitmap.draw_text_memory(0, 0, @width, 32, text)
   # Reset Actor State Changed Flag
   @actor.state_changed = false
 end
end


Part 3: ShowHide

class Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_base_initialize, :initialize
  def initialize(*args)
    # Setup Bar Sprites
    @state_sprites = {}
    # The Usual
    trick_cycle_base_initialize(*args)
  end
  #--------------------------------------------------------------------------
  # * Draw State
  #     actor : actor
  #     x     : draw spot x-coordinate
  #     y     : draw spot y-coordinate
  #     width : draw spot width
  #--------------------------------------------------------------------------
  def draw_actor_state(actor, x, y, width = 120)
    # Return if sprite is already set up
    return if @state_sprites[actor] != nil
    # Setup the bar
    dx, dy = self.x + x + 16, self.y + y + 16
    # Create Sprite
    sprite = Sprite_ActorStateText.new(actor, dx, dy, width)
    # Tag Sprite
    sprite.tag(self)
    # Set Reference
    @state_sprites[actor] = sprite
    # Add Sprite to Window Sprites
    @window_sprites << sprite
  end
  #--------------------------------------------------------------------------
  # * Dispose
  #-------------------------------------------------------------------------- 
  alias_method :trick_cycle_base_dispose, :dispose
  def dispose
    # The Usual
    trick_cycle_base_dispose
    # Clear Text Memory
    # (Removes all items drawn by <bitmap>.draw_text_memory)
    Bitmap.clear_text_memory if not @state_sprites.empty?
  end
end

class Window_BattleStatus
  #--------------------------------------------------------------------------
  # * Level Up
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battlestatus_level_up, :level_up
  def level_up(actor_index)
    # The Usual
    trick_cycle_battlestatus_level_up(actor_index)
    # Get Actor
    actor = $game_party.actors[actor_index]
    # Set State Sprite to Invisible if exists and has key
    if @state_sprites != nil and @state_sprites.has_key?(actor)
      # Set Level Up Flag
      @state_sprites[actor].level_up = true
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battlestatus_refresh, :refresh
  def refresh
    # The Usual
    trick_cycle_battlestatus_refresh
    # If Sprites is not nil
    if @state_sprites != nil
      # Run Through Each Actor
      $game_party.actors.each do |actor|
        # If Sprite Level Up Flag set Invisible
        @state_sprites[actor].visible = !@state_sprites[actor].level_up
      end
    end
  end
end

class Window_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Alias Listings
  #--------------------------------------------------------------------------
  if @trick_state_cycle_help.nil?
    alias_method :trick_cycle_help_visible=, :visible=
    @trick_state_cycle_help = true
  end
  #--------------------------------------------------------------------------
  # * Set Visibility
  #--------------------------------------------------------------------------
  def visible=(bool)
    # The Usual
    self.trick_cycle_help_visible = bool
    # If Setting to Invisible
    if bool == false
      # Dispose All
      @state_sprites.each_value {|sprite| sprite.dispose}
      # Remove Each From Window Sprites
      @state_sprites.each_value {|sprite| @window_sprites.delete(sprite)}
      # Clear Hash
      @state_sprites.clear
    # If Actor Defined
    elsif @actor != nil
      # Set All to Invisible
      @state_sprites.each_value {|sprite| sprite.visible = false}
      # Set State sprite to Visible
      @state_sprites[@actor].visible = true
    end
  end
  #--------------------------------------------------------------------------
  # * Set Actor
  #     actor : status displaying actor
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_help_set_actor, :set_actor
  def set_actor(actor)
    # If Actor Change and An Actor
    if actor != @actor and @actor != nil
      # Set Old Actor State to invisible
      @state_sprites[@actor].visible = false
      # Set New Actor State to visible if sprite exists
      @state_sprites[actor].visible = true if @hp_bar_sprites.has_key?(actor)
    end
    # The Usual
    trick_cycle_help_set_actor(actor)
  end
  #--------------------------------------------------------------------------
  # * Set Text
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_help_set_text, :set_text
  def set_text(*args)
    # Dispose All
    @state_sprites.each_value {|sprite| sprite.dispose}
    # Remove Each From Window Sprites
    @state_sprites.each_value {|sprite| @window_sprites.delete(sprite)}
    # Clear Hash
    @state_sprites.clear
    # The Usual
    trick_cycle_help_set_text(*args)
  end
end

class Game_Battler
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :state_changed
  attr_accessor :state_index
  attr_accessor :state_count
  attr_accessor :shown_states
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battler_initialize, :initialize
  def initialize
    # The Usual
    trick_cycle_battler_initialize
    # Setup Instance Variables
    @state_changed = false
    @state_index = 0
    @state_count = 0
    @shown_states = []
  end
  #--------------------------------------------------------------------------
  # * Reset States
  #--------------------------------------------------------------------------
  def reset_states
    # Clear
    @shown_states.clear
    # Return if states size is 0
    return if states.size == 0
    # Run Through High Priority States
    State_Cycling::High_Priority.each do |state_id|
      # if included?
      if @shown_states.include?(state_id)
        # Set to only that state
        @shown_states = [state_id]
        # Break
        break
      end
    end
    # If Shown States are empty?
    if @shown_states.empty?
      # Run through all states
      states.each do |state_id|
        # Get State
        state = $data_states[state_id]
        # Push State Id if rating is not 0
        @shown_states << state_id if state.rating >= 1
      end
    end
    # If Count is zero Increment State Index Restrict to [0, states.size-1]
    @state_index = (@state_index + 1) % @shown_states.size if @state_count == 0
  end
  #--------------------------------------------------------------------------
  # * Current State
  #--------------------------------------------------------------------------
  def current_state
    # Reset States
    reset_states
    # Return 0 if empty or current state
    return @shown_states.empty? ? 0 : @shown_states[@state_index].to_i
  end
  #--------------------------------------------------------------------------
  # * Get State Animation ID
  #--------------------------------------------------------------------------
  def state_animation_id
    # If no states are added
    return 0 if states.size == 0
    # Get State
    state = $data_states[current_state]
    # Return state animation ID
    return state.nil? ? 0 : state.animation_id
  end
  #--------------------------------------------------------------------------
  # * Add State
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battler_add_state, :add_state
  def add_state(*args)
    # Create Copy of States
    states = self.states.dup
    # The Usual
    trick_cycle_battler_add_state(*args)
    # If An Actor and in battle
    if self.is_a?(Game_Actor) and $game_temp.in_battle
      # Set State Changed Flag
      self.state_changed = self.states != states
    end
  end
  #--------------------------------------------------------------------------
  # * Remove State
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battler_remove_state, :remove_state
  def remove_state(*args)
    # Create Copy of States
    states = self.states.dup
    # The Usual
    trick_cycle_battler_remove_state(*args)
    # If An Actor and in battle
    if self.is_a?(Game_Actor) and $game_temp.in_battle
      # Set State Changed Flag
      self.state_changed = self.states != states
    end
  end
end

class Sprite_Battler
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_battler_update, :update
  def update
    # If Battler is defined
    if @battler != nil
      # Add 1 to state count
      @battler.state_count = (@battler.state_count + 1) % State_Cycling::Speed
    end
    # The Usual
    trick_cycle_battler_update
  end
end
 
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader :spriteset
end

class Scene_Menu
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_skill_main_variable, :main
  def main
    # If Game Party is not nil
    unless $game_party.nil?
      # Run Through Each Actor
      $game_party.actors.each do |actor|
        # State Changed
        actor.state_changed = false
        # Reset State index
        actor.state_index = 0
        # Reset State Count
        actor.state_count = 0
      end
    end
    # The Usual
    trick_cycle_skill_main_variable
  end
end

class Scene_Battle
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_skill_main_variable, :main
  def main
    # If Game Party is not nil
    unless $game_party.nil?
      # Run Through Each Actor
      $game_party.actors.each do |actor|
        # State Changed
        actor.state_changed = false
        # Reset State index
        actor.state_index = 0
        # Reset State Count
        actor.state_count = 0
      end
    end
    # The Usual
    trick_cycle_skill_main_variable
  end
end

class Scene_Map
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  alias_method :trick_cycle_skill_main_variable, :main
  def main
    # If Game Party is not nil
    unless $game_party.nil?
      # Run Through Each Actor
      $game_party.actors.each do |actor|
        # State Changed
        actor.state_changed = false
        # Reset State index
        actor.state_index = 0
        # Reset State Count
        actor.state_count = 0
      end
    end
    # The Usual
    trick_cycle_skill_main_variable
  end
end


Rudria

awesome !!! :-*
but when I try it, it say
line11: NoMethodError Occured
undefinied method 'viewport2' for nil:NillClass  :???:
then what must I do ???
Hey, My picture is NOT cloud, it real my face.
(before My face burned)

G_G

September 04, 2011, 01:08:01 am #5 Last Edit: September 04, 2011, 01:36:40 am by game_guy
Add this little snippet above all 3 parts.
class Spriteset_Battle
 attr_accessor :viewport2
end


My bad I had the wrong class name. This should work.

Rudria

thank!  :)
but, again, it say 
script 'part2' line 14: NoMethodError Occured
undefinied method 'viewport2' for nil:NillClass
then what must I do (again) :plz: :sos: :bow:
Hey, My picture is NOT cloud, it real my face.
(before My face burned)

G_G

Quote from: game_guy on September 04, 2011, 01:08:01 am
Add this little snippet above all 3 parts.
class Spriteset_Battle
  attr_accessor :viewport2
end


My bad I had the wrong class name. This should work.

Rudria

G_G you know ???
State cycling Original script not only need sdk but need several support script.

bitmap.memory
Spoiler: ShowHide

=begin
==============================================================================
** Bitmap.memory
------------------------------------------------------------------------------
Description:
------------
 Specialized Methods for tbe bitmap class for remembering text. Also includes
 a non-laggy draw_text method based on the original draw text which stores the
 text in memory and calls blt instead of draw_text if it is needed again. One
 thing to remember is to call Bitmap.clear_text_memory
 Bitmap.clear_formatted_text_memory to dispose of all memorized sprites
 when you are finished (preferably at the end of a scene).
   
 When Benchmarked drawing the string 'Hello World '*5 100 times the results
   draw_text_memory around 0.266 seconds
   draw_wrap_text_memory around 1.969 seconds
   draw_formatted_text_memory around 0.266 seconds
   draw_text around 6.235 seconds
 
Method List:
------------
 Bitmap.clear_text_memory
 Bitmap.clear_formatted_text_memory
 clear_memory
 cleat_to_memory
 draw_formatted_text_memory
 draw_text_memory
 draw_wrap_text_memory
 get_formatted_size (from Bitmap.text)
 set_memory
 
Support Methods:
-------------
 class Hash
   contains_key?
   get_value
 class Font
   == (comparision equals)
==============================================================================
=end

MACL::Loaded << 'Bitmap.memory'

class Bitmap
 #--------------------------------------------------------------------------
 # * Class Variables
 #--------------------------------------------------------------------------
 class_reader :text_memory, :formatted_text_memory
 #-------------------------------------------------------------------------
 # * Class Variables
 #-------------------------------------------------------------------------
 @@text_memory, @@formatted_text_memory = {}, {}
 #-------------------------------------------------------------------------
 #   Name      : Clear Text Memory
 #   Info      : Clears Text Memory
 #   Author    : Trickster
 #   Call Info : No Arguments
 #   Comment   : Should be called at the end of every scene where
 #               draw_text_memory or draw_wrap_text_memory is used
 #-------------------------------------------------------------------------
 def self.clear_text_memory
   # Run Through Each Bitmap In Text Memory and dispose
   @@text_memory.each_value {|bitmap| bitmap.dispose}
   # Clear
   @@text_memory.clear
 end
 #-------------------------------------------------------------------------
 #   Name      : Clear Formatted Text Memory
 #   Info      : Clears Formatted Text Memory
 #   Author    : Trickster
 #   Call Info : No Arguments
 #   Returns   : Nothing
 #   Comment   : Should be called at the end of every scene where
 #               draw_formatted_text_memory is used
 #-------------------------------------------------------------------------
 def self.clear_formatted_text_memory
   # Run Through Each Bitmap In Text Memory and dispose
   @@formatted_text_memory.each_value {|bitmap| bitmap.dispose}
   # Clear
   @@formatted_text_memory.clear
 end
 #-------------------------------------------------------------------------
 #   Name      : Clear Memory
 #   Info      : Clears Bitmap Memory
 #   Author    : Trickster
 #   Call Info : No Arguments
 #-------------------------------------------------------------------------
 def clear_memory
   # Dispose Memory
   @memory.dispose
   # Set To nil
   @memory = nil
 end
 #-------------------------------------------------------------------------
 #   Name      : Clear To Memory
 #   Info      : Clears to Bitmap Memory
 #   Author    : Trickster
 #   Call Info : No Arguments
 #-------------------------------------------------------------------------
 def clear_to_memory
   # Clear Bitmap
   clear
   # Draw Memory if it is a Bitmap
   blt(0, 0, @memory, rect) if @memory.is_a?(Bitmap)
 end
 #-------------------------------------------------------------------------
 #   Name      : Draw Formatted Text Memory
 #   Info      : Draws Formatted Wrapped Text from Memory
 #   Author    : Trickster
 #   Call Info : Five Arguments
 #               Integer Offset_x and Offset_Y, define starting position
 #               Integer Width, defines the width of the text rectangle
 #               Integer Height, defines the height of the text drawn
 #               String Text, The text to be drawn
 #   Comment   : C[rrggbb] -> Change Color values are in hex
 #               C[N] -> Change Color to Normal Color
 #               B[] -> Turns on/off Bold
 #               I[] -> Turns on/off Italics
 #               T[] -> Tab (4 Spaces)
 #               N[] -> Newline
 #-------------------------------------------------------------------------
 def draw_formatted_text_memory(x, y, width, height, text)
   # If Already drawn
   if @@formatted_text_memory.has_key?(text)
     # Get Bitmap
     bitmap = @@formatted_text_memory[text]
     # Draw Bitmap
     blt(x, y, bitmap, bitmap.rect)
   else
     # Get Height of Text Drawn
     height = get_formatted_size(x, y, width, height, text).height
     # Create Text Bitmap
     text_bitmap = Bitmap.new(width, height)
     # Initialize X and Y
     cx, cy = 0, 0
     # Setup Font Color
     text_bitmap.font.color = Color.new(255, 255, 255)
     # Setup Save String
     string = text.dup
     # Make a Copy of Text
     text = text.dup
     # Replace C[Hex+] or C[N] with \001[Matched]
     text.gsub!(/[Cc]\[([A-F a-f 0-9]+|N)\]/) {" \001[#{$1}] "}
     # Replace B[] with \002
     text.gsub!(/[Bb]\[\]/) {" \002 "}
     # Replace I[] with \003
     text.gsub!(/[Ii]\[\]/) {" \003 "}
     # Replace T[] with \004
     text.gsub!(/[Tt]\[\]/) {" \004 "}
     # Replace N[] with \005
     text.gsub!(/[Nn]\[\]/) {" \005 "}
     # Run Through each text
     text.split(/\s/).each do |word|
       # If String \001 is included
       if word.include?("\001")
         # Slice from String
         word.slice!("\001")
         # Change text color
         word.sub!(/[Cc]\[([A-F a-f 0-9]+|N)\]/, '')
         # If matched is not nil and size of match is > 1
         if $1 != nil and $1.size > 1
           # Create Color
           color = Color.new($1[0..1].hex, $1[2..3].hex, $1[4..5].hex)
         else
           # Normal Color
           color = Color.new(255, 255, 255)
         end
         # Set Color
         self.font.color = color
         # Go to next text
         next
       end
       # If String \002 is included
       if word.include?("\002")
         # Invert Bold Status
         self.font.bold = !self.font.bold
         # Go to next text
         next
       end
       # If String \003 is included
       if word.include?("\003")
         # Invert Italic Status
         self.font.italic = !self.font.italic
         # Go to next text
         next
       end
       # If String \004 is included
       if word.include?("\004")
         # Add Four Spaces
         x += text_size('    ').width
         # Go to next text
         next
       end
       # If String \005 is included
       if word.include?("\005")
         # Move to new line
         cy = cx / width + 1
         # Move to start
         cx = cy * width
         # Go to next text
         next
       end
       # Get Word Width
       word_width = text_size("#{word} ").width
       # If can't fit on line
       if (cx + word_width) % width < x % width
         # Move to new line
         cy = cx / width + 1
         # Move to start
         cx = cy * width
       end
       # Get Draw X
       dx = cx % width + x
       # Get Draw Y
       dy = cx / width * height + y
       # Draw Text
       text_bitmap.draw_text(dx, dy, word_width, 32, word)
       # Increase by Word Width
       cx += word_width
     end
     # Save Copy of Bitmap
     @@formatted_text_memory[string] = text_bitmap
     # Draw onto Bitmap
     blt(x, y, text_bitmap, text_bitmap.rect)
   end
 end
 #-------------------------------------------------------------------------
 #   Name      : Draw Text Memory
 #   Info      : Draws Text and Saves it to Text_Memory
 #   Author    : Trickster
 #   Call Info : Two,Three,Five or Six Arguments
 #               Two Arguments: rect, str
 #                 Rect rect for the text to be drawn
 #                 String str text to be drawn
 #               Three Arguments: rect, str, align
 #                 Rect rect for the text to be drawn
 #                 String str text to be drawn
 #                 Integer align 0: left 1: center 2:right
 #               Five Arguments: x,y,width,height,str
 #                 Integer X and Y, Defines Position
 #                 Width and Height, Defines Width and Hieght of the text drawn
 #                 String str text to be drawn
 #               Six Arguments: x,y,width,height,str,align
 #                 Integer X and Y, Defines Position
 #                 Width and Height, Defines Width and Hieght of the text drawn
 #                 String str text to be drawn
 #                 Integer align 0: left 1: center 2:right
 #-------------------------------------------------------------------------
 def draw_text_memory(*args)
   # If Two Arguments Sent
   if args.size == 2
     # Default align, Rect and String were sent
     align, rect, str = 0, *args
   # If Three Arguments Sent
   elsif args.size == 3
     # All Were Sent Rect String and Alignment
     rect, str, align = args
   # If Five Arguments Sent
   elsif args.size == 5
     # Create Rect from (X,Y,Width,Height), Set String, Default align
     rect, str, align = Rect.new(*args[0, 4]), args[4], 0
   # If Six Arguments Sent
   elsif args.size == 6
     # Create Rect from (X,Y,Width,Height), Set String and align      
     rect, str, align = Rect.new(*args[0, 4]), *args[4, 2]
   end
   # Create Text Rect from Rect
   txt_rect = Rect.new(0, 0, rect.width, rect.height)
   # If Key is contained
   if @@text_memory.contains_key?([font, txt_rect, str])
     # Get Bitmap
     bitmap = @@text_memory.get_value([font, txt_rect, str])
     # Draw Bitmap by getting value from hash
     blt(rect.x, rect.y, bitmap, txt_rect)
   else
     # Create Bitmap
     bitmap = Bitmap.new(rect.width, rect.height)
     # Make A Copy of the Font
     bitmap.font = font.dup
     # Draw Text on bitmap
     bitmap.draw_text(txt_rect, str, align)
     # Draw Bitmap
     blt(rect.x, rect.y, bitmap, txt_rect)
     # Set Text Memory
     @@text_memory[[font.dup, txt_rect, str]] = bitmap
   end
 end
 #-------------------------------------------------------------------------
 #   Name      : Draw Wrapped Text From Memory
 #   Info      : Draws Text with Text Wrap and Saves it
 #   Author    : Trickster
 #   Call Info : Five
 #               Integer X and Y, Define Position
 #               Integer Width, defines the width of the text rectangle
 #               Integer Height, defines the height of the text
 #               String Text, Text to be drawn
 #-------------------------------------------------------------------------
 def draw_wrap_text_memory(x, y, width, height, text)
   # Get Array of Text
   strings = text.split
   # Run Through Array of Strings
   strings.each do |string|
     # Get Word
     word = string + ' '
     # Get Word Width
     word_width = text_size(word).width
     # If Can't Fit on Line move to next one
     x, y = 0, y + height if x + word_width > width
     # Draw Text Memory
     draw_text_memory(x, y, word_width, height, word)
     # Add To X
     x += word_width
   end
 end
 #-------------------------------------------------------------------------
 #   Name      : Get Formatted Text Size
 #   Info      : Gets Rect information for drawing formatted text
 #               The Rect Object Returned will have this information
 #               x, x coordinate where drawing ends
 #               y, y coordinate where drawing ends
 #               width, the width sent to this method
 #               height, the height of all of the text drawn
 #   Author    : Trickster
 #   Call Info : Five
 #               Integer X and Y, Define Position
 #               Integer Width, defines the width of the text rectangle
 #               Integer Height, defines the height of the text
 #               String Text, Text to get information for
 #-------------------------------------------------------------------------
 def get_formatted_size(x, y, width, height, text)
   # Make a Copy and Save
   text = text.dup
   # Replace C[Hex+ or N] I[] B[] with nothing
   text.gsub!(/[BbIiCc]\[([A-F a-f 0-9]+|N)*\]/) {''}
   # Replace T[] with \004
   text.gsub!(/[Tt]\[\]/) {" \004 "}
   # Replace N[] with \005
   text.gsub!(/[Nn]\[\]/) {" \005 "}
   # Setup Cx and Cy
   cx, cy = 0, 0
   # Declare Dx and Dx as local variables
   dx, dy = 0, 0
   # Run Through each text
   text.split(/\s/).each do |word|
     # If \004 is included
     if word.include?("\004")
       # Add Four Spaces
       x += text_size(' '*4).width
       # Go to Next Text
       next
     end
     # If \005 is included
     if word.include?("\005")
       # Move to new line
       cy = cx / width + 1
       # Move to start
       cx = cy * width
       # Go to Next Text
       next
     end
     # Get Word Width
     word_width = text_size("#{word} ").width
     # If can't fit on line
     if (cx + word_width) % width < x % width
       # Move to new line
       cy = cx / width + 1
       # Move to start
       cx = cy * width
     end
     # Add Width to X
     cx += word_width
     # Get Draw X and Y
     dx = cx % width + x
     dy = cx / width * height + y
   end
   # Return Rect Object
   return Rect.new(dx, dy, width, (dy - y + height).to_i)
 end
 #-------------------------------------------------------------------------
 #   Name      : Set Memory
 #   Info      : Sets Bitmap Memory
 #   Author    : Trickster
 #   Call Info : No Arguments
 #   Comment   : Use with Clear To Memory
 #-------------------------------------------------------------------------
 def set_memory
   # Make A Clone of itself
   @memory = self.dup
 end
end

class Hash
 #-------------------------------------------------------------------------
 #   Name      : Contains Key?
 #   Info      : Compares all Keys using == similiar to has_key?
 #   Author    : Trickster
 #   Call Info : One, Key an Object
 #-------------------------------------------------------------------------
 def contains_key?(key)
   # Run Through and Return true if keys are equal
   each_key {|other_key| return true if key == other_key}
   # Return false
   return false
 end
 #-------------------------------------------------------------------------
 #   Name      : Get Value
 #   Info      : Gets Value using == similiar to []
 #   Author    : Trickster
 #   Call Info : One, Key an Object
 #-------------------------------------------------------------------------
 def get_value(key)
   # Run Through and Return Key if equal
   each_key {|other_key| return self[other_key] if key == other_key}
   # If Default Proc is undefined return default else call proc
   return default_proc.nil? ? default : default_proc.call(self, key)
 end
end

class Font
 #-------------------------------------------------------------------------
 #   Name      : == (Comparision Equals)
 #   Info      : Compares two Fonts
 #   Author    : Trickster
 #   Call Info : One Argument Font other, Font to Check
 #-------------------------------------------------------------------------
 def ==(other)
   return false unless (name == other.name && size == other.size &&
     color == other.color && bold == other.bold && italic == other.italic)
   instance_variables.each do |var|
     var = var[1...var.size]
     return false if method(var).call != other.method(var).call
   end
   return true
 end
end


and

MACL
Spoiler: ShowHide

module MACL
 #-------------------------------------------------------------------------
 # * Pose Names for Charactersets
 #-------------------------------------------------------------------------
 Poses = ['down','left','right','up']
 #-------------------------------------------------------------------------
 # * Number of Frames Per Pose for charactersets
 #-------------------------------------------------------------------------
 Frames = 4
 #--------------------------------------------------------------------------
 # * Real Elements
 #--------------------------------------------------------------------------
 Real_Elements = 1, 2, 3, 4, 5, 6, 7, 8
 #-------------------------------------------------------------------------
 # * Version Number (Do not Touch)
 #-------------------------------------------------------------------------
 Version   = 2.0
 #-------------------------------------------------------------------------
 # * Path for MACL
 #   - Set to nil to not using outside requiring
 #-------------------------------------------------------------------------
 Path = nil
 #--------------------------------------------------------------------------
 # * Do not Touch
 #--------------------------------------------------------------------------
 Loaded = []
 #--------------------------------------------------------------------------
 # * Set Require Path
 #--------------------------------------------------------------------------
 $: << Path unless $:.include?(Path) and Path != nil
end

#==============================================================================
# ** Action Test Setup
#==============================================================================
class Game_BattleAction
 #-------------------------------------------------------------------------
 # * Attack Using
 #   - Set this to the basic ids that perform an attack effect
 #-------------------------------------------------------------------------
 ATTACK_USING = [0]
 #-------------------------------------------------------------------------
 # * Skill Using
 #   - Set this to the kinds that perform an skill effect
 #-------------------------------------------------------------------------
 SKILL_USING  = [1]
 #-------------------------------------------------------------------------
 # * Defend Using
 #   - Set this to the basic ids that perform an defend effect
 #-------------------------------------------------------------------------
 DEFEND_USING = [1]
 #-------------------------------------------------------------------------
 # * Item Using
 #   - Set this to the kinds that perform a item using effect
 #-------------------------------------------------------------------------
 ITEM_USING   = [2]
 #-------------------------------------------------------------------------
 # * Escape Using
 #   - Set this to the basic ids that perform an escape effect
 #-------------------------------------------------------------------------
 ESCAPE_USING = [2]
 #-------------------------------------------------------------------------
 # * Wait Using
 #   - Set this to the basic ids that perform a wait effect
 #-------------------------------------------------------------------------
 WAIT_USING  = [3]
end

#==============================================================================
# ** Module    
#-----------------------------------------------------------------------------
#  Superclass of the Class class      
#==============================================================================

class Module
 #-------------------------------------------------------------------------
 # * Name      : Class Attribute
 #   Info      : Calls class_reader/writer for a symbol
 #   Author    : Yeyinde
 #   Call Info : symbol, writable
 #               symbol:   A Symbol
 #               writable: Boolean telling is symbol is writable
 #-------------------------------------------------------------------------
 private
 def class_attr(symbol, writable = false)
   class_reader(symbol)
   class_writer(symbol) if writable
   return nil
 end
 #-------------------------------------------------------------------------
 # * Name       : Class Accessor
 #   Info       : Creates reader and writer methods for one or more class
 #                variables
 #   Author     : Yeyinde
 #   Call Info  : One or more Symbols
 #-------------------------------------------------------------------------
 def class_accessor(*symbols)
   class_writer(*symbols)
   class_reader(*symbols)
 end
 #-------------------------------------------------------------------------
 # * Name      : Class Writer
 #   Info      : Creates writer method for one or more class variables
 #   Author    : Yeyinde
 #   Call Info : One or more Symbols
 #-------------------------------------------------------------------------
 def class_writer(*symbols)
   symbols.each do |symbol|
     method = symbol.id2name
     eval("def self.#{method}=(var); @@#{method} = var; end")
   end
   return nil
 end
 #-------------------------------------------------------------------------
 # * Name      : Class Reader
 #   Info      : Creates reader method for one or more class variables
 #   Author    : Yeyinde
 #   Call Info : One or more Symbols
 #-------------------------------------------------------------------------
 def class_reader(*symbols)
   symbols.each do |symbol|
     method = symbol.id2name
     eval("def self.#{method}; return @@#{method}; end")
   end
   return nil
 end
end

# If Path Defined
if MACL::Path != nil
 # Require Files
 Dir.entries(MACL::Path).each {|file| require file if file.include?('.rb')}
end
Hey, My picture is NOT cloud, it real my face.
(before My face burned)

ForeverZer0

@GG: From the looks of the error, the problem isn't "viewport2", but the fact that the spriteset is not defined.  Its trying to call the "viewport2" method on nil.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

G_G


Rudria

Hey, My picture is NOT cloud, it real my face.
(before My face burned)