Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
sournote103

[mod] Every actor any enemy recovers 1 MP every turn

Recommended Posts

I realize that this is possible through events in the battle, but I feel it would be easier just to add a script. Every turn, when the party command window shows up, I want every participant in the battle to regain exactly 1 mp. Could someone help me with this?

Share this post


Link to post
Share on other sites

iam using a script that gives u mp when you use the command guard , if thats something you would want:P

Share this post


Link to post
Share on other sites

I came up with a script that should help you. I made it so that you could define which Actor should gain how much SP when the Actor Command Window appears. So, if you just want the one SP to be gained, you can set it at that. If you ever change your mind though and wish for more to be gained, you will be covered : )

 

Hope it works well for you, and if there are any issues, just let me know.

 

 

 

#==============================================================================
# *SP Gain at Actor Command
#------------------------------------------------------------------------------
# This script will allow the Actors to gain a specified amount of SP when the
# Actor Command Window appears. The script is setup for 4 actors (but slight
# modifications could easily expand it). Please insert the script above Main.

# How it works:
# Set Actor_ID = the corresponding actor number in the Database.
# e.g. In the default game, Aluxes would be Actor_ID1 = 1.
# Next, set Actor_SP_Gain = the amount of SP you wish that actor to gain.
# e.g. Actor1_SP_Gain = 10 would give the actor set to Actor1_ID 10 SP.
# Finally, set Switch = a $game_switches[].
# e.g. Switch1 uses $game_switches[1].
#
# If an expansion beyond 4 actors is needed, I have included an example of how
# to increase the script's scope. Please note the #'s below in the script for
# how a 5th actor would be added.
#==============================================================================
module Xx
 # Set $game_actors[id]
 Actor1_ID = 1
 Actor2_ID = 2
 Actor3_ID = 3
 Actor4_ID = 4
 #Actor5_ID = 5 

 # Set amount of SP to be gained
 Actor1_SP_Gain = 1
 Actor2_SP_Gain = 2
 Actor3_SP_Gain = 3
 Actor4_SP_Gain = 4
 #Actor5_SP_Gain = 5

 # Set $game_switches[id] to be used
 Switch1 = 1
 Switch2 = 2
 Switch3 = 3
 Switch4 = 4  
 #Switch5 = 5
end

class Scene_Battle
 # Include module
 include Xx
alias old_phase3_setup_command_window phase3_setup_command_window
 def phase3_setup_command_window
   # Runs previous method content
   old_phase3_setup_command_window
   # Checks for Actor
   if @active_battler == $game_actors[Actor1_ID]
     # Controls switches and SP gain
     if $game_switches[switch1] == false
       $game_switches[switch1] = true
       @active_battler.sp += Actor1_SP_Gain
       @status_window.refresh
     end
   end
   if @active_battler == $game_actors[Actor2_ID]
     if $game_switches[switch2] == false
       $game_switches[switch2] = true
       @active_battler.sp += Actor2_SP_Gain
       @status_window.refresh
     end
   end
   if @active_battler == $game_actors[Actor3_ID]
     if $game_switches[switch3] == false
       $game_switches[switch3] = true
       @active_battler.sp += Actor3_SP_Gain
       @status_window.refresh
     end
   end
   if @active_battler == $game_actors[Actor4_ID]
     if $game_switches[switch4] == false
       $game_switches[switch4] = true
       @active_battler.sp += Actor4_SP_Gain
       @status_window.refresh
     end
   end
   #if @active_battler == $game_actors[Actor5_ID]
   #  if $game_switches[switch5] == false
   #    $game_switches[switch5] = true
   #    @active_battler.sp += Actor5_SP_Gain
   #    @status_window.refresh
   #  end
   #end
 end
end

class Scene_Battle
alias old_start_phase4 start_phase4  
 def start_phase4
   # Resets switches
   $game_switches[switch1] = false
   $game_switches[switch2] = false
   $game_switches[switch3] = false
   $game_switches[switch4] = false
   #$game_switches[switch5] = false
   old_start_phase4
 end
end

 

 

 

I just re-read your post and noticed you also wanted the enemies to gain SP as well. Whoops, my bad!

 

Okay, I think this is more what you were looking for.

 

 

#==============================================================================
# *SP Gain at Party Command
#------------------------------------------------------------------------------
# This script will allow all Battlers to gain a specified amount of SP when the
# Party Command Window appears.
#
# How it works:
# Set Switch = the $game_switches[id] used.
# Next, set SP_Gain = the amount of SP you wish the Battlers to gain.
#==============================================================================
module Xx
 # Sets $game_switches[id]
 Switch = 1
 # Sets amount of SP the battlers will gain
 SP_Gain = 1
end

class Scene_Battle
 # Includes module
 include Xx
 # Add new content to methods
alias old_start_phase2 start_phase2
alias  old_start_phase4 start_phase4
 def start_phase2
   # Checks switch
   if $game_switches[switch] == false
     # Gains SP for enemies in troop
     for enemy in $game_troop.enemies
       if enemy.hp > 0
         enemy.sp += SP_Gain
       end
     end
     # Gains SP for actors in party
     for actor in $game_party.actors
       if actor.hp > 0
         actor.sp += SP_Gain
       end
     end
     # Refreshes battle_status window
     @status_window.refresh
     # Sets switch
     $game_switches[switch] = true
   end
   old_start_phase2
 end

 def start_phase4
   # Resets switch
   $game_switches[switch] = false
   old_start_phase4
 end  

 # Overwrites previous method
 def update_phase2_escape
   # Calculate enemy agility average
   enemies_agi = 0
   enemies_number = 0
   for enemy in $game_troop.enemies
     if enemy.exist?
       enemies_agi += enemy.agi
       enemies_number += 1
     end
   end
   if enemies_number > 0
     enemies_agi /= enemies_number
   end
   # Calculate actor agility average
   actors_agi = 0
   actors_number = 0
   for actor in $game_party.actors
     if actor.exist?
       actors_agi += actor.agi
       actors_number += 1
     end
   end
   if actors_number > 0
     actors_agi /= actors_number
   end
   # Determine if escape is successful
   success = rand(100) < 50 * actors_agi / enemies_agi
   # If escape is successful
   if success
     # Play escape SE
     $game_system.se_play($data_system.escape_se)
     # Return to BGM before battle started
     $game_system.bgm_play($game_temp.map_bgm)
     # Resets switch
     $game_switches[switch] = false
     # Battle ends
     battle_end(1)
   # If escape is failure
   else
     # Clear all party member actions
     $game_party.clear_actions
     # Start main phase
     start_phase4
   end
 end
end

 

 

Edited by xxultimaxx

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...