Group: Member
Posts: 25
Type: Mapper
RM Skill: Masterful
Hi, I'm currently using this script that allows the player to restore HP & MP while guarding.
KGC script
CODE
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #_/ ◆ Recover on Guard - KGC_GuardRecover ◆ VX ◆ #_/ ◇ Last Update: 08/10/2008 #_/ ◆ Written by TOMY #_/ ◆ Translation by Mr. Anonymous #_/ ◆ KGC Site: #_/ ◆ [url="http://ytomy.sakura.ne.jp/"]http://ytomy.sakura.ne.jp/[/url] #_/ ◆ Translator's Blog: #_/ ◆ [url="http://mraprojects.wordpress.com"]http://mraprojects.wordpress.com[/url] #_/----------------------------------------------------------------------------- #_/ This script allows you to add HP/MP Recovery percentiles to the battle #_/ guard/defend command. #_/ * Note from the translator: I had previously ported this script myself, #_/ this official KGC port however, is a bit more cleanly coded. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#============================================================================== # ★ BEGIN Customization ★ #==============================================================================
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● Execute Battle Action: Guard #-------------------------------------------------------------------------- alias execute_action_guard_KGC_GuardRecover execute_action_guard def execute_action_guard execute_action_guard_KGC_GuardRecover
@active_battler.guard_recover_effect if @active_battler.hp_damage != 0 display_damage(@active_battler) elsif @active_battler.mp_damage != 0 display_mp_damage(@active_battler) end end end
It works really nicely, the only thing I wish to change is the recovery rate for one of the characters, making it his specialty. In my database, it's the character #001 (class #001) if it helps. He should be able to regain 10% of his HP and 10% of his MP for guarding instead of 5% each.
Thanks a lot for your help!
This post has been edited by TheDrifter: Oct 15 2011, 11:44 AM
Group: Member
Posts: 25
Type: Mapper
RM Skill: Masterful
QUOTE (Alexander Amnell @ Oct 4 2011, 11:05 PM)
Someone else made a guard recover script already that lets you choose per actor how much to heal http://rmrk.net/index.php/topic,24165.0.html here's to hoping you don't find any conflicts with it.
Thank you for the script you provided, however I don't think it's going to cut it.
When guarding with the KGC script, you actually get a recovery sound, and I prefer what is displayed in the bottom bar. In the KGC script, you can also set it so that enemies don't recover anything when they guard (which is something I need to keep that way).
The script written by Synthesize only has one element I wish to have, and it's the fact that you can set how much each character recovers.
Is there a way to import that part of the script to the KGC one? My RGSS2 skills are void. Thanks for your help!
Synthesize's script
CODE
#========================================================================== ===== # Regenerate HP/MP - RMVX Version #=============================================================================== # Written by Synthesize # Version 1.2.0 # January 19, 2008 #=============================================================================== # *This script is not compatible with RPG Maker XP* #=============================================================================== module SynRegen # Format = { Actor_ID => Percent to restore, Actor_ID2 => Percent to restore} HP_regen = {1 => 10, 2 => 5, 3 => 5, 4 => 5, 5 => 5, 6 => 5, 7 => 5, 8 => 5, 9 => 5} # % # You can define how much HP each individual actor regenerates when they # Defend. Add new actors by seperating each returning value with a comma (,) #----------------------------------------------------------------------------- # This value determines the Default Percent growth if the Actor_ID is not # in the above hash HP_regen.default = 0 # % #----------------------------------------------------------------------------- # Set to true to enable HP regen in battle, false to disable. Use_hp_regen = true #---------------------------------------------------------------------------- # Format = {Actor_ID => SP to restore SP_regen = {1 => 20, 2 => 10, 3 => 10, 4 => 10, 5 => 10, 6 => 10, 7 => 10, 8 => 10, 9 => 10} # % # You can define how much SP each individual actor regenerates when they # defend. Add new actors by seperating each returning value with a comma (,) #----------------------------------------------------------------------------- # This is the default percentage to regenerate if the Actor_ID is not in the # hash. SP_regen.default = 0 # % #----------------------------------------------------------------------------- # Set to true to enable, false to disable Use_mp_regen = true #----------------------------------------------------------------------------- # Draw how much HP/MP the actor regenerated? Draw_text = true #----------------------------------------------------------------------------- # The defense rate if the actor has 'Super Defense' Super_guard_rate = 4 #----------------------------------------------------------------------------- # The defense rate if the actor has 'Normal Defense' Normal_guard_rate = 2 end #------------------------------------------------------------------------------- # Scene_Battle # This aliases the execute_action_guard method in Scene_Battle #------------------------------------------------------------------------------- class Scene_Battle # Alias execute_action_guard alias syn_regen_execute_guard execute_action_guard #----------------------------------------------------------------------------- # Execute Action_Guard #----------------------------------------------------------------------------- def execute_action_guard # Calculate the amount of HP and MP gained hp_restore = ((@active_battler.maxhp * SynRegen::HP_regen[@active_battler.id]) / 100) if SynRegen::Use_hp_regen == true sp_restore = ((@active_battler.maxmp * SynRegen::SP_regen[@active_battler.id]) / 100) if SynRegen::Use_mp_regen == true # Calculate the different between MaxHP, HP, MaxMP and MP temp_value_hp = (@active_battler.maxhp - @active_battler.hp) temp_value_mp = (@active_battler.maxmp - @active_battler.mp) # Add HP and MP @active_battler.hp += hp_restore if SynRegen::Use_hp_regen == true @active_battler.mp += sp_restore if SynRegen::Use_mp_regen == true # Draw how much HP/MP the actor regenerated if temp_value_hp != 0 and temp_value_mp != 0 @message_window.add_instant_text("#{@active_battler.name} HP increased by #{hp_restore} and MP increased by #{sp_restore}") elsif temp_value_hp != 0 and temp_value_mp == 0 @message_window.add_instant_text("#{@active_battler.name} HP increased by #{hp_restore}") elsif temp_value_hp == 0 and temp_value_mp != 0 @message_window.add_instant_text("#{@active_battler.name} MP increased by #{sp_restore}") end # Call the original code syn_regen_execute_guard end end #------------------------------------------------------------------------------- # Game_Battler # This rewrites the defense method found in Game_Battler #------------------------------------------------------------------------------- class Game_Battler #----------------------------------------------------------------------------- # Apply_Guard_Damage #----------------------------------------------------------------------------- def apply_guard(damage) if damage > 0 and guarding? # Divide the total damage from the effectivness of the defense rate. damage /= super_guard ? SynRegen::Super_guard_rate : SynRegen::Normal_guard_rate end return damage end end #=============================================================================== # This script is not compatible with Rpg Maker XP. However, I have also made a # RPG Maker Xp version which can be found on RPGRPG Revolution. #=============================================================================== # * This script is untested but should work in theory * #=============================================================================== # Written by Synthesize # January 19, 2008 #=============================================================================== # Regenerate HP/MP - RMVX Version #===============================================================================
This post has been edited by TheDrifter: Oct 5 2011, 06:30 PM
Group: Member
Posts: 25
Type: Mapper
RM Skill: Masterful
QUOTE (Digioso @ Oct 14 2011, 01:13 PM)
Here you are.
Basically what I did was changing the variable used for specifying the values to a hash. You put the actor_id/enemy_id in there and specify the value for this id. More info is in the script.
Final Script
CODE
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #_/ ? Recover on Guard - KGC_GuardRecover ? VX ? #_/ ? Last Update: 08/10/2008 #_/ ? Written by TOMY #_/ ? Translation by Mr. Anonymous #_/ ? KGC Site: #_/ ? [url="http://ytomy.sakura.ne.jp/"]http://ytomy.sakura.ne.jp/[/url] #_/ ? Translator's Blog: #_/ ? [url="http://mraprojects.wordpress.com"]http://mraprojects.wordpress.com[/url] #_/ ? Edited by Digioso on 14.10.2011 so that you can now specify the recovery #_/ ? values for each actor/enemy seperately. If not specified a default value is used. #_/ ? [url="http://www.digioso.org"]http://www.digioso.org[/url] #_/----------------------------------------------------------------------------- #_/ This script allows you to add HP/MP Recovery percentiles to the battle #_/ guard/defend command. #_/ * Note from the translator: I had previously ported this script myself, #_/ this official KGC port however, is a bit more cleanly coded. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#============================================================================== # ? BEGIN Customization ? #==============================================================================
module KGC module GuardRecover
# Guarding HP recovery rate in percent # Syntax: # Actor_ID => percent, # eg actor 2 recovers 100% of his/her HP # Actors you don't specify recover the value behind default # If you're fine with just the default value and don't want any # settings for anything else, # remove all other stuff AND the "," in the default row # Some goes for the MP below and the enemy HP/MP recovery HP_RATE_ACTOR = { "default" => 5, 1 => 10, 2 => 100, 3 => 5 } # Do not remove this line
# Guarding MP recovery rate in percent MP_RATE_ACTOR = { "default" => 5, 1 => 10, 2 => 5, 3 => 100 } # Do not remove this line
# ? Guarding Enemy HP Recovery Rate in percent HP_RATE_ENEMY = { "default" => 0, 1 => 5 } # Do not remove this line
# ? Guarding Enemy MP Recovery Rate in percent MP_RATE_ENEMY = { "default" => 0, 1 => 5 } # Do not remove this line end end
#============================================================================== # ? END Customization ? #==============================================================================
$imported = {} if $imported == nil $imported["GuardRecover"] = true
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ? Execute Battle Action: Guard #-------------------------------------------------------------------------- alias execute_action_guard_KGC_GuardRecover execute_action_guard def execute_action_guard execute_action_guard_KGC_GuardRecover
@active_battler.guard_recover_effect if @active_battler.hp_damage != 0 display_damage(@active_battler) elsif @active_battler.mp_damage != 0 display_mp_damage(@active_battler) end end end
OMG! It's absolutely perfect! It's the best birthday present I ever had : D I'm impressed, it's so well done, it's exactly what I've been looking for! Thank you so very much!
This post has been edited by TheDrifter: Oct 15 2011, 11:42 AM
Group: Member
Posts: 20
Type: Event Designer
RM Skill: Skilled
You're welcome.
Edit:
And here's an updated version of the script. It is possible to change the recovery values during the game as well. So you're not limited to setting them up once and instead can change them whenever you want. Soo attached demo for more info.
Edit: And I did a small update to the script as well:
[spoiler][code]#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_ #_/ ? Recover on Guard - KGC_GuardRecover Extended 1.1 ? VX ? #_/ ? Last Update: 08/10/2008 #_/ ? Written by TOMY #_/ ? Translation by Mr. Anonymous #_/ ? KGC Site: #_/ ? http://ytomy.sakura.ne.jp/ #_/ ? Translator's Blog: #_/ ? http://mraprojects.wordpress.com #_/ ? Edited by Digioso on 14.10.2011 so that you can now specify the recovery #_/ ? values for each actor/enemy seperately. If not specified a default value is used. #_/ ? http://www.digioso.org #_/ ? Updated documentation on 17.10.2011 #_/----------------------------------------------------------------------------- #_/ This script allows you to add HP/MP Recovery percentiles to the battle #_/ guard/defend command. #_/ * Note from the translator: I had previously ported this script myself, #_/ this official KGC port however, is a bit more cleanly coded. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#============================================================================== # ? BEGIN Customization ? #==============================================================================
module KGC module GuardRecover
# Guarding HP recovery rate in percent # Syntax: # Actor_ID => percent, # eg actor 2 recovers 100% of his/her HP # Actors you don't specify recover the value behind default # If you're fine with just the default value and don't want any # settings for anything else, # remove all other stuff AND the "," in the default row # Some goes for the MP below and the enemy HP/MP recovery
# It is possible to change the recovery rates in the middle of the game # as well! So if one of your characters falls in the magical river of # magical recovery and you want him to recover 10% HP instead of 5% # create a script event and put this into it: # KGC::GuardRecover::HP_RATE_ACTOR[1] = 10 # This changes the HP recovery rate for actor 1 (Ralph in this demo) to 10% # Works with MP (use KGC::GuardRecover::MP_RATE_ACTOR[actor_id] ) and # the recovery rates of enemies as well: # KGC::GuardRecover::HP_RATE_ENEMY[enemy_id] and KGC::GuardRecover::MP_RATE_ENEMY[enemy_id]
HP_RATE_ACTOR = { "default" => 5, 1 => 10, 2 => 100, 3 => 5 } # Do not remove this line
# Guarding MP recovery rate in percent MP_RATE_ACTOR = { "default" => 5, 1 => 10, 2 => 5, 3 => 100 } # Do not remove this line
# ? Guarding Enemy HP Recovery Rate in percent HP_RATE_ENEMY = { "default" => 0, 1 => 5 } # Do not remove this line
# ? Guarding Enemy MP Recovery Rate in percent MP_RATE_ENEMY = { "default" => 0, 1 => 5 } # Do not remove this line end end
#============================================================================== # ? END Customization ? #==============================================================================
$imported = {} if $imported == nil $imported["GuardRecover"] = true
class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ? Execute Battle Action: Guard #-------------------------------------------------------------------------- alias execute_action_guard_KGC_GuardRecover execute_action_guard def execute_action_guard execute_action_guard_KGC_GuardRecover
@active_battler.guard_recover_effect if @active_battler.hp_damage != 0 display_damage(@active_battler) elsif @active_battler.mp_damage != 0 display_mp_damage(@active_battler) end end end
This post has been edited by Digioso: Oct 23 2011, 10:43 AM