RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VX] Adding Pop Damage

0 Members and 1 Guest are viewing this topic.

*
Rep: +0/-0Level 60
RMRK Junior
Hopefully this is the proper place as opposed to Script Requests. Apologies if it isn't.

To get right to the point, I've modified KGC Guard Recover to work with KGC Skill CP System to allow for an equippable skill that that causes them recover HP (and optionally MP) when they use the guard command. It functions well enough, in that HP and MP do seem to recover when the actors are defending.

However now I want/need to add a little polish; since I'm also using Tankentai SBS with ATB, I need to go one step further and have the recover numbers pop up.

So, can anyone help me figure out how to go about doing that? I'm learning Ruby at a snail's pace, and could use some assistance.


Here's the modified version of the script
Spoiler for:
Code: [Select]
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_
#_/         ◆     Recover on Guard - KGC_GuardRecover      ◆ VX ◆
#_/         ◇             Last Update: 2008/08/10               ◇
#_/         ◇            Translated by Mr. Anonymous            ◇
#                      Modified by SaburoX on 4/10/2015
#_/-----------------------------------------------------------------------------
#_/  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.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_

#==============================================================================#
#                             ★ Customization ★                                #
#==============================================================================#

module KGC
  module GuardRecover
    # KGC Skill CP Compatibiltiy - These are the Skill IDS the player needs to
    # equip via the CP system to get the effects.
    MEDIGUARD_ID = 132 # Recover HP when defending
    MANAGUARD_ID = 133 # Recover MP when defending
   
    # ◆ Default Recovery Rate [In Percentile]
    HP_DEFAULT_RATE = 0
    MP_DEFAULT_RATE = 0
   
    # ◆ HP Recovery Rate [In Percentile]
    HP_RATE_ACTOR = 5
    # ◆ MP Recovery Rate [In Percentile]
    MP_RATE_ACTOR = 5

    end
end

#=================================End Module===================================#

$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 battle_skill_ids.include?(KGC::GuardRecover::MEDIGUARD_ID) #If the HP Recover skill is equipped
    if battle_skill_ids.include?(KGC::GuardRecover::MANAGUARD_ID) #If the MP Recover skill is equipped
            make_guard_recover_value(
            KGC::GuardRecover::HP_RATE_ACTOR, # If both skills are equipped,
            KGC::GuardRecover::MP_RATE_ACTOR) # recover both.
          else
            make_guard_recover_value(
            KGC::GuardRecover::HP_RATE_ACTOR,   # If Just HP Recover skill is equipped,
            KGC::GuardRecover::MP_DEFAULT_RATE) # recover only HP.
          end
        else
    if battle_skill_ids.include?(KGC::GuardRecover::MANAGUARD_ID) #If only the MP Recover skill is equipped
            make_guard_recover_value(
            KGC::GuardRecover::HP_DEFAULT_RATE, # Do not recover HP
            KGC::GuardRecover::MP_RATE_ACTOR)   # Recover MP
          else
            make_guard_recover_value(             # If neither HP or MP skill is equipped
            KGC::GuardRecover::HP_DEFAULT_RATE,   
            KGC::GuardRecover::MP_DEFAULT_RATE)   # Use the default recovery rates for HP and MP
          end
        end
        execute_damage(nil)
    end
end
#==================================End Class===================================#
# Enemy Content Removed

#==============================================================================
# ■ 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) # Pretty sure this is where HP recovery goes.
 elsif @active_battler.mp_damage != 0
      display_mp_damage(@active_battler) # And same with MP
    end
  end
end

And here is a demo that includes the basic Tankentai with ATB, Skill CP System, and Guard Recovery script.

https://db.tt/YJtkzjNN

I'm using many more scripts in my projects (around 100 by my last count!), but I think these are the only ones that would interact in any ways that would cause compatibility issues and I'm sure it's more appreciated if I not bog down a demo with a lot of code that might not be relevant.

Either way, thanks in advance for reading this, and I hope someone can give me a hand!