MP regenaration script

Hi everyone,

I'm looking for a script that gives the characters 0 MP at the beginning of a battle and at the start of their turn they get a fixed amount of MP to use which gets added on to their existing MP. As far as I can tell, you can do this with a percentage of yout total MP using states but i'm looking for a fixed regeneration amount. An example of this in a game is Final Fantasy Tactics Advance 2, please see the link below for a visual aid. (Skip forward to about 2:30 for the battle).

http://www.youtube.com/watch?v=ugSbEHloGVw

In the example, the characters get 10 MP at the start of every turn regardless of how much MP they already have.

At the end of the battle, I want the characters to keep the MP they haven't used for out of battle skills (Cures and whatnot) but always reset the MP back to 0 once the next battle starts.

This is a link to what i'm using at the moment, although it doesnt work correctly as it is for vx.

http://forums.rpgmakerweb.com/index.php?/topic/3379-mp-regen-system/

I am also using this little script with the above script, but these together are unreliable and skips turns/gives double MP on occasions.

Spoiler
#==============================================================================# ** Scene_Battle#------------------------------------------------------------------------------# This class performs battle screen processing.#==============================================================================class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias tds_mp_turn_regen_scene_battle_battle_start battle_start alias tds_mp_turn_regen_scene_battle_turn_end turn_end #-------------------------------------------------------------------------- # * Battle Start #-------------------------------------------------------------------------- def battle_start # Run Original Method tds_mp_turn_regen_scene_battle_battle_start # Set Game Party Members MP to 0 $game_party.members.each {|m| m.mp = 10} $game_party.members.each {|m| m.mp = 10} # Refresh Status refresh_status end #-------------------------------------------------------------------------- # * End Turn #-------------------------------------------------------------------------- def turn_end # Run Original Method tds_mp_turn_regen_scene_battle_turn_end # Increase Game Party Members HP by 1 $game_party.alive_members.each {|m| m.mp += 10} # Refresh Status refresh_status endend
If you need more information, just let me know!

Thanks
Give this script a try: http://victorscripts.wordpress.com/rpg-maker-vx-ace/gameplay-scripts/custom-slip-effect/

It allows you to set up formulas for poison/regen effects just as you would any other skill. You can probably event the resetting of MP at the beginning of each battle with a troop event.
Thanks for the quick reply.

I had a few problems with the script to start off with but I got it working eventually. I had a lookbut I'm not sure how to go about restricting the formula to increasing MP by X at the start of the character's turn and at no other time. Do you know what kind of formula I would have to put in?

And with the battle troop event, would I have to add the event to every troop I make? Is there a script call that can be ran to set it for every battle scene?
You can try my Slip Damage EX script... 🙂

http://forums.rpgmakerweb.com/index.php?/topic/13607-slip-damage-ex-v106/
I can't seem to get your script to work, i'm having a problem at line 531. Got the same result in a new game.
can you post a screenshot? the current version wasn't tested yet coz I don't have access to my RM when I made the edits...

EDIT: try this:

1) Go to the script

2) Hit CTRL+H

3) on the find part, put actor.

4) on the replace with part, put self.actor.

5) hit replace all

6) Hit CTRL+H

7) on the find part, put class.

8) on the replace with part, put self.class.
I tried the fix but I get a new problem.

Line 872: can't find string "self" anywhere before EOF
oh wait, make sure that the Class definitions didn't get replaced... things like Class Game_Battler... it could be that they become replaced too... sorry, I just can't upload the edited script right now...
why you don't work with TP instead of this mana mode?. Just curious
as for setting it to 0 at start of battle, find the line in the battle scripts that initiate battle, and set character mp to zero there...

^maybe he's using it for other things...

but if you don't, I suggest just using TP... and set all skills to have the same TP addition value...
as for setting it to 0 at start of battle, find the line in the battle scripts that initiate battle, and set character mp to zero there...

^maybe he's using it for other things...

but if you don't, I suggest just using TP... and set all skills to have the same TP addition value...
What he is looking is not viable since MP mechanics are based on using skills until you deplete the amount to 0; not increasing it as turn passes to use limit breakers with it.

Also what FenixFyreX did with that script for VX is convert the MP System in to a TP system. I think that what he is trying to achieve can be done ith Yanfly TP manager since you can change the TP limit and how actor gain TP in battle, also if you add fixed TRG Ex-Param trait on the database to the actors or classes the system will work as he wants, cuz the fixed amount, he can even change the "TP" vocab to "MP"  :blink:   👍
I think I have an idea for the mechanics. What are you using as a battle script?
I want to make sure it would work with that.
I need you to test this out on a new project without other battle scripts. (BATTLE HUDS may work if it doesn't alter turns)
I think I made something worthwhile.

 

Spoiler
=beginNeil Zero MP Battle v 0.1bDescription:Replicates Tactics Ogre MP Mechanics, where you start out with zero and slowlygain your MP per turn.Free to use for non-commercial games.For commercial games, a verified donation of $1.00to my Paypal (http://bit.ly/feed-calimack) will suffice.Script by California Macky a.k.a. noelburgundy27 a.k.a. mackintosh=endmodule ZERO_MP_GEN #This variable sets Base MP_Regen per turn. Use number values only. #Decimals are rounded off Base_MPGen = 10 endmodule 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.battle_start nuke_mp $game_system.battle_count += 1 $game_party.on_battle_start $game_troop.on_battle_start $game_troop.enemy_names.each do |name| $game_message.add(sprintf(Vocab::Emerge, name)) end if @preemptive $game_message.add(sprintf(Vocab:😛reemptive, $game_party.name)) elsif @surprise $game_message.add(sprintf(Vocab::Surprise, $game_party.name)) end wait_for_message end #-------------------------------------------------------------------------- # * Start Turn #-------------------------------------------------------------------------- def self.turn_start @phase = :turn clear_actor $game_troop.increase_turn make_action_orders end end #MODULE ENDclass Scene_Battle < Scene_Base include ZERO_MP_GEN 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 def turn_start @party_command_window.close @actor_command_window.close @status_window.unselect @subject = nil BattleManager.turn_start @log_window.wait @log_window.clear end def turn_end all_battle_members.each do |battler| battler.mp += (Base_MPGen * (1.0 + battler.mrg)).round.to_i battler.on_turn_end refresh_status @log_window.display_auto_affected_status(battler) @log_window.wait_and_clear end BattleManager.turn_end process_event start_party_command_selection end end #CLASS Scene_Battle END 
If this works, let me know so I can release this. If you have suggestions and other ideas, let me know as well. I never knew I missed Engineering like this. T.T

EDIT: I think I realized too late I necro-posted. I'm so sorry. T_T
You should learn to use Aliases rather than overwriting methods like that to increase compatibility


And yeah, this is a necropost... Sorry
Necro-posted AND double-posted. 😉

Original thread: https://forums.rpgmakerweb.com/threads/mp-regenaration-script.16007/