MP Damage Effect

MP Damage Effect // When the player takes MP damage, a visual and audio effect happens (like with HP Damage).

Customization:
  • Change the SE for the damage effect.
  • For advanced scripters, you can implement your own script calls in perform_mpdamage_effect.
Setup:
  • Paste under the Materials slot, above main.
Known issues:
  • None.
Usage Notes:

Code:
#==============================================================================
#
# ** Title: MP Damage SE 1.0
#    Author: ZirconStorms
#    Created: April 2019 (Forum request)
#
#------------------------------------------------------------------------------
#
# Script is allowed for commercial and non-commercial games.
# In the game's credits or read.me, credit "ZirconStorms".
#
#==============================================================================
# Customizable Section Begins Here.
#==============================================================================

module GhostMPDamage
  MPDAMAGESOUND = RPG::SE.new("Blind", 80, 100)
  #Put SE audio file name in between quotes.
  #First number value is volume.
  #Second number value is pitch. [Default: 100]
 
  #You can adjust the commands in perform_mpdamage_effect if you want different
  #screen effects or processes to run while the player gets MP Damage.
end

#==============================================================================
# Customizable Section Ends Here
#==============================================================================
class Game_Actor < Game_Battler
  def perform_mpdamage_effect
    $game_troop.screen.start_shake(5, 5, 10)
    @sprite_effect_type = :blink
    GhostMPDamage::MPDAMAGESOUND.play
  end
end
class Window_BattleLog < Window_Selectable
  alias ghost_display_mp_damage display_mp_damage
    def display_mp_damage(target, item)
    return if target.dead? || target.result.mp_damage == 0
    if target.result.mp_damage > 0 && target.result.mp_drain == 0
      target.perform_mpdamage_effect
    end
    Sound.play_recovery if target.result.mp_damage < 0
    add_text(target.result.mp_damage_text)
    wait
  end
end
#===============================================================================
# End of Script
#===============================================================================
It might be helpful to add in your opening post whether you allow reposting the script elsewhere or if people must always link back to here.
It might be helpful to add in your opening post whether you allow reposting the script elsewhere or if people must always link back to here.
Added reposting rules to the usage notes - thanks for the heads-up.

Original thread: https://forums.rpgmakerweb.com/threads/mp-damage-effect.107720/