02-12-2024, 04:29 AM
(This post was last modified: 02-13-2024, 09:30 AM by kyonides.
Edit Reason: Added Condition
)
ACE HP or SP Recovery Rate
Final Version
For Actors, Enemies, Items, Skills, States
by Kyonides
Introduction
By default the VX ACE engine offers you 1 Sp-Parameter to alter the HP and the SP Recovery Rates.
This script lets you keep their increase rates separate!
Just read the embedded comments in the script below to learn how to use it.
The Script
Code:
# * ACE HP or MP Recovery Rates *
# Scripter : Kyonides Arkanthes
# v1.0.0 - 2024-02-13
# Just leave a Note Tag in the corresponding Note Box.
# Valid for Actors, Enemies or Items or Skills or States.
# For HP or MP Only. Normally, you would only need 1 of them!
# It is applied to damage calculation whenever a recovery item is being used.
# Use the REC Sp-Parameter for the other value instead.
# - Examples:
# <hp recover 1000>
# <mp recover 1000>
# <hp recover 0.5>
module HpMpRec
RECOVER_HP_NOTE_TAG = /<hp recover (\d+[.]?\d*)>/i
RECOVER_MP_NOTE_TAG = /<mp recover (\d+[.]?\d*)>/i
def find_recover_note(type)
note_tag = type == :hp ? RECOVER_HP_NOTE_TAG : RECOVER_MP_NOTE_TAG
@note[note_tag]
$1.to_f
end
def hp_recover
find_recover_note(:hp)
end
def mp_recover
find_recover_note(:mp)
end
end
class RPG::BaseItem
include HpMpRec
end
class Game_Battler
def states_hp_rec
states.inject(0.0) {|n, s| n + s.hp_recover }
end
def states_mp_rec
states.inject(0.0) {|n, s| n + s.mp_recover }
end
def item_effect_recover_hp(user, item, effect)
rec_rate = db_unit.hp_recover + item.hp_recover + states_hp_rec
rec_rate = rec if rec_rate == 0
value = (mhp * effect.value1 + effect.value2) * rec_rate
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.hp_damage -= value
@result.success = true
self.hp += value
end
def item_effect_recover_mp(user, item, effect)
rec_rate = db_unit.mp_recover + item.mp_recover + states_mp_rec
rec_rate = rec if rec_rate == 0
value = (mmp * effect.value1 + effect.value2) * rec_rate
value *= user.pha if item.is_a?(RPG::Item)
value = value.to_i
@result.mp_damage -= value
@result.success = value != 0
self.mp += value
end
def apply_recovery_rate(value, item)
rate = 0
rate += db_unit.hp_recover + item.hp_recover if item.damage.to_hp?
rate += db_unit.mp_recover + item.mp_recover if item.damage.to_mp?
value *= rec + rate
end
def make_damage_value(user, item)
value = item.damage.eval(user, self, $game_variables)
value *= item_element_rate(user, item)
value *= pdr if item.physical?
value *= mdr if item.magical?
value = apply_recovery_rate(value, item) if item.damage.recover?
value = apply_critical(value) if @result.critical
value = apply_variance(value, item.damage.variance)
value = apply_guard(value)
@result.make_damage(value.to_i, item)
end
end
class Game_Actor
alias :db_unit :actor
end
class Game_Enemy
alias :db_unit :enemy
end
Terms & Conditions
Free for use in ANY game.
Due credit is mandatory.
That's it!
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE