- Joined
- Nov 29, 2015
- Messages
- 24
- Reaction score
- 1
- First Language
- English
- Primarily Uses
Okay, so I've got kind of a problem here with Mr Bubble's Blood Magic script (which can be found in the spoiler tags/link below).
https://mrbubblewand...s3/blood-magic/
The idea is to make TP skills use HP instead. I got that part down. One of my classes, a Blood Knight, uses HP for their skills, but what bothers me is that apparently it seems to affect the magic users as well. So if a healing spell costs 20 MP normally, it takes 20 HP away from the caster instead. Well, I managed to solve that issue, but I just found another one.
If I use the healing spell outside of battle, it takes TP. It drains the TP to 0, then it begins casting it for free, ignoring the 20 MP cost. I could restrict the healing to be used only in battle, but that seems rather silly and not really practical since people will want to heal after a battle is over. Could someone take a look over the script and shed some light on this, and hopefully provide a solution to my problem here? I certainly can't have people getting free heals, lol.
EDIT: Spoiler tag doesn't seem to be working correctly. Sorry, I tried :/
# ╔═══════════════════════════════════════════════════════╤══════╤═══════════╗# ║ Blood Magic │ v1.1 │ (1/04/12) ║# ╚═══════════════════════════════════════════════════════╧══════╧═══════════╝# Script by:# Mr. Bubble ( http://mrbubblewand.wordpress.com/ )# Thanks to:# Yanfly, whose scripts and designs I heavily referenced in order# to learn RGSS3 and make this script# VXA Help File#--------------------------------------------------------------------------# - What is Blood Magic? / What are Blood Mages?## "Every mage can feel the dark lure of blood magic. Originally# learned from demons, these dark rites tap into the power of blood,# converting life into mana and giving the mage command over the minds# of others. Such power comes with a price, though; a blood mage must# sacrifice his/her own health, or the health of allies, to fuel these# abilities." - Dragon Age: Origins, Blood Mage specialization description## Blood magic is a form of magic that uses the power inherent in blood to# fuel spellcasting. To put it simply, Blood Magic is the ability to use HP# to cast skills instead of MP. This essentially increases the battler's# effective MP.## - What makes Blood Magic different from giving skills a simple HP cost?## The main reason why Blood Magic is incredibly effective in the Dragon Age# series is the option to have the MP to HP conversion ratio become# even more efficient through passive skills or equipment bonuses. However,# these pieces of gear were generally hard to come by.## Blood Magic MP to HP conversions are done from a 1:x MP to HP ratio# where x is the total blood magic bonus value of the caster. This means that# the higher the bonus, the more "effective MP" the battler potentially has.## For example, if the caster's Blood Magic MP to HP ratio is 3:1 and the# caster has 30 health, the battler's "effective MP" pool becomes 90.## - Does this mean battlers can just heal themselves for infinite HP?## Not necessarily. In the Dragon Age series, Blood Magic is a sustained# state that can be freely activated and deactivated by the user. When# activated, the user gains a significant penalty to conventional healing.# In Dragon Age: Origins, the penalty is 90% reduced healing. In# Dragon Age II, the user cannot be healed at all except through# very specific means. VX Ace already has built-in options to# change recovery effect rates.## Keep in mind that in the Dragon Age series, the maximum Health and Mana# values for player characters were relatively small, never exceeding three# digits each. Spell costs were also relatively high. Using the default Blood# Magic settings in this script with the default VX Ace database# values/settings is not recommended.## Many of the Blood Magic mechanics provided in this script go beyond what# was allowed in the Dragon Age series. It is up to developers to choose how# close they wish to stick to the source material.## How balanced Blood Magic can be in a game is left up to the developer.#--------------------------------------------------------------------------# ++ Changelog ++#--------------------------------------------------------------------------# v1.1 : Bugfix update. (1/04/2012)# v1.0 : Initial release. (1/03/2012)#--------------------------------------------------------------------------# ++ Installation ++#--------------------------------------------------------------------------# Install this script in the Materials section in your project's# script editor.#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-# ++ Notetags ++#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-# The following Notetags are for Actors, Classes, Weapons, Armors, Enemies,# and States:### Activates Blood Magic for the given Actor, Class, or Enemy. If the Blood# Magic tag is applied to a piece of equipment, it will activate Blood Magic# when it is equipped. If the Blood Magic tag is applied to a State, it# will activate Blood Magic when the battler is inflicted by it.## Be very cautious with what you add this tag to especially Actors and# Classes since they will have no way to deactivate innate Blood Magic.#### Provides a bonus to the battler's Blood Magic Ratio for MP to HP# conversions. n can be floating point values (ex. 1.3, 0.5, etc.).#--------------------------------------------------------------------------# The following Notetags are for Skills and Items only:### Forces the skill or item to only be usable when the battler has# Blood Magic activated.### Allows the MP skill to ignore whenever Blood Magic is activated,# allowing the skill to stick to its original MP cost. Tag has no# effect on items.### Allows the skill or item to ignore the Blood Magic healing penalty# on the target. Use with discretion.#--------------------------------------------------------------------------# ++ Blood Magic Formula ++#--------------------------------------------------------------------------# This is a simplified internal formula used to calculate Blood Magic# costs.## hp_cost = (mp_cost * BASE_MP_MULTIPLIER) / blood_magic_bonuses## Floating point value results are always rounded up.#--------------------------------------------------------------------------# ++ Compatibility ++#--------------------------------------------------------------------------# This script does not overwrite any default VXA methods. All default# methods modified in this script are aliased.## This script has built-in compatibility with the following scripts:# - Yanfly Engine Ace - Skill Cost Manager## Requests for compatibility with other scripts are welcome.#--------------------------------------------------------------------------# ++ Terms and Conditions ++#--------------------------------------------------------------------------# Please do not repost this script elsewhere without permission. Newest# versions of this script can be found at http://mrbubblewand.wordpress.com/#==============================================================================$imported = {} if $imported.nil?$imported["BubsBloodMagic"] = true#==========================================================================# ++ START OF USER CUSTOMIZATION MODULE ++#==========================================================================module Bubs#==========================================================================# ++ Blood Magic Settings#==========================================================================module BloodMagic#--------------------------------------------------------------------------# Global Base Blood Magic Ratio#--------------------------------------------------------------------------# This value sets the global base conversion ratio for MP to HP.BASE_BMR = 1.0#--------------------------------------------------------------------------# Blood Magic Ratio Bonus#--------------------------------------------------------------------------# These values adds a set Blood Magic Ratio bonus to actors and enemies.ACTOR_BMR_BONUS = 0.0 # BMR Bonus for all actorsENEMY_BMR_BONUS = 0.0 # BMR Bonus for all enemies#--------------------------------------------------------------------------# Minimum Blood Magic Ratio#--------------------------------------------------------------------------# This value sets the minimum threshold for MP to HP conversionsMIN_BMR = 1.0#--------------------------------------------------------------------------# Use Maximum Blood Magic Ratio#--------------------------------------------------------------------------# true : Use MAX_BMR as the maximum MP to HP ratio# false : Unlimited MP to HP ratioUSE_MAX_BMR = false#--------------------------------------------------------------------------# Maximum Blood Magic Ratio#--------------------------------------------------------------------------# This value sets a maximum ratio limit for MP to HP blood magic conversionMAX_BMR = 10.0#--------------------------------------------------------------------------# Blood Magic Healing Penalty#--------------------------------------------------------------------------# Actors and Enemies with Blood Magic activated can receive a penalty to# their Recovery Effect Rate where 100.0 is normal healing rate (100%)# and 0.0 is no healing rate (0%).## Keep in mind that VX Ace already has a feature which can reduce overall# healing taken by the battler. This penalty stacks with those effects.BM_HEAL_PENALTY = 0.0#--------------------------------------------------------------------------# Base MP Multiplier for Blood Magic#--------------------------------------------------------------------------# This value sets an arbitrary multiplier to base MP costs when calculating# the HP cost through Blood Magic. This will not affect the actual base# MP cost or the battler's MP cost rate (mcr). Results are rounded up.## For example, if the multiplier is x2.0 and a skill costs 4 MP, then the# HP cost through Blood Magic will be as though the spell originally# costs 8 MP.## Leave this value at 1.0 for unmodified base MP calculations.MP_COST_MULTIPLIER = 1.0#--------------------------------------------------------------------------# Blood Magic General/SCM Settings#--------------------------------------------------------------------------# Some settings only apply when YEA - Skill Cost Manager is installed.BM_HP_COST_COLOR = 10 # Color used from "Window" skin.BM_HP_COST_SIZE = 20 # Font size used for Blood Magic HP costs.BM_HP_COST_SUFFIX = "%sHP" # Suffix used for Blood Magic HP costs.BM_HP_COST_ICON = 0 # Icon used for BM HP costs. Set 0 to disable.end # module BloodMagicend # module Bubs#==========================================================================# ++ END OF USER CUSTOMIZATION MODULE ++#==========================================================================#==========================================================================# ++ Bubs::Regexp#==========================================================================module Bubsmodule Regexpmodule BaseItemBLOOD_MAGIC_ACTIVE = /<(?:BLOOD_MAGIC|blood magic)>/iBLOOD_MAGIC_BONUS =/<(?:BLOOD_MAGIC_BONUS|blood magic bonus):\s*([-+]?\d+\.?\d*)>/iend # module BaseItemmodule UsableItemBLOOD_MAGIC_REQUIRED = /<(?:BLOOD_MAGIC|blood magic):\s*require[d]?>/iBLOOD_MAGIC_IGNORE_COST =/<(?:BLOOD_MAGIC|blood magic):\s*ignore cost?>/iBLOOD_MAGIC_IGNORE_PENALTY =/<(?:BLOOD_MAGIC|blood magic):\s*ignore penalty>/iend # module UsableItemend # module Regexpend # module Bubs#==========================================================================# ++ DataManager#==========================================================================module DataManager#--------------------------------------------------------------------------# alias : load_database#--------------------------------------------------------------------------class << self; alias load_database_blood_magic load_database; enddef self.load_databaseload_database_blood_magic # aliasload_notetags_blood_magicend#--------------------------------------------------------------------------# new method : load_notetags_blood_magic#--------------------------------------------------------------------------def self.load_notetags_blood_magicgroups = [$data_actors, $data_classes, $data_skills, $data_items,$data_weapons, $data_armors, $data_enemies, $data_states]for group in groupsfor obj in groupnext if obj.nil?obj.load_notetags_blood_magicendendendend # module DataManager#==========================================================================# ++ Icon#==========================================================================module Icon#--------------------------------------------------------------------------# new method : self.blood_magic_hp_cost#--------------------------------------------------------------------------def self.blood_magic_hp_cost; return Bubs::BloodMagic::BM_HP_COST_ICON; endend # module Icon#==========================================================================# ++ Window_Base#==========================================================================class Window_Base < Window#--------------------------------------------------------------------------# new method : cost_colours#--------------------------------------------------------------------------def blood_magic_hp_cost_color; text_color(Bubs::BloodMagic::BM_HP_COST_COLOR); end;end # class Window_Base#==========================================================================# ++ RPG::BaseItem#==========================================================================class RPG::BaseItem#--------------------------------------------------------------------------# public instance variables#--------------------------------------------------------------------------attr_accessor :blood_magic_activeattr_accessor :blood_magic_bonus#--------------------------------------------------------------------------# common cache : load_notetags_blood_magic#--------------------------------------------------------------------------def load_notetags_blood_magic@blood_magic_active = false@blood_magic_bonus = 0.0self.note.split(/[\r\n]+/).each { |line|case linewhen Bubs::Regexp::BaseItem::BLOOD_MAGIC_ACTIVE@blood_magic_active = truewhen Bubs::Regexp::BaseItem::BLOOD_MAGIC_BONUS@blood_magic_bonus = $1.to_fend} # self.note.splitend # defend # RPG::BaseItem#==========================================================================# ++ RPG::UsableItem#==========================================================================class RPG::UsableItem < RPG::BaseItem#--------------------------------------------------------------------------# public instance variables#--------------------------------------------------------------------------attr_accessor :blood_magic_requiredattr_accessor :blood_magic_ignore_costattr_accessor :blood_magic_ignore_penalty#--------------------------------------------------------------------------# common cache : load_notetags_blood_magic#--------------------------------------------------------------------------def load_notetags_blood_magic@blood_magic_required = false@blood_magic_ignore_cost = false@blood_magic_ignore_penalty = falseself.note.split(/[\r\n]+/).each { |line|case linewhen Bubs::Regexp::UsableItem::BLOOD_MAGIC_REQUIRED@blood_magic_required = truewhen Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_COST@blood_magic_ignore_cost = truewhen Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_PENALTY@blood_magic_ignore_penalty = trueend} # self.note.splitend # defend#==========================================================================# ++ Game_BattlerBase#==========================================================================class Game_BattlerBase#--------------------------------------------------------------------------# alias : skill_cost_payable?#--------------------------------------------------------------------------alias skill_cost_payable_blood_magic skill_cost_payable?def skill_cost_payable?(skill)if blood_magic_activated?return false if self.hp <= skill_blood_magic_hp_cost(skill)endreturn skill_cost_payable_blood_magic(skill) # aliasend#--------------------------------------------------------------------------# alias : skill_conditions_met?#--------------------------------------------------------------------------alias skill_conditions_met_blood_magic skill_conditions_met?def skill_conditions_met?(skill)return false unless blood_magic_conditions_met?(skill)return skill_conditions_met_blood_magic(skill) # aliasend#--------------------------------------------------------------------------# alias : item_conditions_met?#--------------------------------------------------------------------------alias item_conditions_met_blood_magic item_conditions_met?def item_conditions_met?(item)return false unless blood_magic_conditions_met?(item)return item_conditions_met_blood_magic(item) # aliasend#--------------------------------------------------------------------------# new method : blood_magic_conditions_met?#--------------------------------------------------------------------------def blood_magic_conditions_met?(item)return false if item.blood_magic_required && !blood_magic_activated?return trueend#--------------------------------------------------------------------------# alias : pay_skill_cost#--------------------------------------------------------------------------alias pay_skill_cost_blood_magic pay_skill_costdef pay_skill_cost(skill)pay_skill_cost_blood_magic(skill) # aliasself.hp -= skill_blood_magic_hp_cost(skill)end # def#--------------------------------------------------------------------------# alias : skill_mp_cost#--------------------------------------------------------------------------alias skill_mp_cost_blood_magic skill_mp_costdef skill_mp_cost(skill)if !skill.blood_magic_ignore_cost && blood_magic_activated?return 0elseskill_mp_cost_blood_magic(skill) # aliasendend # def#--------------------------------------------------------------------------# new method : bmr # Blood Magic Ratio#--------------------------------------------------------------------------def bmrn = Bubs::BloodMagic::BASE_BMRif actor?n += Bubs::BloodMagic::ACTOR_BMR_BONUSn += self.actor.blood_magic_bonusn += self.class.blood_magic_bonusfor equip in equipsnext if equip.nil?n += equip.blood_magic_bonusendelsen += Bubs::BloodMagic::ENEMY_BMR_BONUSn += self.enemy.blood_magic_bonusendfor state in statesnext if state.nil?n += state.blood_magic_bonusend# determine minimum blood ration = [n, Bubs::BloodMagic::MIN_BMR].max# determine maximum blood ratio capn = [n, Bubs::BloodMagic::MAX_BMR].min if Bubs::BloodMagic::USE_MAX_BMRreturn nend # def bmr#--------------------------------------------------------------------------# new method : blood_magic_activated?#--------------------------------------------------------------------------def blood_magic_activated?if actor?return true if self.actor.blood_magic_activereturn true if self.class.blood_magic_activefor equip in equipsnext if equip.nil?return true if equip.blood_magic_activeendelsereturn true if self.enemy.blood_magic_activeendfor state in statesnext if state.nil?return true if state.blood_magic_activeendreturn falseend # def blood_magic_activated?#--------------------------------------------------------------------------# new method : skill_blood_magic_hp_cost#--------------------------------------------------------------------------# Determines the MP to HP cost conversiondef skill_blood_magic_hp_cost(skill)return 0 if skill.blood_magic_ignore_cost# default mp costn = (skill.mp_cost * mcr).to_iif $imported["YEA-SkillCostManager"]n += skill.mp_cost_percent * mmp * mcrn = [n.to_i, skill.mp_cost_max].min unless skill.mp_cost_max.nil?n = [n.to_i, skill.mp_cost_min].max unless skill.mp_cost_min.nil?endn = (n * Bubs::BloodMagic::MP_COST_MULTIPLIER).ceiln = (n / bmr).ceiln = [n, 0].maxreturn nend # def skill_blood_magic_hp_cost(skill)end # class Game_BattlerBase#==========================================================================# ++ Game_Battler#==========================================================================class Game_Battler < Game_BattlerBase#--------------------------------------------------------------------------# alias : make_damage#--------------------------------------------------------------------------alias make_damage_value_blood_magic make_damage_valuedef make_damage_value(user, item)make_damage_value_blood_magic(user, item) # aliasapply_blood_magic_penalty(item)end#--------------------------------------------------------------------------# alias : apply_blood_magic_penalty#--------------------------------------------------------------------------def apply_blood_magic_penalty(item)if item.damage.recover? && self.blood_magic_activated?unless item.blood_magic_ignore_penaltypenalty = Bubs::BloodMagic::BM_HEAL_PENALTY * 0.01value = @result.hp_damage * penalty@result.make_damage(value.to_i, item)endendendend#==========================================================================# ++ Window_SkillList#==========================================================================class Window_SkillList < Window_Selectable#--------------------------------------------------------------------------# alias : draw_skill_cost#--------------------------------------------------------------------------alias draw_skill_cost_blood_magic draw_skill_costdef draw_skill_cost(rect, skill)if @actor.blood_magic_activated? &&@actor.skill_blood_magic_hp_cost(skill) > 0if $imported["YEA-SkillCostManager"]draw_blood_magic_hp_skill_cost(rect, skill)elsechange_color(blood_magic_hp_cost_color, enable?(skill))draw_text(rect, @actor.skill_blood_magic_hp_cost(skill), 2)end # $importedend # end ifdraw_skill_cost_blood_magic(rect, skill) # aliasend # def draw_skill_cost#--------------------------------------------------------------------------# new method : draw_blood_magic_hp_skill_cost#--------------------------------------------------------------------------# Used only when YEA - Skill Cost Manager is installeddef draw_blood_magic_hp_skill_cost(rect, skill)return unless @actor.skill_blood_magic_hp_cost(skill) > 0change_color(blood_magic_hp_cost_color, enable?(skill))#---icon = Icon.blood_magic_hp_costif icon > 0draw_icon(icon, rect.x + rect.width-24, rect.y, enable?(skill))rect.width -= 24end#---contents.font.size = Bubs::BloodMagic::BM_HP_COST_SIZEcost = @actor.skill_blood_magic_hp_cost(skill)text = sprintf(Bubs::BloodMagic::BM_HP_COST_SUFFIX, cost.group)draw_text(rect, text, 2)cx = text_size(text).width + 4rect.width -= cxreset_font_settingsend # def draw_blood_magic_hp_skill_costend # class Window_SkillList
The idea is to make TP skills use HP instead. I got that part down. One of my classes, a Blood Knight, uses HP for their skills, but what bothers me is that apparently it seems to affect the magic users as well. So if a healing spell costs 20 MP normally, it takes 20 HP away from the caster instead. Well, I managed to solve that issue, but I just found another one.
If I use the healing spell outside of battle, it takes TP. It drains the TP to 0, then it begins casting it for free, ignoring the 20 MP cost. I could restrict the healing to be used only in battle, but that seems rather silly and not really practical since people will want to heal after a battle is over. Could someone take a look over the script and shed some light on this, and hopefully provide a solution to my problem here? I certainly can't have people getting free heals, lol.
EDIT: Spoiler tag doesn't seem to be working correctly. Sorry, I tried :/
Last edited by a moderator:
