iPhone App Directory
RPG Maker VX
 
Gallery Members Search Calendar Help


Welcome Guest ( Log In | Register )

Collapse

>Announcement

Keep an eye out for the upcoming 3rd Quarter Contest!
 
Reply to this topicStart new topic
> Recover on Guard - KGC Guard Recover Extended, Now with more customizing
Rating 5 V
Digioso
post Oct 15 2011, 04:05 PM
Post #1



Group Icon


Type: Designer
Alignment: Unaligned




Recover on Guard - KGC_GuardRecover Extended
Written by TOMY - http://ytomy.sakura.ne.jp/
Edited by Digioso - http://www.digioso.org


Introduction
This script allows you to add HP/MP Recovery percentiles to the battle guard/defend command.
So basically whenever your characters (or your enemies) guard he/she/it will recover some HP/MP.
The original script only had a global value for all characters. So all your characters did recover 5% of their HP. Now you can set the rates for each of your characters individually. Same goes for enemy HP/MP recovery values. And you can change these values during the game as well.

Features
- Player characters can recover HP/MP through guarding
- Enemies can recover HP/MP through guarding

Screenshot
http://www.digioso.org/cgi-bin/gallery.pl?...gc_guardrec.png

How to Use
Spoiler:

Put the script into the "Materials" section and above "Main process".

The script has four configuration items: HP_RATE_ACTOR (for player character HP reg), MP_RATE_ACTOR (player MP reg), HP_RATE_ENEMY (enemy HP reg) and MP_RATE_ENEMY (enemy MP reg). It is recommended to change the standard values to whatever you need for your game. You probably don't want your 2nd hero to recover 100% of his/her HP during guarding. smile.gif
CODE
# 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


Demo
See attached zip file. Just run around until you see a fight. Use the "Guard" command in battle to see what the script is capable of. Talk to Ralph in the game to change the recovery values for him during the game.
The newest version of this demo/script can also be found here: http://www.digioso.org/KGC_GuardRec

Script
Spoiler:
The newest version of this demo/script can also be found here: http://www.digioso.org/KGC_GuardRec
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

#==============================================================================
# ¦ Game_Battler
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ? Defending Recovery Calculation
# hp_rate : HP Recovery Rate
# mp_rate : MP Recovery Rate
#--------------------------------------------------------------------------
def make_guard_recover_value(hp_rate, mp_rate)
recover_hp = maxhp * hp_rate / 100
if hp_rate > 0
recover_hp = [1, recover_hp].max
elsif hp_rate < 0
recover_hp = [-1, recover_hp].min
end

recover_mp = maxmp * mp_rate / 100
if mp_rate > 0
recover_mp = [1, recover_mp].max
elsif mp_rate < 0
recover_mp = [-1, recover_mp].min
end

@hp_damage -= recover_hp
@mp_damage -= recover_mp
end
end

#==================================End Class===================================#
#==============================================================================
# ¦ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? Apply Recovery Effect
#--------------------------------------------------------------------------
def guard_recover_effect
clear_action_results
if(KGC::GuardRecover::HP_RATE_ACTOR.has_key?(@actor_id))
if(KGC::GuardRecover::MP_RATE_ACTOR.has_key?(@actor_id))
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR[@actor_id],
KGC::GuardRecover::MP_RATE_ACTOR[@actor_id])
else
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR[@actor_id],
KGC::GuardRecover::MP_RATE_ACTOR["default"])
end
else
if(KGC::GuardRecover::MP_RATE_ACTOR.has_key?(@actor_id))
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR["default"],
KGC::GuardRecover::MP_RATE_ACTOR[@actor_id])
else
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ACTOR["default"],
KGC::GuardRecover::MP_RATE_ACTOR["default"])
end
end
execute_damage(nil)
end
end

