This script allows your RPG Maker XP project to have state effects that stack like in Pokemon or MegaTen.
It does this by applying a more powerful version of the state whenever the specified state already exists.
class RPG::State
#-----------------------------------------------------------------------------
# * Tiered States
# States are applied left to right, starting at the state before the =>.
#
# The example provided allows for negative states (stat-downs) to be
# counteracted by positive states (stat-ups)
#-----------------------------------------------------------------------------
Tiered_States = {
20 => [24, 23, 22, 21, 20, 19, 18],
22 => [18, 19, 20, 21, 22, 23, 24]
}
#-----------------------------------------------------------------------------
# * has Additive State?
#-----------------------------------------------------------------------------
def tiered?
Tiered_States.include?(@id)
end
#-----------------------------------------------------------------------------
# * How many tiers?
#-----------------------------------------------------------------------------
def tiers
return Tiered_States.fetch(@id, [])
end
end
#===============================================================================
# ** Game_Battler
#===============================================================================
class Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :mpen_default_add_state, :add_state
#-----------------------------------------------------------------------------
# * Add State
#-----------------------------------------------------------------------------
def add_state(state_id, force = false)
if $data_states[state_id].tiered?
for i in 0...$data_states[state_id].tiers.size
current_tier = $data_states[state_id].tiers[i]
next_tier = $data_states[state_id].tiers[i+1]
if self.state?(current_tier)
if next_tier == nil
#tier at maximum, regular state rules apply
mpen_default_add_state(current_tier, force)
return
else
remove_state(current_tier)
mpen_default_add_state(next_tier, force)
return
end
end
end
#no tiers applyed yet, default behavior.
mpen_default_add_state(state_id, force)
else
#no tiers exist, default behavior
mpen_default_add_state(state_id, force)
end
end
end
Instructions
A hash of states with tiers needs to be provided at the beginning of the script. The key is the default state, the one that is applied when no states of this type are currently attached to the battler. The value is an array of the different tiers, in order of power from left to right.
In the demo provided, a way to have negative effects cancel out positive effects is shown.
Credits and Thanks
This script is based on Kain Nobel's States : Toggle script.
At first I thought it was tired states and was scratching my head in confusion. XD
The idea is nice, certainly =) I haven't tried it yet, but if it works it is a nice addition ^^
I would suggest however that you provide a download link for your demo that does not requite others to make an account. Unless you have one anyway, it is an annoyance and prevents some people from giving this a go.
mediafire.com is a great page, as you neither need an account not have to wait a certain amount of time untill you can download. You as a host do need an account tough.
filedropper.com is also usefull, but you have less controll over your own files. Same with 2shared.com Both do not requite and account to upload or download.
You could also make an account on Dropbox. If you use this link you'll get free space, and me too: http://db.tt/JprwsOH
After that you just drop files in your "public" folder and give out the link.
class RPG::State
#-----------------------------------------------------------------------------
# * Tiered States
# States are applied left to right, starting at the state before the =>.
#
# The example provided allows for negative states (stat-downs) to be
# counteracted by positive states (stat-ups)
#-----------------------------------------------------------------------------
Tiered_States = {
20 => [24, 23, 22, 21, 20, 19, 18],
22 => [18, 19, 20, 21, 22, 23, 24]
}
#-----------------------------------------------------------------------------
# * has Tiered State?
#-----------------------------------------------------------------------------
def tiered?
Tiered_States.include?(@id)
end
#-----------------------------------------------------------------------------
# * How many tiers?
#-----------------------------------------------------------------------------
def tiers
return Tiered_States.fetch(@id, [])
end
end
#===============================================================================??
# ** Game_Battler
#===============================================================================??
class Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :mpen_default_add_state, :add_state
#-----------------------------------------------------------------------------
# * Add State
#-----------------------------------------------------------------------------
def add_state(state_id)
if $data_states[state_id].tiered?
for i in 0...$data_states[state_id].tiers.size
current_tier = $data_states[state_id].tiers[i]
next_tier = $data_states[state_id].tiers[i+1]
if self.state?(current_tier)
if next_tier == nil
#tier at maximum, regular state rules apply
mpen_default_add_state(current_tier)
return
else
remove_state(current_tier)
mpen_default_add_state(next_tier)
return
end
end
end
#no tiers applyed yet, default behavior.
mpen_default_add_state(state_id)
else
#no tiers exist, default behavior
mpen_default_add_state(state_id)
end
end