Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Tactics Ogre MP Battle v 1.1a
- 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.
- ================================================================================
- CHANGELOG
- 1.0a - Completed script and fixed a few bugs with default system
- 1.1a - Added feature to enable/disable MRG and TRG for all battlers
- ================================================================================
- TERMS OF USE (DO NOT EDIT)
- For both commercial and non-commercial projects, please credit me and hand me
- a copy of the game. Email me at [ [email protected] ] 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
- #MRG and TRG automatically restores MP and TP in the default system.
- #Use these to disable or enable
- Active_Default_MRG = true
- Active_Default_TRG = 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 = 5
- #-----------------------------------------------------------------------------
- # 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 < Base_MPGen)
- 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 < Base_TPGen)
- 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 unless !Active_Default_MRG
- regenerate_tp unless !Active_Default_TRG
- 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
Advertisement
Add Comment
Please, Sign In to add comment