01-30-2017, 02:51 AM 
	
	
	
		Yes, my dear friends. I need your wisdom again.
I found a pretty nice little script called Expiration States here in this forum. It makes a doom state ike in the final fantasy series where there is a turn count to die for a character. I wanted to make use of it and implemented it in a blank project with just Atoa acbs in it (only his battle sytem). Whenever doom is ready to kill the infected hero I get a error message on Game battler 2 line 223. I've underlined the line. I really dont understand why I get a error message on that point, maybe because the def remove_states_auto is rewritten or because the script is SDK and contradicts everything non SDK.
![[Image: bugmug2340gdi7qo19y_thumb.jpg]](http://img5.fotos-hochladen.net/thumbnail/bugmug2340gdi7qo19y_thumb.jpg)
From Game_Battler 2 line 218-229
#--------------------------------------------------------------------------
# * Natural Removal of States (called up each turn)
#--------------------------------------------------------------------------
def remove_states_auto
for i in @states_turn.keys.clone
if @states_turn[i] > 0
@states_turn[i] -= 1
elsif rand(100) < $data_states[i].auto_release_prob
remove_state(i)
end
end
end
The script
Any ideas?
	
	
	
	
I found a pretty nice little script called Expiration States here in this forum. It makes a doom state ike in the final fantasy series where there is a turn count to die for a character. I wanted to make use of it and implemented it in a blank project with just Atoa acbs in it (only his battle sytem). Whenever doom is ready to kill the infected hero I get a error message on Game battler 2 line 223. I've underlined the line. I really dont understand why I get a error message on that point, maybe because the def remove_states_auto is rewritten or because the script is SDK and contradicts everything non SDK.
From Game_Battler 2 line 218-229
#--------------------------------------------------------------------------
# * Natural Removal of States (called up each turn)
#--------------------------------------------------------------------------
def remove_states_auto
for i in @states_turn.keys.clone
if @states_turn[i] > 0
@states_turn[i] -= 1
elsif rand(100) < $data_states[i].auto_release_prob
remove_state(i)
end
end
end
The script
Code:
#===============================================================================
# ** States : Expiration States
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
#if Object.const_defined?(:SDK)
#  SDK.log('States.ExpirationStates', 'Kain Nobel ©', 4.0, '2013.01.02')
#end
#===============================================================================
# ** RPG::State
#===============================================================================
class RPG::State
  #-----------------------------------------------------------------------------
  # * Expiration
  #-----------------------------------------------------------------------------
  Expiration = {}
  Expiration[25] = 26 # Doom 3 to Doom 2
  Expiration[26] = 27 # Doom 2 to Doom 1
  Expiration[27] = 1  # Doom 1 to Death
  #-----------------------------------------------------------------------------
  # * Expiration Default (*Don't touch*)
  #-----------------------------------------------------------------------------
  Expiration.default = []
  #-----------------------------------------------------------------------------
  # * Experation States
  #-----------------------------------------------------------------------------
  def expiration_states
    # If expiration states nil
    if @expiration_states.nil?
      # Get expiration states setting
      @expiration_states = Expiration[@id]
      # Convert to value to array if integer
      @expiration_states = [@expiration_states] if @expiration_states.is_a?(Integer)
      # If value isn't set as array, return an empty array
      @expiration_states = [] unless @expiration_states.is_a?(Array)
    end
    # Return expiration states
    @expiration_states
  end
end
#===============================================================================
# ** Game_Battler
#===============================================================================
class Game_Battler
  #-----------------------------------------------------------------------------
  # * Alias Listings
  #-----------------------------------------------------------------------------
  alias_method :expirestates_gmbattler_removestate,       :remove_state
  alias_method :expirestates_gmbattler_removestatesauto,  :remove_states_auto
  #-----------------------------------------------------------------------------
  # * Remove States Auto
  #-----------------------------------------------------------------------------
  def remove_states_auto
    # Enable flag to check for expiration states
    @check_expiration_states = true
    # The usual
    expirestates_gmbattler_removestatesauto
    # Disable flag to check for expiration states
    @check_expiration_states = nil
  end
  #-----------------------------------------------------------------------------
  # * Remove State
  #-----------------------------------------------------------------------------
  def remove_state(state_id, force = false)
    # Check if state already inflicted
    state_inflicted = state?(state_id)
    # The usual
    expirestates_gmbattler_removestate(state_id, force)
    # End method if state invalid
    return unless state_id > 0
    # End method if state still exists
    return if state?(state_id)
    # End method unless checking expiration states
    return unless @check_expiration_states
    # End method unless state was previously inflicted before removal
    return unless state_inflicted
    # Get state object
    state = $data_states[state_id]
    # End method if expiration states empty
    return if state.expiration_states.empty?
    # Force the addition of each expiration state
    state.expiration_states.each {|i| self.add_state(i)}
  end
endAny ideas?

