Heal HP based on spent MP

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Hello!


I was wondering if someone could help me with a state I'm trying to create. Essentially, I'm trying to create a state that heals the user's HP depending on how much MP they use. I'm open to adding scripts if they are needed.


Yanfly did create a video on this kind of state, although it's for MV opposed to VxAce. Here's the video, in case it helps better explain what I'm after:


https://www.youtube.com/watch?v=bPHtuUElRhA


Thank you!  :)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,667
First Language
German
Primarily Uses
RMMV
It can be done without a script, but it would require you to be very carefull with your skills, and it has one limitation:


Basically you can check in the damage formula if the skill user has a state applied, and if yes heal the user by a fixed amount before applying whatever other effect there is.


Main problem: the damage formula is only executed if the skill hits, you would loose the generation if the skill misses or is evaded.


And of course you need to know how much each specific skill costs, but unless you're using other scripts that would always be the number you set in the skill itself - easy to see when writing the skill damage formula
 

Alistair

Treasure Hunter
Veteran
Joined
Jun 15, 2014
Messages
283
Reaction score
196
First Language
English
Primarily Uses
RMMV
Edit: Oh man I should really look for which engine first. Sorry!
 
Last edited by a moderator:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
Thanks for the suggestions thus far! I'll certainly keep the damage formula solution in mind, although it would be nice to tie the effect to the state itself if at all possible simply due to having a somewhat rediculous smount of skills already made.


I did do some more research, and it seems that my best bet would be by using Yanfly's Lunatic States script. He has some examples in the two lunatic state packs, which I'm guessing could be made into what I'm looking for with a bit of tweaking. By chance could someone with a bit of scripting know-how take a look into this for me?
 

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
579
Reaction score
219
First Language
English
Primarily Uses
RMVXA
I needed a little practice. Try this:

#==============================================================================
#
# ▼ Yanfly Engine Ace - Lunatic States Package - Reverence Effect
#
# -- Requires: YEA - Lunatic States v1.00+
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-LSP-Reverence"] = true

#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Install this script under YEA - Lunatic States. Then, proceed to use the
# proper effects notetags to apply the proper LSP Reverence item desired.
# Look within the script for more instructions on how to use each effect.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script requires YEA - Lunatic States v1.00+ to work. It must be placed
# under YEA - Lunatic States v1.00+ in the script listing.
#
#==============================================================================

if $imported["YEA-LunaticStates"]
class Game_BattlerBase

#--------------------------------------------------------------------------
# ● Lunatic States Package Effects - Reverence
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#--------------------------------------------------------------------------
alias :lunatic_state_extension_reverence :lunatic_state_extension
def lunatic_state_extension(effect, state, user, state_origin, log_window)
case effect.upcase
#----------------------------------------------------------------------
# Reverence
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Affected is healed by the current skill's MP cost.
#
# Recommended notetag:
# <while effect: reverence x%>
#
#----------------------------------------------------------------------
when /REVERENCE[ ](\d+)([%%])/i
action = user.current_action.item
return unless action.is_a?(RPG::Skill)

value = (action.mp_cost * ($1.to_i / 100.0)).round.to_i
if $imported["YEA-BattleEngine"] && value > 0
Sound.play_recovery
text = sprintf(YEA::BATTLE::pOPUP_SETTINGS[:hp_heal], value.group)
user.create_popup(text, "HP_HEAL")
end

user.hp = [user.hp + value, 0].max

#----------------------------------------------------------------------
# Stop editting past this point.
#----------------------------------------------------------------------
else
so = state_origin
lw = log_window
lunatic_state_extension_reverence(effect, state, user, so, lw)
end
end

end # Game_BattlerBase
end # $imported["YEA-LunaticStates"]

#==============================================================================
#
# ▼ End of File
#
#==============================================================================



Just add: <while effect: reverence 100%> to the note section of the state in question.
A set percentage of a skill's MP cost (if it has one) will be converted into HP restoration.
 
Last edited by a moderator:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
574
Reaction score
196
First Language
English
Primarily Uses
RMMV
I needed a little practice. Try this:

#==============================================================================
#
# ▼ Yanfly Engine Ace - Lunatic States Package - Reverence Effect
#
# -- Requires: YEA - Lunatic States v1.00+
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-LSP-Reverence"] = true

#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# Install this script under YEA - Lunatic States. Then, proceed to use the
# proper effects notetags to apply the proper LSP Reverence item desired.
# Look within the script for more instructions on how to use each effect.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
# This script requires YEA - Lunatic States v1.00+ to work. It must be placed
# under YEA - Lunatic States v1.00+ in the script listing.
#
#==============================================================================

if $imported["YEA-LunaticStates"]
class Game_BattlerBase

#--------------------------------------------------------------------------
# ● Lunatic States Package Effects - Reverence
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#--------------------------------------------------------------------------
alias :lunatic_state_extension_reverence :lunatic_state_extension
def lunatic_state_extension(effect, state, user, state_origin, log_window)
case effect.upcase
#----------------------------------------------------------------------
# Reverence
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Affected is healed by the current skill's MP cost.
#
# Recommended notetag:
# <while effect: reverence x%>
#
#----------------------------------------------------------------------
when /REVERENCE[ ](\d+)([%%])/i
action = user.current_action.item
return unless action.is_a?(RPG::Skill)

value = (action.mp_cost * ($1.to_i / 100.0)).round.to_i
if $imported["YEA-BattleEngine"] && value > 0
Sound.play_recovery
text = sprintf(YEA::BATTLE::pOPUP_SETTINGS[:hp_heal], value.group)
user.create_popup(text, "HP_HEAL")
end

user.hp = [user.hp + value, 0].max

#----------------------------------------------------------------------
# Stop editting past this point.
#----------------------------------------------------------------------
else
so = state_origin
lw = log_window
lunatic_state_extension_reverence(effect, state, user, so, lw)
end
end

end # Game_BattlerBase
end # $imported["YEA-LunaticStates"]

#==============================================================================
#
# ▼ End of File
#
#==============================================================================



Just add: <while effect: reverence 100%> to the note section of the state in question.
A set percentage of a skill's MP cost (if it has one) will be converted into HP restoration.
Thanks a bunch, it works perfectly! :D
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,848
Messages
1,016,974
Members
137,562
Latest member
visploo100
Top