#==================================End Class===================================#
#==============================================================================
# ¦ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
#--------------------------------------------------------------------------
# ? Apply Recovery Effect
#--------------------------------------------------------------------------
def guard_recover_effect
clear_action_results
if(KGC::GuardRecover::HP_RATE_ENEMY.has_key?(@enemy_id))
if(KGC::GuardRecover::MP_RATE_ENEMY.has_key?(@enemy_id))
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ENEMY[@enemy_id],
KGC::GuardRecover::MP_RATE_ENEMY[@enemy_id])
else
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ENEMY[@enemy_id],
KGC::GuardRecover::MP_RATE_ENEMY["default"])
end
else
if(KGC::GuardRecover::MP_RATE_ENEMY.has_key?(@enemy_id))
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ENEMY["default"],
KGC::GuardRecover::MP_RATE_ENEMY[@enemy_id])
else
make_guard_recover_value(
KGC::GuardRecover::HP_RATE_ENEMY["default"],
KGC::GuardRecover::MP_RATE_ENEMY["default"])
end
end
execute_damage(nil)
end
end

#==================================End Class===================================#
#==============================================================================
# ¦ Scene_Battle
#==============================================================================

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


FAQ
Q: The demo won't open, how to open it?
A: Download 7-zip and try again.

Credit and Thanks
Written by TOMY - http://ytomy.sakura.ne.jp/
Edited by Digioso - http://www.digioso.org

Author's Notes
These changes were requested by TheDrifter here.
Well, he only wanted that his first actor recoverd 10% HP/MP while everyone else gets 5%. I took it a step further and made these customization options for all actors/enemies.

This post has been edited by Digioso: Oct 23 2011, 05:55 PM
Attached File(s)
Attached File  kgc_guardrec.zip ( 243.37K ) Number of downloads: 19
 


--------------------
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   
Digioso
post Oct 17 2011, 07:34 AM
Post #2



Group Icon


Type: Designer
Alignment: Unaligned




Just a small update:
I didn't change anything to how the script actually works, I just updated the documentation in the script.
It is possible to change all recovery rates (for actors and enemies alike) in the middle of the game.
So if you want to change the recovery rates at some point in your game (eg your characters fell into the magical river of magical regeneration) you can do that as well!
I updated the documentation in the first posting and attached a demo which shows how to do that and the script with the extended documentation there.


--------------------
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   
thechancellor
post Nov 3 2011, 04:01 PM
Post #3


RPG Enthusiast
Group Icon


Type: Writer
Alignment: Lawful Good




This is totally badass. You just helped me put an additional feature into my game. Thank you very much.
Go to the top of the page
 
+Quote Post
   
Digioso
post Nov 3 2011, 05:40 PM
Post #4



Group Icon


Type: Designer
Alignment: Unaligned




You're welcome. smile.gif
But you should thank TOMY more than me. smile.gif


--------------------
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   
bladethebetrayer
post Nov 15 2011, 04:08 AM
Post #5



Group Icon


Type: Undisclosed




Hi. I love your script very much. One slight issue I found was that when using tankentai sbs they didn't heal until after the party gets attacked. Is there something I can do on my end?

This post has been edited by bladethebetrayer: Nov 15 2011, 04:12 AM
Go to the top of the page
 
+Quote Post
   
Digioso
post Nov 15 2011, 03:27 PM
Post #6



Group Icon


Type: Designer
Alignment: Unaligned




Hmm, it's working as designed. The problem here lies with Tankentai. It calculates this kind of things at the end of a turn. Eg. when your heroes are poisoned they'll receive the poison-damage at the end of the turn, too.


--------------------
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   
bladethebetrayer
post Nov 16 2011, 05:47 AM
Post #7



Group Icon


Type: Undisclosed




but its not at the end of the turn.its after they are damaged by enemies.
Go to the top of the page
 
+Quote Post
   
Digioso
post Nov 16 2011, 02:02 PM
Post #8



Group Icon


Type: Designer
Alignment: Unaligned




Hmm... I don't know the SBS that good. Never really had a look at how it's done. smile.gif
It's overwriting a lot of stuff, so that's probably the cause for this.

Edit:

I just checked. At the end of the turn it does the recover.
Can you please recheck?
I'm using the SBS myself (without ATB) and it works.
I created an enemy that doesn't attack and removed some HP from my hero.
All I did was guarding and at the end of every turn I got some HP.

Maybe there's some incompatiblity with something else for you? Perhaps any other script overwriting some methods?

This post has been edited by Digioso: Nov 16 2011, 02:26 PM


--------------------
Leg dich nie mit einem BAOD an, oder du bist selber dran.

Das Leben ist grausam.
Wenn es mal nicht grausam ist, ist es grausamer.

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 17th September 2014 - 04:40 AM

RPGMakerVX.net is an Privacy Policy, Legal.