How would i change this script
so that when TP gets over a certain amount, MP starts decreasing by the amount TP is over that amount?
=begin
Tactics Ogre MP Battle v 1.0a
Script by California Macky a.k.a. Neil a.k.a. mackintosh a.k.a. noelburgundy27
Description:
Replicates Tactics Ogre (Let Us Cling Together) MP and TP Mechanics,
where you start out with zero MP and/or TP, which you slowly gain per turn.
That means no one can immediately cast their spells and must wait it out or
strategize. Ideal for turn-based battles.
This version is still in alpha and may need tweaks. If you find any, PM me
in the forums or leave a comment in my wordpress. If you have formula ideas,
please let me know, as well.
(http://calimackrpg.wordpress.com)
Instructions:
Put this below your battle scripts and above Main.
TERMS OF USE (DO NOT EDIT)
For both commercial and non-commercial projects, please credit me and hand me
a copy of the game when it is complete.
Email me at [ [email hidden] ] regarding due process.
Donations are appreciated. ( http://bit.ly/feed-calimack )
=end
module MP_TP_GEN
#If true, MP starts at 0 and slowly regens by Base_MPGen and actor MRG
Active_MPGen = true
#If true, TP starts at 0 and slowly regens by Base_TPGen and actor TRG and TCR
#TP resets to 0 every time battle starts.
Active_TPGen = true
#Charge TP when receiving damage. Input true or false
DMG_TPGen = false
#TP is preserved after battle. Does not apply when Active_TPGen is ON.
PRESERVE_TP = true
#This variable sets Base MP_Regen per turn. Use number values only.
#Decimals are rounded off.
Base_MPGen = 5
#This variable sets Base TP_Regen per turn. Use number values only.
#Decimals are rounded off.
Base_TPGen = -2
#-----------------------------------------------------------------------------
# The Formula for MP regen each turn end. Change as desired.
def mp_regen(battler)
sum = (battler.mmp) / 25 * (1.0 + battler.mrg)
sum += Base_MPGen if (sum < 1)
battler.mp += sum.round.to_i
end
#-----------------------------------------------------------------------------
# The Formula for TP regen each second. Change as desired.
def tp_regen(battler)
sum = (battler.max_tp) / 25 * (battler.tcr) * (1.0 + battler.trg)
sum += Base_TPGen if (sum < 1)
battler.tp += sum.round.to_i
end
end
#===============================================================================
# WARNING
# Customization ends here. Proceed at your
# own risk, people.
#
#===============================================================================
#===============================================================================
#
# *BattleManager
#
#===============================================================================
module BattleManager
def self.nuke_mp
$game_party.members.each do |actor|
actor.mp = 0
end
$game_troop.members.each do |actor|
actor.mp = 0
end
end
def self.nuke_tp
$game_party.members.each do |actor|
actor.tp = 0
end
$game_troop.members.each do |actor|
actor.tp = 0
end
end
end
#===============================================================================
#
# *Game_Battler
#
#===============================================================================
class Game_Battler < Game_BattlerBase
include MP_TP_GEN
#--------------------------------------------------------------------------
# * Initialize TP
#--------------------------------------------------------------------------
alias neil_normal_init_tp init_tp
def init_tp
neil_normal_init_tp
end
#--------------------------------------------------------------------------
# * Regenerate All
#--------------------------------------------------------------------------
def regenerate_all
if alive?
regenerate_hp
#regenerate_mp
#regenerate_tp
end
end
def charge_tp_by_damage(damage_rate)
self.tp += 50 * damage_rate * tcr if DMG_TPGen
end
def preserve_tp?
return PRESERVE_TP
end
#--------------------------------------------------------------------------
# * Processing at Start of Battle
#--------------------------------------------------------------------------
def on_battle_start
neil_normal_init_tp unless preserve_tp?
self.tp = 0 if Active_TPGen
self.mp = 0 if Active_MPGen
end
#--------------------------------------------------------------------------
# * Processing at End of Action
#--------------------------------------------------------------------------
alias neil_on_action_end on_action_end
def on_action_end
neil_on_action_end
end
#--------------------------------------------------------------------------
# * Processing at End of Turn
#--------------------------------------------------------------------------
alias neil_on_turn_end on_turn_end
def on_turn_end
neil_on_turn_end
end
end
#===============================================================================
#
# *Scene_Battle
#
#===============================================================================
class Scene_Battle < Scene_Base
include MP_TP_GEN
alias neil_normal_battle_start battle_start
def battle_start
neil_normal_battle_start
BattleManager.nuke_mp if Active_MPGen
BattleManager.nuke_tp if Active_TPGen
end
def mmp_total
sum = 0.0
$game_party.battle_members.each do |actor|
sum += actor.mmp
end
$game_troop.members.each do |actor|
sum += actor.mmp
end
return sum
end
alias neil_normal_turn_end turn_end
def turn_end
all_battle_members.each do |battler|
if !(battler.hp == 0)
mp_regen(battler) if Active_MPGen
tp_regen(battler) if Active_TPGen
end
end
neil_normal_turn_end
end
end #CLASS Scene_Battle END
Tactics Ogre MP Battle v 1.0a
Script by California Macky a.k.a. Neil a.k.a. mackintosh a.k.a. noelburgundy27
Description:
Replicates Tactics Ogre (Let Us Cling Together) MP and TP Mechanics,
where you start out with zero MP and/or TP, which you slowly gain per turn.
That means no one can immediately cast their spells and must wait it out or
strategize. Ideal for turn-based battles.
This version is still in alpha and may need tweaks. If you find any, PM me
in the forums or leave a comment in my wordpress. If you have formula ideas,
please let me know, as well.
(http://calimackrpg.wordpress.com)
Instructions:
Put this below your battle scripts and above Main.
TERMS OF USE (DO NOT EDIT)
For both commercial and non-commercial projects, please credit me and hand me
a copy of the game when it is complete.
Email me at [ [email hidden] ] regarding due process.
Donations are appreciated. ( http://bit.ly/feed-calimack )
=end
module MP_TP_GEN
#If true, MP starts at 0 and slowly regens by Base_MPGen and actor MRG
Active_MPGen = true
#If true, TP starts at 0 and slowly regens by Base_TPGen and actor TRG and TCR
#TP resets to 0 every time battle starts.
Active_TPGen = true
#Charge TP when receiving damage. Input true or false
DMG_TPGen = false
#TP is preserved after battle. Does not apply when Active_TPGen is ON.
PRESERVE_TP = true
#This variable sets Base MP_Regen per turn. Use number values only.
#Decimals are rounded off.
Base_MPGen = 5
#This variable sets Base TP_Regen per turn. Use number values only.
#Decimals are rounded off.
Base_TPGen = -2
#-----------------------------------------------------------------------------
# The Formula for MP regen each turn end. Change as desired.
def mp_regen(battler)
sum = (battler.mmp) / 25 * (1.0 + battler.mrg)
sum += Base_MPGen if (sum < 1)
battler.mp += sum.round.to_i
end
#-----------------------------------------------------------------------------
# The Formula for TP regen each second. Change as desired.
def tp_regen(battler)
sum = (battler.max_tp) / 25 * (battler.tcr) * (1.0 + battler.trg)
sum += Base_TPGen if (sum < 1)
battler.tp += sum.round.to_i
end
end
#===============================================================================
# WARNING
# Customization ends here. Proceed at your
# own risk, people.
#
#===============================================================================
#===============================================================================
#
# *BattleManager
#
#===============================================================================
module BattleManager
def self.nuke_mp
$game_party.members.each do |actor|
actor.mp = 0
end
$game_troop.members.each do |actor|
actor.mp = 0
end
end
def self.nuke_tp
$game_party.members.each do |actor|
actor.tp = 0
end
$game_troop.members.each do |actor|
actor.tp = 0
end
end
end
#===============================================================================
#
# *Game_Battler
#
#===============================================================================
class Game_Battler < Game_BattlerBase
include MP_TP_GEN
#--------------------------------------------------------------------------
# * Initialize TP
#--------------------------------------------------------------------------
alias neil_normal_init_tp init_tp
def init_tp
neil_normal_init_tp
end
#--------------------------------------------------------------------------
# * Regenerate All
#--------------------------------------------------------------------------
def regenerate_all
if alive?
regenerate_hp
#regenerate_mp
#regenerate_tp
end
end
def charge_tp_by_damage(damage_rate)
self.tp += 50 * damage_rate * tcr if DMG_TPGen
end
def preserve_tp?
return PRESERVE_TP
end
#--------------------------------------------------------------------------
# * Processing at Start of Battle
#--------------------------------------------------------------------------
def on_battle_start
neil_normal_init_tp unless preserve_tp?
self.tp = 0 if Active_TPGen
self.mp = 0 if Active_MPGen
end
#--------------------------------------------------------------------------
# * Processing at End of Action
#--------------------------------------------------------------------------
alias neil_on_action_end on_action_end
def on_action_end
neil_on_action_end
end
#--------------------------------------------------------------------------
# * Processing at End of Turn
#--------------------------------------------------------------------------
alias neil_on_turn_end on_turn_end
def on_turn_end
neil_on_turn_end
end
end
#===============================================================================
#
# *Scene_Battle
#
#===============================================================================
class Scene_Battle < Scene_Base
include MP_TP_GEN
alias neil_normal_battle_start battle_start
def battle_start
neil_normal_battle_start
BattleManager.nuke_mp if Active_MPGen
BattleManager.nuke_tp if Active_TPGen
end
def mmp_total
sum = 0.0
$game_party.battle_members.each do |actor|
sum += actor.mmp
end
$game_troop.members.each do |actor|
sum += actor.mmp
end
return sum
end
alias neil_normal_turn_end turn_end
def turn_end
all_battle_members.each do |battler|
if !(battler.hp == 0)
mp_regen(battler) if Active_MPGen
tp_regen(battler) if Active_TPGen
end
end
neil_normal_turn_end
end
end #CLASS Scene_Battle END