SPIRIT regenerating MP
Hi,
I have a couple of requests regarding stats. I'll try to be concise and clear :) As some of you may already know, I'm using KGC_MPCostAlter inserting both the tags <MAXMpCost> and <PropMPDamage> to calibrate the effectiveness of all spells (either harmful or healing) adjusting it to their Mana Cost, so that the MP_Cost becomes the real multiplier to determine damage. Now, I thought that this system still allowed SPIRIT to have some role in the process, as in Magic Defense, the standard formula being {(Caster's SPI *2 * SPIRIT_F / 100) - (Defender's SPI *1 * SPIRIT_F /100)}, but during testing it ultimately resulted that SPIRIT no longer plays any role in the damage dealt and suffered, or the amount healed. No matter how it's increased or decreased, the effectiveness of spells is completely handled by a percentage of Mana Points.
Features Desired
1) I've been looking for a Script to add some usefulness to this stat. Since I want SPI to be still a parameter useful to casters, I was wondering: is it possible to make a Script that takes a percentage of a stat (e.g. SPIRIT) and turn it into a beneficial effect, e.g. Mana Regeneration? For instance: "A" has 500 SPI and regenerates Mana at the end of every turn: 10% SPIRIT converted to Mana Points (so, 500 SPI = 50 MP regenerated). I can't use anything that reduces the MP cost, because, obviously, that would influence damage or healing.
- Make SPIRIT regenerates MP at the end of every turn by a percentage of its amount
What other scripts are you using?
- KGC_MPCostAlter
- Sideview Battle System (without ATB)
I'll past here KGC_MPCostAlter:
[spoiler]
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/ ? MP ???? - KGC_MPCostAlter ? VX ?
#_/ Last Update: 02/06/2008
#_/ Written by TOMY
#_/ Translation by Mr. Anonymous
#_/ KGC Site:
#_/ http://ytomy.sakura.ne.jp/
#_/ Translator's Blog:
#_/ http://mraprojects.wordpress.com
#_/-----------------------------------------------------------------------------
#_/ This script allows you to alter the way MP is consumed.
#_/=============================================================================
#_/ ? Instructions For Usage ?
#_/ To make use of these functions, you must insert the desired tag into the
#_/ "Notes" box located in the Skills section of the database. For
#_/ example, you want the Flame II skill to consume 24% of the character's
#_/ max MP. You would locate Flame II in the skills tab of the
#_/ database and insert "<MAXMPcost>" (without quotations) in the note box.
#_/ Simple, no?
#_/
#_/ ? MP Percentile Consumption ?
#_/
#_/ <MPcost> OR <MAXMPcost>
#_/ Examples: <MPcost> MP cost is set to 10, therefore MP cost is
#_/ actually 10% ofthe character's remaining MP.
#_/ <MAXMPcost> MP cost is set to 25, therefore MP cost is
#_/ actually 25% ofthe character's total (Max) MP.
#_/
#_/ ? Damage Proportionate to MP Consumption ?
#_/
#_/ <propMPdamage>
#_/ Example: The skill "Water" has a base damage of 300. Using this tag,
#_/ The base damage becomes a percentile, and the MP cost
#_/ effectively becomes the base damage.
#_/ Therefore, 300% of 6 MP(the skill's MP cost) would be 18.
#_/ (3 x 6 = 18)
#_/
#_/ ? HP Consumption for Skills ?
#_/
#_/ <HPconsume>
#_/ Example: You wish for the skill "Darkness", which normally costs 40
#_/ MP to cost HP instead. You'd simply add <HPconsume> in the
#_/ Notes.
#_/
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#===============================================================================
# Customization
#===============================================================================
module KGC
module MPCostAlter
# This toggle allows you to consume HP (using <HPconsume>) all the way to 0.
# true : HP is able to be consumed all the way to 0.
# false : Skills that use <HPconsume> cannot be used if HP = 1.
PERMIT_ZERO_HP = true
# This toggle is used in conjuction with PERMIT_ZERO_HP
# true : When a skill that uses HP identifies HP as insufficient, the skill
# remains usable.
# false : When HP is insuffiecient, use of that skill is impossible
RELEASE_HP_LIMIT = true
end
end
#------------------------------------------------------------------------------#
$imported = {} if $imported == nil
$imported["MPCostAlter"] = true
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Unless you know what you're doing, it's best not to alter anything beyond #
# this point, as this only affects the tags used for "Notes" in database. #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the "Notes" section.
module KGC::MPCostAlter
# Regular expressions defined.
module Regexp
# Base Skill Module
module Skill
# Consume HP tag string
CONSUME_HP = /<(?:CONSUME_HP|HPconsume)>/i
# MP Cost Rate tag string
MP_COST_RATE = /<(MAX)?(?:MP_COST_RATE|MPcost)>/i
# Proportional MP Damage tag string
MP_PROPORTIONAL_DAMAGE =
/<(?:MP_PROPORTIONAL_DAMAGE|propMPdamage)>/i
end
end
end
#==============================================================================
# ? RPG::Skill
#==============================================================================
class RPG::Skill < RPG::UsableItem
#--------------------------------------------------------------------------
# ? Generate MP consumption remodelling cache
#--------------------------------------------------------------------------
def create_mp_cost_alter_cache
@__consume_hp = false
@__mp_cost_rate = false
@__max_mp_cost_rate = false
@__mp_proportional_damage = false
self.note.split(/[\r\n]+/).each { |prop|
case prop
when KGC::MPCostAlter::Regexp::Skill::CONSUME_HP
# HP Consumption
@__consume_hp = true
when KGC::MPCostAlter::Regexp::Skill::MP_COST_RATE
# MP Cost Rate
@__mp_cost_rate = true
@__max_mp_cost_rate = ($1 != nil)
when KGC::MPCostAlter::Regexp::Skill::MP_PROPORTIONAL_DAMAGE
# Proportional MP Damage
@__mp_proportional_damage = true
end
}
end
#--------------------------------------------------------------------------
# ? HP Consumption
#--------------------------------------------------------------------------
def consume_hp
create_mp_cost_alter_cache if @__consume_hp == nil
return @__consume_hp
end
#--------------------------------------------------------------------------
# ? MP Consumption Ratio
#--------------------------------------------------------------------------
def mp_cost_rate
create_mp_cost_alter_cache if @__mp_cost_rate == nil
return (@__mp_cost_rate ? self.mp_cost : -1)
end
#--------------------------------------------------------------------------
# ? MaxMP Consumption Ratio
#--------------------------------------------------------------------------
def max_mp_cost_rate
create_mp_cost_alter_cache if @__max_mp_cost_rate == nil
return @__max_mp_cost_rate
end
#--------------------------------------------------------------------------
# ? Proportional MP Damage Consumption Ratio
#--------------------------------------------------------------------------
def mp_proportional_damage
create_mp_cost_alter_cache if @__mp_proportional_damage == nil
return @__mp_proportional_damage
end
end
#==============================================================================
# ? Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ?—? Global Variable Instance
#--------------------------------------------------------------------------
attr_reader :spend_cost # Consumed HP/MP
#--------------------------------------------------------------------------
# ?—? Object initialization
#--------------------------------------------------------------------------
alias initialize_KGC_MPCostAlter initialize
def initialize
initialize_KGC_MPCostAlter
@spend_cost = 0
end
#--------------------------------------------------------------------------
# ?—? Skill Consumption MP calculation
# skill : Skill
#--------------------------------------------------------------------------
alias calc_mp_cost_KGC_MPCostAlter calc_mp_cost
def calc_mp_cost(skill)
return 0 if skill.consume_hp # HP Consumption
if skill.mp_cost_rate < 0 # Comparative
return calc_mp_cost_KGC_MPCostAlter(skill)
end
if skill.max_mp_cost_rate # MaxMP Ratio Consumption
return calc_skill_cost_rate(skill, maxmp)
else # MP Ratio Consumption
return calc_skill_cost_rate(skill, mp)
end
end
#--------------------------------------------------------------------------
# ?—‹ Skill Calculation consumption ratio
# skill : Skill
# base : Reference Value
#--------------------------------------------------------------------------
def calc_skill_cost_rate(skill, base)
return base * skill.mp_cost_rate / 100
end
#--------------------------------------------------------------------------
# ?—‹ Calculation of skill HP Consumption
# skill : Skill
#--------------------------------------------------------------------------
def calc_hp_cost(skill)
return 0 unless skill.consume_hp # HP consumption
if skill.mp_cost_rate < 0 # comparative
return skill.mp_cost
end
if skill.max_mp_cost_rate # MaxHP Ratio Consumption
return calc_skill_cost_rate(skill, maxhp)
else # HP Ratio Consumption
return calc_skill_cost_rate(skill, hp)
end
end
#--------------------------------------------------------------------------
# ?—‹ The amount of HP/MP that should be consumed is maintained.
# skill : Skill
#--------------------------------------------------------------------------
def set_spend_cost(skill)
@spend_cost = [calc_hp_cost(skill), calc_mp_cost(skill)].max
end
#--------------------------------------------------------------------------
# ?—? Skill use judgement
# skill : Skill
#--------------------------------------------------------------------------
alias skill_can_use_KGC_MPCostAlter? skill_can_use?
def skill_can_use?(skill)
return false unless skill.is_a?(RPG::Skill) # Not a skill?
return false unless mp_cost_restrict_clear?(skill) # MP limit collision
return false unless hp_cost_restrict_clear?(skill) # HP limit collision
return skill_can_use_KGC_MPCostAlter?(skill)
end
#--------------------------------------------------------------------------
# ?—‹ MP limitation judgment clear
# skill : Skill
#--------------------------------------------------------------------------
def mp_cost_restrict_clear?(skill)
return true if skill.consume_hp # HP ?ˆ?
# Impossible to use skill if MP is not at 1 or more of the mp consumption
if skill.mp_cost_rate >= 0
return false if calc_mp_cost(skill) == 0
end
return calc_mp_cost(skill) <= mp
end
#--------------------------------------------------------------------------
# ?—‹ HP limitation judgment clear
# skill : Skill
#--------------------------------------------------------------------------
def hp_cost_restrict_clear?(skill)
return true unless skill.consume_hp # MP ?ˆ?
# Impossible to use skill if HP is not at 1 or more of the hp ratio
if skill.mp_cost_rate >= 0
return false if calc_hp_cost(skill) == 0
end
if KGC::MPCostAlter::RELEASE_HP_LIMIT
# It is possible to use the skill at the limitation release
return true
elsif KGC::MPCostAlter::PERMIT_ZERO_HP
# It is possible to consume up to the same amount of HP
return calc_hp_cost(skill) <= hp
else
# It is necessary to remain above 1.
return calc_hp_cost(skill) < hp
end
end
#--------------------------------------------------------------------------
# ?—? Damage calculation by skill or item
# user : User of skill or item
# obj : Skill or item
# The result is substituted for @hp_damage or @mp_damage
#--------------------------------------------------------------------------
alias make_obj_damage_value_KGC_MPCostAlter make_obj_damage_value
def make_obj_damage_value(user, obj)
# When MP Proporional Damage isn't used.
unless obj.is_a?(RPG::Skill) && obj.mp_proportional_damage
# Former calculation type is used.
make_obj_damage_value_KGC_MPCostAlter(user, obj)
return
end
damage = user.spend_cost * obj.base_damage / 100 # basic damage calculation
damage *= elements_max_rate(obj.element_set) # attribute correction
damage /= 100
damage = apply_variance(damage, obj.variance) # decentralization
damage = apply_guard(damage) # Defence adjustment if
# damage_to_mp
if obj.damage_to_mp
@mp_damage = damage # MP Damage
else
@hp_damage = damage # HP Damage
end
end
end
#==============================================================================
# ?–? Window_Skill
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ?—? Draw Item
# index : Item Number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
if skill.consume_hp
# HP Consumption
text = sprintf("%s%d", Vocab.hp_a, @actor.calc_hp_cost(skill))
else
# MP Consumption
text = @actor.calc_mp_cost(skill).to_s
end
self.contents.draw_text(rect, text, 2)
end
end
end
#==============================================================================
# ?–? Scene_Skill
#==============================================================================
class Scene_Skill < Scene_Base
#--------------------------------------------------------------------------
# ?—? Target Decision
# Preformance: (Dead...potion...etc) Buzzer SE cancellation
#--------------------------------------------------------------------------
alias determine_target_KGC_MPCostAlter determine_target
def determine_target
@actor.set_spend_cost(@skill) # Consume HP/MP is set
determine_target_KGC_MPCostAlter
end
#--------------------------------------------------------------------------
# ?—? Skill Use (The effects of use, other than an ally object are applied.)
#--------------------------------------------------------------------------
alias use_skill_nontarget_KGC_MPCostAlter use_skill_nontarget
def use_skill_nontarget
@actor.hp -= @actor.calc_hp_cost(@skill)
use_skill_nontarget_KGC_MPCostAlter
end
end
#==============================================================================
# ?–? Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# ?—? Execution of Battle Action: Skill
#--------------------------------------------------------------------------
alias execute_action_skill_KGC_MPCostAlter execute_action_skill
def execute_action_skill
skill = @active_battler.action.skill
@active_battler.set_spend_cost(skill) # Consume HP/MP is set
if skill.consume_hp
hp_cost = [@active_battler.hp - 1,
@active_battler.spend_cost].min # One HP left
@active_battler.hp -= hp_cost
end
execute_action_skill_KGC_MPCostAlter
# Execution of Battle Action: Skill
if skill.consume_hp && hp_cost < @active_battler.spend_cost
@active_battler.hp = 0 # HP is adjusted to 0
display_added_states(@active_battler) # Display death message.
end
end
end[/spoiler]
2) Secondly, I'm using Shanghai's "Temporary Stat Boosts". I was wondering if it were possible to make this Script accept percentages: for instance <target temp MaxMP: +10%>, instead of e.g. <target temp MaxMP: +512>.
I'll past here the Script:
[spoiler]
#===============================================================================
#
# Shanghai Simple Script - Temporary Stat Boosts
# Last Date Updated: 2010.05.22
# Level: Normal
#
# Temporary stat boosts only last during battle. After battle, they're cleared
# and everything returns back to normal.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# These are for items and skills.
#
# <target temp stat: +x>
# <target temp stat: -x>
# Gives a temporary boost of x for the stat to target of skill. Replace "stat"
# maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
#
# <user temp stat: +x>
# <user temp stat: -x>
# Gives a temporary boost of x for the stat to user of skill. Replace "stat"
# maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
#
# <clear temp stats: user>
# <clear temp stats: target>
# Will clear the temp stats for the user or target.
#===============================================================================
$imported = {} if $imported == nil
$imported["TemporaryStatBoosts"] = true
#==============================================================================
# RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# target_temp_boost
#--------------------------------------------------------------------------
def target_temp_boost
return @target_temp_boost if @target_temp_boost != nil
@target_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
:spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
:dex => 0, :res => 0}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:TARGET TEMPORARY|target temp)[ ](.*):[ ]([\+\-]\d+)>/i
case $1.upcase
when "MAXHP"
@target_temp_boost[:maxhp] = $2.to_i
when "MAXMP"
@target_temp_boost[:maxmp] = $2.to_i
when "ATK"
@target_temp_boost[:atk] = $2.to_i
when "DEF"
@target_temp_boost[:def] = $2.to_i
when "SPI"
@target_temp_boost[:spi] = $2.to_i
when "AGI"
@target_temp_boost[:agi] = $2.to_i
when "HIT"
@target_temp_boost[:hit] = $2.to_i
when "EVA"
@target_temp_boost[:eva] = $2.to_i
when "CRI"
@target_temp_boost[:cri] = $2.to_i
when "ODDS"
@target_temp_boost[:odds] = $2.to_i
when "DEX"
@target_temp_boost[:dex] = $2.to_i
when "RES"
@target_temp_boost[:res] = $2.to_i
end
end
}
return @target_temp_boost
end
#--------------------------------------------------------------------------
# user_temp_boost
#--------------------------------------------------------------------------
def user_temp_boost
return @user_temp_boost if @user_temp_boost != nil
@user_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
:spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
:dex => 0, :res => 0}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:USER TEMPORARY|user temp)[ ](.*):[ ]([\+\-]\d+)>/i
case $1.upcase
when "MAXHP"
@user_temp_boost[:maxhp] = $2.to_i
when "MAXMP"
@user_temp_boost[:maxmp] = $2.to_i
when "ATK"
@user_temp_boost[:atk] = $2.to_i
when "DEF"
@user_temp_boost[:def] = $2.to_i
when "SPI"
@user_temp_boost[:spi] = $2.to_i
when "AGI"
@user_temp_boost[:agi] = $2.to_i
when "HIT"
@user_temp_boost[:hit] = $2.to_i
when "EVA"
@user_temp_boost[:eva] = $2.to_i
when "CRI"
@user_temp_boost[:cri] = $2.to_i
when "ODDS"
@user_temp_boost[:odds] = $2.to_i
when "DEX"
@user_temp_boost[:dex] = $2.to_i
when "RES"
@user_temp_boost[:res] = $2.to_i
end
end
}
return @user_temp_boost
end
#--------------------------------------------------------------------------
# clear_temp_stats
#--------------------------------------------------------------------------
def clear_temp_stats
return @clear_temp_stats if @clear_temp_stats != nil
@clear_temp_stats = {:user => false, :target => false}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:CLEAR TEMP STATS|clear temp boosts)[ ](.*)>/i
case $1.upcase
when "USER"
@clear_temp_stats[:user] = true
when "TARGET", "TARGETS"
@clear_temp_stats[:target] = true
end
end
}
return @clear_temp_stats
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_sss_temp_stat_boosts initialize unless $@
def initialize
initialize_sss_temp_stat_boosts
clear_temp_stat_boosts
end
#--------------------------------------------------------------------------
# * Clear Temp Stat Boosts
#--------------------------------------------------------------------------
def clear_temp_stat_boosts
@temp_maxhp_boost = 0
@temp_maxmp_boost = 0
@temp_atk_boost = 0
@temp_def_boost = 0
@temp_spi_boost = 0
@temp_agi_boost = 0
@temp_hit_boost = 0
@temp_eva_boost = 0
@temp_cri_boost = 0
@temp_odds_boost = 0
@temp_dex_boost = 0
@temp_res_boost = 0
end
#--------------------------------------------------------------------------
# * Apply Temp Boost
#--------------------------------------------------------------------------
def apply_temp_boost(hash)
@temp_maxhp_boost += hash[:maxhp]
@temp_maxmp_boost += hash[:maxmp]
@temp_atk_boost += hash[:atk]
@temp_def_boost += hash[:def]
@temp_spi_boost += hash[:spi]
@temp_agi_boost += hash[:agi]
@temp_hit_boost += hash[:hit]
@temp_eva_boost += hash[:eva]
@temp_cri_boost += hash[:cri]
@temp_odds_boost += hash[:odds]
@temp_dex_boost += hash[:dex]
@temp_res_boost += hash[:res]
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
#--------------------------------------------------------------------------
alias skill_effect_sss_temp_boosts skill_effect unless $@
def skill_effect(user, skill)
skill_effect_sss_temp_boosts(user, skill)
return unless $game_temp.in_battle
return if @skipped or @missed or @evaded
clear_temp_stat_boosts if skill.clear_temp_stats[:target]
user.clear_temp_stat_boosts if skill.clear_temp_stats[:user]
apply_temp_boost(skill.target_temp_boost)
user.apply_temp_boost(skill.user_temp_boost)
end
#--------------------------------------------------------------------------
# * Apply Item Effects
#--------------------------------------------------------------------------
alias item_effect_sss_temp_boosts item_effect unless $@
def item_effect(user, item)
item_effect_sss_temp_boosts(user, item)
return unless $game_temp.in_battle
return if @skipped or @missed or @evaded
clear_temp_stat_boosts if item.clear_temp_stats[:target]
user.clear_temp_stat_boosts if item.clear_temp_stats[:user]
apply_temp_boost(item.target_temp_boost)
user.apply_temp_boost(item.user_temp_boost)
end
#--------------------------------------------------------------------------
# * Maxmp Limit
#--------------------------------------------------------------------------
unless method_defined?(:maxmp_limit)
def maxmp_limit; return 9999; end
end
#--------------------------------------------------------------------------
# * Parameter Limit
#--------------------------------------------------------------------------
unless method_defined?(:parameter_limit)
def parameter_limit; return 999; end
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
alias maxhp_sss_temp_boosts maxhp unless $@
def maxhp
clear_temp_stat_boosts if @temp_maxhp_boost.nil?
return [[maxhp_sss_temp_boosts + @temp_maxhp_boost, 1].max, maxhp_limit].min
end
#--------------------------------------------------------------------------
# * Get Maximum MP
#--------------------------------------------------------------------------
alias maxmp_sss_temp_boosts maxmp unless $@
def maxmp
clear_temp_stat_boosts if @temp_maxmp_boost.nil?
return [[maxmp_sss_temp_boosts + @temp_maxmp_boost, 0].max, maxmp_limit].min
end
#--------------------------------------------------------------------------
# * Get Attack
#--------------------------------------------------------------------------
alias atk_sss_temp_boosts atk unless $@
def atk
clear_temp_stat_boosts if @temp_atk_boost.nil?
return [[atk_sss_temp_boosts + @temp_atk_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Defense
#--------------------------------------------------------------------------
alias def_sss_temp_boosts def unless $@
def def
clear_temp_stat_boosts if @temp_def_boost.nil?
return [[def_sss_temp_boosts + @temp_def_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Spirit
#--------------------------------------------------------------------------
alias spi_sss_temp_boosts spi unless $@
def spi
clear_temp_stat_boosts if @temp_spi_boost.nil?
return [[spi_sss_temp_boosts + @temp_spi_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Agility
#--------------------------------------------------------------------------
alias agi_sss_temp_boosts agi unless $@
def agi
clear_temp_stat_boosts if @temp_agi_boost.nil?
return [[agi_sss_temp_boosts + @temp_agi_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Dexterity
#--------------------------------------------------------------------------
if $imported["DEX Stat"]
alias dex_sss_temp_boosts dex unless $@
def dex
clear_temp_stat_boosts if @temp_dex_boost.nil?
return [[dex_sss_temp_boosts + @temp_dex_boost, 1].max, parameter_limit].min
end
end
#--------------------------------------------------------------------------
# * Get Resist
#--------------------------------------------------------------------------
if $imported["RES Stat"]
alias res_sss_temp_boosts res unless $@
def res
clear_temp_stat_boosts if @temp_res_boost.nil?
return [[res_sss_temp_boosts + @temp_res_boost, 1].max, parameter_limit].min
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Hit Rate
#--------------------------------------------------------------------------
alias hit_sss_temp_boosts_actor hit unless $@
def hit
clear_temp_stat_boosts if @temp_hit_boost.nil?
return [hit_sss_temp_boosts_actor + @temp_hit_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Evasion Rate
#--------------------------------------------------------------------------
alias eva_sss_temp_boosts_actor eva unless $@
def eva
clear_temp_stat_boosts if @temp_eva_boost.nil?
return [eva_sss_temp_boosts_actor + @temp_eva_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Critical Ratio
#--------------------------------------------------------------------------
alias cri_sss_temp_boosts_actor cri unless $@
def cri
clear_temp_stat_boosts if @temp_cri_boost.nil?
return [cri_sss_temp_boosts_actor + @temp_cri_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Ease of Hitting
#--------------------------------------------------------------------------
alias odds_sss_temp_boosts_actor odds unless $@
def odds
clear_temp_stat_boosts if @temp_odds_boost.nil?
return [odds_sss_temp_boosts_actor + @temp_odds_boost, 0].max
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Get Hit Rate
#--------------------------------------------------------------------------
alias hit_sss_temp_boosts_enemy hit unless $@
def hit
clear_temp_stat_boosts if @temp_hit_boost.nil?
return [hit_sss_temp_boosts_enemy + @temp_hit_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Evasion Rate
#--------------------------------------------------------------------------
alias eva_sss_temp_boosts_enemy eva unless $@
def eva
clear_temp_stat_boosts if @temp_eva_boost.nil?
return [eva_sss_temp_boosts_enemy + @temp_eva_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Critical Ratio
#--------------------------------------------------------------------------
alias cri_sss_temp_boosts_enemy cri unless $@
def cri
clear_temp_stat_boosts if @temp_cri_boost.nil?
return [cri_sss_temp_boosts_enemy + @temp_cri_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Ease of Hitting
#--------------------------------------------------------------------------
alias odds_sss_temp_boosts_enemy odds unless $@
def odds
clear_temp_stat_boosts if @temp_odds_boost.nil?
return [odds_sss_temp_boosts_enemy + @temp_odds_boost, 0].max
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Battle Start Processing
#--------------------------------------------------------------------------
alias process_battle_start_sss_temp_boosts process_battle_start unless $@
def process_battle_start
for member in $game_party.members
member.clear_temp_stat_boosts
end
process_battle_start_sss_temp_boosts
end
#--------------------------------------------------------------------------
# * End Battle
#--------------------------------------------------------------------------
alias battle_end_sss_temp_boosts battle_end unless $@
def battle_end(result)
battle_end_sss_temp_boosts(result)
for member in $game_party.members
member.clear_temp_stat_boosts
end
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================[/spoiler]
Did you search?Yes.
Where did you search?
- Google
- The Script Database/This Forum
- Other Forums related to RPG Maker VX
What did you search for?
- RPG Maker VX "Mana Regen"/MP
- RPG Maker VX Custom Stats
- RPG Maker VX Spirit restoring/regenerating Mana/MP
Thanks very much in advance. Due to the lack of scripting skills, I'm not sure if any of this can be done. About the 1st request, if you've got any other ideas about making SPIRIT useful again, please tell me!
OK, so, in the matter of my first request, which is also in the title, I think I've resolved the issue myself, without scripting. It's not exactly what I had in mind, but it works.
For those who were interested in knowing how to do this, here's what I did.
Basically, you need to add the following page in every "Troop", with both the conditions: "When the end of the turn" and "Turn No. 0 + 1 *X" active. Span: Turn.
Create a Variable (I called it "SPI/Mana").
Control Variables: [...SPI/Mana] = [Actor1]'s Spirit
Control Variables: [...SPI/Mana] / 10
Change MP: [Actor1] + Variable [...SPI/Mana]
Obviously "Actor1" is the name of the first character in your database. Repeat the same sequence in the same page for every other actor. Then "Copy Event Page" and paste it for every "Troop". At the end of every turn all actors receive an amount of Mana equal to a 10th of their Spirit. By changing the second line you can increase or decrease this percentage, so that: "/4" (25%), "/2" (50%) and so on.
I'm still wishing someone will take my second request! :)
I will do that after work today.
Sorry, I forgot about this. I will look into it tomorrow.
It's OK, there's no rush! It's already too kind of you to take my request :) I was hoping you would of all people
</flattery>
Hey, totally untested, so try it in a new project first, but here:
#===============================================================================
#
# Shanghai Simple Script - Temporary Stat Boosts
# Last Date Updated: 2010.05.22
# Level: Normal
#
# Temporary stat boosts only last during battle. After battle, they're cleared
# and everything returns back to normal.
#===============================================================================
# Instructions
# -----------------------------------------------------------------------------
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ? Materials but above ? Main. Remember to save.
#
# These are for items and skills.
#
# <target temp stat: +x>
# <target temp stat: -x>
# Gives a temporary boost of x for the stat to target of skill. Replace "stat"
# maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
#
# <user temp stat: +x>
# <user temp stat: -x>
# Gives a temporary boost of x for the stat to user of skill. Replace "stat"
# maxhp, maxmp, atk, def, spi, agi, hit, eva, cri, odds, dex, or res
#
# <clear temp stats: user>
# <clear temp stats: target>
# Will clear the temp stats for the user or target.
#===============================================================================
$imported = {} if $imported == nil
$imported["TemporaryStatBoosts"] = true
#==============================================================================
# RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# target_temp_boost
#--------------------------------------------------------------------------
def target_temp_boost
return @target_temp_boost if @target_temp_boost != nil
@target_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
:spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
:dex => 0, :res => 0}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:TARGET TEMPORARY|target temp)[ ](.*):[ ]([\+\-]\d+)(%?)>/i
@target_temp_boost[$1.downcase.to_sym] = $3.nil? ? $2.to_i : ($2.to_f / 100.0)
end
}
return @target_temp_boost
end
#--------------------------------------------------------------------------
# user_temp_boost
#--------------------------------------------------------------------------
def user_temp_boost
return @user_temp_boost if @user_temp_boost != nil
@user_temp_boost = {:maxhp => 0, :maxmp => 0, :atk => 0, :def => 0,
:spi => 0, :agi => 0, :hit => 0, :eva => 0, :cri => 0, :odds => 0,
:dex => 0, :res => 0}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:USER TEMPORARY|user temp)[ ](.*):[ ]([\+\-]\d+)>/i
@user_temp_boost[$1.downcase.to_sym] = $3.nil? ? $2.to_i : ($2.to_f / 100.0)
end
}
return @user_temp_boost
end
#--------------------------------------------------------------------------
# clear_temp_stats
#--------------------------------------------------------------------------
def clear_temp_stats
return @clear_temp_stats if @clear_temp_stats != nil
@clear_temp_stats = {:user => false, :target => false}
self.note.split(/[\r\n]+/).each { |line|
case line
when /<(?:CLEAR TEMP STATS|clear temp boosts)[ ](.*)>/i
case $1.upcase
when "USER"
@clear_temp_stats[:user] = true
when "TARGET", "TARGETS"
@clear_temp_stats[:target] = true
end
end
}
return @clear_temp_stats
end
end
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_sss_temp_stat_boosts initialize unless $@
def initialize
initialize_sss_temp_stat_boosts
clear_temp_stat_boosts
end
#--------------------------------------------------------------------------
# * Clear Temp Stat Boosts
#--------------------------------------------------------------------------
def clear_temp_stat_boosts
@temp_maxhp_boost = 0
@temp_maxmp_boost = 0
@temp_atk_boost = 0
@temp_def_boost = 0
@temp_spi_boost = 0
@temp_agi_boost = 0
@temp_hit_boost = 0
@temp_eva_boost = 0
@temp_cri_boost = 0
@temp_odds_boost = 0
@temp_dex_boost = 0
@temp_res_boost = 0
end
#--------------------------------------------------------------------------
# * Apply Temp Boost
#--------------------------------------------------------------------------
def apply_temp_boost(hash)
@temp_maxhp_boost += (hash[:maxhp].is_a? (Float) ? (self.maxhp*hash[:maxhp]).to_i : hash[:maxhp])
@temp_maxmp_boost += (hash[:maxmp].is_a? (Float) ? (self.maxmp*hash[:maxmp]).to_i : hash[:maxmp])
@temp_atk_boost += (hash[:atk].is_a? (Float) ? (self.atk*hash[:atk]).to_i : hash[:atk])
@temp_def_boost += (hash[:def].is_a? (Float) ? (self.def*hash[:def]).to_i : hash[:def])
@temp_spi_boost += (hash[:spi].is_a? (Float) ? (self.spi*hash[:spi]).to_i : hash[:spi])
@temp_agi_boost += (hash[:agi].is_a? (Float) ? (self.agi*hash[:agi]).to_i : hash[:agi])
@temp_hit_boost += (hash[:hit].is_a? (Float) ? (self.hit*hash[:hit]).to_i : hash[:hit])
@temp_eva_boost += (hash[:eva].is_a? (Float) ? (self.eva*hash[:eva]).to_i : hash[:eva])
@temp_cri_boost += (hash[:cri].is_a? (Float) ? (self.cri*hash[:cri]).to_i : hash[:cri])
@temp_odds_boost += (hash[:odds].is_a? (Float) ? (self.odds*hash[:odds]).to_i : hash[:odds])
@temp_dex_boost += (hash[:dex].is_a? (Float) ? (self.dex*hash[:dex]).to_i : hash[:dex])
@temp_res_boost += (hash[:res].is_a? (Float) ? (self.res*hash[:res]).to_i : hash[:res])
end
#--------------------------------------------------------------------------
# * Apply Skill Effects
#--------------------------------------------------------------------------
alias skill_effect_sss_temp_boosts skill_effect unless $@
def skill_effect(user, skill)
skill_effect_sss_temp_boosts(user, skill)
return unless $game_temp.in_battle
return if @skipped or @missed or @evaded
clear_temp_stat_boosts if skill.clear_temp_stats[:target]
user.clear_temp_stat_boosts if skill.clear_temp_stats[:user]
apply_temp_boost(skill.target_temp_boost)
user.apply_temp_boost(skill.user_temp_boost)
end
#--------------------------------------------------------------------------
# * Apply Item Effects
#--------------------------------------------------------------------------
alias item_effect_sss_temp_boosts item_effect unless $@
def item_effect(user, item)
item_effect_sss_temp_boosts(user, item)
return unless $game_temp.in_battle
return if @skipped or @missed or @evaded
clear_temp_stat_boosts if item.clear_temp_stats[:target]
user.clear_temp_stat_boosts if item.clear_temp_stats[:user]
apply_temp_boost(item.target_temp_boost)
user.apply_temp_boost(item.user_temp_boost)
end
#--------------------------------------------------------------------------
# * Maxmp Limit
#--------------------------------------------------------------------------
unless method_defined?(:maxmp_limit)
def maxmp_limit; return 9999; end
end
#--------------------------------------------------------------------------
# * Parameter Limit
#--------------------------------------------------------------------------
unless method_defined?(:parameter_limit)
def parameter_limit; return 999; end
end
#--------------------------------------------------------------------------
# * Get Maximum HP
#--------------------------------------------------------------------------
alias maxhp_sss_temp_boosts maxhp unless $@
def maxhp
clear_temp_stat_boosts if @temp_maxhp_boost.nil?
return [[maxhp_sss_temp_boosts + @temp_maxhp_boost, 1].max, maxhp_limit].min
end
#--------------------------------------------------------------------------
# * Get Maximum MP
#--------------------------------------------------------------------------
alias maxmp_sss_temp_boosts maxmp unless $@
def maxmp
clear_temp_stat_boosts if @temp_maxmp_boost.nil?
return [[maxmp_sss_temp_boosts + @temp_maxmp_boost, 0].max, maxmp_limit].min
end
#--------------------------------------------------------------------------
# * Get Attack
#--------------------------------------------------------------------------
alias atk_sss_temp_boosts atk unless $@
def atk
clear_temp_stat_boosts if @temp_atk_boost.nil?
return [[atk_sss_temp_boosts + @temp_atk_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Defense
#--------------------------------------------------------------------------
alias def_sss_temp_boosts def unless $@
def def
clear_temp_stat_boosts if @temp_def_boost.nil?
return [[def_sss_temp_boosts + @temp_def_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Spirit
#--------------------------------------------------------------------------
alias spi_sss_temp_boosts spi unless $@
def spi
clear_temp_stat_boosts if @temp_spi_boost.nil?
return [[spi_sss_temp_boosts + @temp_spi_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Agility
#--------------------------------------------------------------------------
alias agi_sss_temp_boosts agi unless $@
def agi
clear_temp_stat_boosts if @temp_agi_boost.nil?
return [[agi_sss_temp_boosts + @temp_agi_boost, 1].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# * Get Dexterity
#--------------------------------------------------------------------------
if $imported["DEX Stat"]
alias dex_sss_temp_boosts dex unless $@
def dex
clear_temp_stat_boosts if @temp_dex_boost.nil?
return [[dex_sss_temp_boosts + @temp_dex_boost, 1].max, parameter_limit].min
end
end
#--------------------------------------------------------------------------
# * Get Resist
#--------------------------------------------------------------------------
if $imported["RES Stat"]
alias res_sss_temp_boosts res unless $@
def res
clear_temp_stat_boosts if @temp_res_boost.nil?
return [[res_sss_temp_boosts + @temp_res_boost, 1].max, parameter_limit].min
end
end
end
#==============================================================================
# ** Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Hit Rate
#--------------------------------------------------------------------------
alias hit_sss_temp_boosts_actor hit unless $@
def hit
clear_temp_stat_boosts if @temp_hit_boost.nil?
return [hit_sss_temp_boosts_actor + @temp_hit_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Evasion Rate
#--------------------------------------------------------------------------
alias eva_sss_temp_boosts_actor eva unless $@
def eva
clear_temp_stat_boosts if @temp_eva_boost.nil?
return [eva_sss_temp_boosts_actor + @temp_eva_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Critical Ratio
#--------------------------------------------------------------------------
alias cri_sss_temp_boosts_actor cri unless $@
def cri
clear_temp_stat_boosts if @temp_cri_boost.nil?
return [cri_sss_temp_boosts_actor + @temp_cri_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Ease of Hitting
#--------------------------------------------------------------------------
alias odds_sss_temp_boosts_actor odds unless $@
def odds
clear_temp_stat_boosts if @temp_odds_boost.nil?
return [odds_sss_temp_boosts_actor + @temp_odds_boost, 0].max
end
end
#==============================================================================
# ** Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# * Get Hit Rate
#--------------------------------------------------------------------------
alias hit_sss_temp_boosts_enemy hit unless $@
def hit
clear_temp_stat_boosts if @temp_hit_boost.nil?
return [hit_sss_temp_boosts_enemy + @temp_hit_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Evasion Rate
#--------------------------------------------------------------------------
alias eva_sss_temp_boosts_enemy eva unless $@
def eva
clear_temp_stat_boosts if @temp_eva_boost.nil?
return [eva_sss_temp_boosts_enemy + @temp_eva_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Critical Ratio
#--------------------------------------------------------------------------
alias cri_sss_temp_boosts_enemy cri unless $@
def cri
clear_temp_stat_boosts if @temp_cri_boost.nil?
return [cri_sss_temp_boosts_enemy + @temp_cri_boost, 0].max
end
#--------------------------------------------------------------------------
# * Get Ease of Hitting
#--------------------------------------------------------------------------
alias odds_sss_temp_boosts_enemy odds unless $@
def odds
clear_temp_stat_boosts if @temp_odds_boost.nil?
return [odds_sss_temp_boosts_enemy + @temp_odds_boost, 0].max
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Battle Start Processing
#--------------------------------------------------------------------------
alias process_battle_start_sss_temp_boosts process_battle_start unless $@
def process_battle_start
for member in $game_party.members
member.clear_temp_stat_boosts
end
process_battle_start_sss_temp_boosts
end
#--------------------------------------------------------------------------
# * End Battle
#--------------------------------------------------------------------------
alias battle_end_sss_temp_boosts battle_end unless $@
def battle_end(result)
battle_end_sss_temp_boosts(result)
for member in $game_party.members
member.clear_temp_stat_boosts
end
end
end
#===============================================================================
#
# END OF FILE
#
#===============================================================================SSS
Hope it works! To use a percentage, just do as you wanted and put a percentage sign after the number. So:
<target temp MaxMP: +10%>
Tested, it works. Thanks a lot! :) I changed the label of the topic to [Solved]. Do you think I should make a Tutorial about the solution of the first request?
Sure! Lots of people will probably find it helpful.