As confusing as the title sounds, this is a Status Effect script which causes the expiration of Status Effect A to switch to Status Effect B. A good example of this is "Death Sentence" from the Final Fantasy series...
Doom (3) => Doom (2) => Doom (1) => Dead
...Where "Death Sentence" (or, in this case, "Doom") lasts for three turns before the target dies.
Instructions
Place below default scripts and above Main.
You can see an example of the "Death Sentence" cycle which I've set up in the script for my game. Just look for the constant Expiration and see how I've set it up.
class RPG::State
#-----------------------------------------------------------------------------
# * Expiration
#-----------------------------------------------------------------------------
Expiration = {}
Expiration[18] = 19 # Doom 3 to Doom 2
Expiration[19] = 20 # Doom 2 to Doom 1
Expiration[20] = 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
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
end
Compatability
Written for RPG Maker XP. It is possible it works in VX or VX Ace, but I haven't tested. If it does, let me know and I'll change the icon.
Author's Notes
If you can't tell by now, yes, most of my scripts are minor add-ons and they're usually inspired by Final Fantasy for some reason.
Credits
Free to use in commercial and non-commercial games. Credit Kain Nobel and enjoy!
Okay, first of all: Thanks for the script:
Im using your script alongside Atoas ACBS.
And when I have several states on I get the error message
NoMethodError occured, undefined method '>' for nil:NilClass
it happens on Game battler 2 line 223:
Quote:if @states_turn[i] > 0
In full context:
Quote:#--------------------------------------------------------------------------
# * 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
I think its because your script does affect the very same method.
Anyways to fix that?
BTW: IM NOT using SDK, is this even compatible without SDK?