Is there a way to make a spell convert a specified amount of HP to MP and MP to HP?
The spell should not be able to kill the user. So if you have 600HP and the spell converts 1000HP to MP it will stay at 1 HP and convert 599 HP instead. Same with MP but that can go down to 0.
You might be able to do this with some of the HP damaging skills and SP adding skills in Tons of Addons, but it will probably require a bit of planning and possibly some tiny tweaking of the script. It should be doable, though. :)
I don't know how to edit scripts thought :uhm:
1) Do you want me to make it so the skills only work if they have the necessary HP/MP?
2) Would you like me to implement percentages? For example: Convert 50% of your HP to MP and vica versa.
3) Would it be easier to make dummy elements such as "HP to MP" and "MP to HP" and then mark the skills accordingly? Or would you rather have an array of skills to configure in the script itself?
1: The skills should always work, however the caster can't kill itself by converting too much HP to MP. The caster also cannot convert more HP/MP than what they have.
2: That would be nice!
3: No idea what this means.
1) Okie dokes
2) Dokie okes
3)
You have two options: Script configuration or Element configuration
Script Configuration:
In the script, you'll define which skills are HP to MP / MP to HP. So you'll have two things to setup in the script.
Or...
Element Configuration:
You can create two new elements in your System Tab, name them "HP to MP" and "MP to HP", then all you have to do is mark the skills you want with those elements, that way the script knows which skills are supposed to convert HP/MP.
I want to define the ability ID's in the scrits. That works best for me :)
Sounds good, I'll have it done by the end of the day.
Also, the script should theoretically work if you want to use the skill on other targets. e.g. Use the skill on a team member, it'll suck your MP but it'll give an ally HP
The skill is intended to work for a targeted ally and if it is casted on another party member the MP/HP is ONLY converted for the targeted ally. The caster isn't affected as long as she doesn't cast it on herself. Unless I put a MP cost, which I won't :D
Oh okay. Well I should probably fix that then. It was setup so it would take from the caster since that seemed a bit more logical to begin with.
Okay, hopefully this works out.
#===============================================================================
# HP/SP Reversal
# Author gameus
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Uses skills to take SP and convert it to HP or vica versa. The way it's setup
# is if the target is hit with one of these skills, it takes their HP/SP and
# turns it into the other stat. The skill itself doesn't affect the caster
# itself other than taking SP from the skill cost.
#
# Features:
# Use a fixed rate or a percentage
# Skills can work on enemies or allies
# Easy Setup
#
# Setting Up:
# To define a skill as HP to SP, add the id to the HP2SP array.
# Do the same for SP to HP skills, except add it to SP2HP array.
# To define the skills rate as "fixed" or "percentage", just set the skill
# to the desired rate in the config below. (Examples are provided)
#
# To define the amount of HP or SP to convert, all you do is go into the
# database and set the skill's "Power" attribute. e.g.
# If you have a skill that converts 100 HP to SP, make sure it's setup in the
# config:
# HP2SP = {
# skill_id => :fixed,
# }
# Then you go to the database and set teh power to 100. If it's a percentage,
# You just set the power to the percentage you want. e.g. 25% is 25 power.
#
# It is not possible to kill the target by converting HP to SP, but you can
# deplete all of the SP converting it to HP
#
# Compatibility:
# Not tested with SDK
# Not tested with any other skill add-ons but it should work
#
# Credits:
# gameus ~ creating it
# Mark Hest ~ Requesting it
#===============================================================================
module HPSP
# These are skills that convert HP to SP
HP2SP = {
59 => :fixed,
60 => :percent,
}
# These are skills that convert SP to HP
SP2HP = {
57 => :fixed,
58 => :percent,
}
# Ignore everything below.
def self.has?(skill_id)
return (HP2SP.include?(skill_id) || SP2HP.include?(skill_id))
end
def self.type(skill_id)
return nil if !self.has?(skill_id)
return :hp if HP2SP.include?(skill_id)
return :sp if SP2HP.include?(skill_id)
end
end
class Game_Actor < Game_Battler
alias gg_convert_hpmp_skill_effect_lat skill_effect
def skill_effect(user, skill)
if HPSP.has?(skill.id)
type = HPSP.type(skill.id)
rate = type == :hp ? HPSP::HP2SP[skill.id] : HPSP::SP2HP[skill.id]
amount = rate == :fixed ? skill.power : (skill.power * 0.01)
if type == :hp && self.hp > 1
amount = (rate == :fixed ? [self.hp - 1, amount].min : self.hp * amount).ceil
self.hp -= amount.to_i
self.sp += amount.to_i
self.damage = "-#{amount} +#{amount}"
elsif type == :sp && self.sp > 0
amount = (rate == :fixed ? [self.sp, amount].min : self.sp * amount).ceil
self.hp += amount.to_i
self.sp -= amount.to_i
self.damage = "+#{amount} -#{amount}"
else
return false
end
return true
end
return gg_convert_hpmp_skill_effect_lat(user, skill)
end
end
Example of it working in battle (also works in the menu).
(http://i.imgur.com/0jzC2xR.png)
Configuration. It's all explained in the script but here's a bit of help.
(http://i.imgur.com/7uFo8y0.png)
(http://i.imgur.com/r3oqzJg.png)
Quote from: gameus on November 04, 2013, 10:20:29 pm
Okay, hopefully this works out.
#===============================================================================
# HP/SP Reversal
# Author gameus
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Uses skills to take SP and convert it to HP or vica versa. The way it's setup
# is if the target is hit with one of these skills, it takes their HP/SP and
# turns it into the other stat. The skill itself doesn't affect the caster
# itself other than taking SP from the skill cost.
#
# Features:
# Use a fixed rate or a percentage
# Skills can work on enemies or allies
# Easy Setup
#
# Setting Up:
# To define a skill as HP to SP, add the id to the HP2SP array.
# Do the same for SP to HP skills, except add it to SP2HP array.
# To define the skills rate as "fixed" or "percentage", just set the skill
# to the desired rate in the config below. (Examples are provided)
#
# To define the amount of HP or SP to convert, all you do is go into the
# database and set the skill's "Power" attribute. e.g.
# If you have a skill that converts 100 HP to SP, make sure it's setup in the
# config:
# HP2SP = {
# skill_id => :fixed,
# }
# Then you go to the database and set teh power to 100. If it's a percentage,
# You just set the power to the percentage you want. e.g. 25% is 25 power.
#
# It is not possible to kill the target by converting HP to SP, but you can
# deplete all of the SP converting it to HP
#
# Compatibility:
# Not tested with SDK
# Not tested with any other skill add-ons but it should work
#
# Credits:
# gameus ~ creating it
# Mark Hest ~ Requesting it
#===============================================================================
module HPSP
# These are skills that convert HP to SP
HP2SP = {
59 => :fixed,
60 => :percent,
}
# These are skills that convert SP to HP
SP2HP = {
57 => :fixed,
58 => :percent,
}
# Ignore everything below.
def self.has?(skill_id)
return (HP2SP.include?(skill_id) || SP2HP.include?(skill_id))
end
def self.type(skill_id)
return nil if !self.has?(skill_id)
return :hp if HP2SP.include?(skill_id)
return :sp if SP2HP.include?(skill_id)
end
end
class Game_Actor < Game_Battler
alias gg_convert_hpmp_skill_effect_lat skill_effect
def skill_effect(user, skill)
if HPSP.has?(skill.id)
type = HPSP.type(skill.id)
rate = type == :hp ? HPSP::HP2SP[skill.id] : HPSP::SP2HP[skill.id]
amount = rate == :fixed ? skill.power : (skill.power * 0.01)
if type == :hp && self.hp > 1
amount = (rate == :fixed ? [self.hp - 1, amount].min : self.hp * amount).ceil
self.hp -= amount.to_i
self.sp += amount.to_i
self.damage = "-#{amount} +#{amount}"
elsif type == :sp && self.sp > 0
amount = (rate == :fixed ? [self.sp, amount].min : self.sp * amount).ceil
self.hp += amount.to_i
self.sp -= amount.to_i
self.damage = "+#{amount} -#{amount}"
else
return false
end
return true
end
return gg_convert_hpmp_skill_effect_lat(user, skill)
end
end
Example of it working in battle (also works in the menu).
(http://i.imgur.com/0jzC2xR.png)
Configuration. It's all explained in the script but here's a bit of help.
(http://i.imgur.com/7uFo8y0.png)
(http://i.imgur.com/r3oqzJg.png)
You whipped that up in one day? You're awesome, G_G. :)
Just curious, why use symbols when you can use strings?
Iunno. Not really much of a difference, especially if it's just used for configuration options. And plus I don't have to make the string into all lowercases before comparing since "Fixed" doesn't equal "fixed".
Finaly got some sleep and I'm not a wandering potatoe anymore. Thank you so much for the script GG! :haha:
I'll be sure to report any bugs if I find any in the script. Thank you again :)
Found a bug. It is incompatible with another script I am using:
Full Reflection System by BlizzardWhen I use my ability I get the error:
QuoteScript 'Full Refection System' line 160: ArgumentError occurred.
wrong number of arguments(3 for 2)
The line in the full reflection script says:
target.skill_effect(battler, skill, true)
Put my script below this one. Or vice versa.
Still the same error :huh:
Remove 'Game_Actor < ' in G_G's script.
Still the same error :xD:
Impossibru--I wasn't getting the error immediately before the activation of a skill. Reflect script is still below it?
Okay, try this Mark. I did what KK20 suggested and removed "Game_Actor < "
#===============================================================================
# HP/SP Reversal
# Author gameus
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Uses skills to take SP and convert it to HP or vica versa. The way it's setup
# is if the target is hit with one of these skills, it takes their HP/SP and
# turns it into the other stat. The skill itself doesn't affect the caster
# itself other than taking SP from the skill cost.
#
# Features:
# Use a fixed rate or a percentage
# Skills can work on enemies or allies
# Easy Setup
#
# Setting Up:
# To define a skill as HP to SP, add the id to the HP2SP array.
# Do the same for SP to HP skills, except add it to SP2HP array.
# To define the skills rate as "fixed" or "percentage", just set the skill
# to the desired rate in the config below. (Examples are provided)
#
# To define the amount of HP or SP to convert, all you do is go into the
# database and set the skill's "Power" attribute. e.g.
# If you have a skill that converts 100 HP to SP, make sure it's setup in the
# config:
# HP2SP = {
# skill_id => :fixed,
# }
# Then you go to the database and set teh power to 100. If it's a percentage,
# You just set the power to the percentage you want. e.g. 25% is 25 power.
#
# It is not possible to kill the target by converting HP to SP, but you can
# deplete all of the SP converting it to HP
#
# Compatibility:
# Not tested with SDK
# Not tested with any other skill add-ons but it should work
#
# Credits:
# gameus ~ creating it
# Mark Hest ~ Requesting it
#===============================================================================
module HPSP
# These are skills that convert HP to SP
HP2SP = {
59 => :fixed,
60 => :percent,
}
# These are skills that convert SP to HP
SP2HP = {
57 => :fixed,
58 => :percent,
}
# Ignore everything below.
def self.has?(skill_id)
return (HP2SP.include?(skill_id) || SP2HP.include?(skill_id))
end
def self.type(skill_id)
return nil if !self.has?(skill_id)
return :hp if HP2SP.include?(skill_id)
return :sp if SP2HP.include?(skill_id)
end
end
class Game_Battler
alias gg_convert_hpmp_skill_effect_lat skill_effect
def skill_effect(user, skill)
if HPSP.has?(skill.id)
type = HPSP.type(skill.id)
rate = type == :hp ? HPSP::HP2SP[skill.id] : HPSP::SP2HP[skill.id]
amount = rate == :fixed ? skill.power : (skill.power * 0.01)
if type == :hp && self.hp > 1
amount = (rate == :fixed ? [self.hp - 1, amount].min : self.hp * amount).ceil
self.hp -= amount.to_i
self.sp += amount.to_i
self.damage = "-#{amount} +#{amount}"
elsif type == :sp && self.sp > 0
amount = (rate == :fixed ? [self.sp, amount].min : self.sp * amount).ceil
self.hp += amount.to_i
self.sp -= amount.to_i
self.damage = "+#{amount} -#{amount}"
else
return false
end
return true
end
return gg_convert_hpmp_skill_effect_lat(user, skill)
end
end
And then, I placed Blizzard's Reflection Script under my script and I didn't get the error anymore.
Ah yes, I did change it back to being above it after getting the error. I Changed it back to being under it again and now it works :D Thank you!
What happened is I edited the method under Game_Actor rather than Game_Battler. Blizzard's script edits Game_Battler and tried calling the method when target ended up begin an actor and my method didn't support three arguments.
Just a thought... Shouldn't a MP to HP skill be already possible to do without any additional scripts? Just make a healing spell that costs a certain amount of MP that heals the exact same amount in HP.
Naturally this won't work is it costs a certain percentage of MP or it's a HP to MP skill. :D
An MP to HP does already work, but percentages don't, and the point was, he also wanted an HP to MP skill. Not to mention, this script makes it so whatever target he uses it on, uses the target's MP and HP, not the caster.