Need help with an SP reducing skill

Hello, so I was wanting to make a skill (for enemies only) where they damage the SP of all of their enemies.

I was wanting it to be based on %.  For example, it reduces everyone's SP by 15%.

I've been trying to find some way to do this, but I only get results that are about skills healing SP not reducing it.

Would this even be a skill or a common event, etc.?  I'm not sure how to make this work.
Ok, go into Game_Battler 3 in the Script Editor.  Somewhere before damage is applied ("subtract damage from HP") but after damage is calculated, add the following:

if (skill.id == 128) self.sp -= self.damage self.damage = 0 endObviously, replace 128 with the ID of the skill.

If you want the skill to deal a fixed amount of SP damage instead of dealing an amount based on the damage the skill would have otherwise done, use something like the following instead:

if (skill.id == 128) self.sp -= (self.maxsp * 15 / 100) self.damage = 0 endSomething I like to do to make sure the player doesn't get confused into thinking their skill failed and did zero damage is to add the following shortly after damage is applied:

if (skill.id == 128)        self.damage = "MP Damage"      endThis will make the damage string read "MP Damage" on any character that was hit by the spell.
Ok, go into Game_Battler 3 in the Script Editor.  Somewhere before damage is applied ("subtract damage from HP") but after damage is calculated, add the following:

if (skill.id == 128) self.sp -= self.damage self.damage = 0 endObviously, replace 128 with the ID of the skill.

If you want the skill to deal a fixed amount of SP damage instead of dealing an amount based on the damage the skill would have otherwise done, use something like the following instead:

if (skill.id == 128) self.sp -= (self.maxsp * 15 / 100) self.damage = 0 endSomething I like to do to make sure the player doesn't get confused into thinking their skill failed and did zero damage is to add the following shortly after damage is applied:

if (skill.id == 128)        self.damage = "MP Damage"      endThis will make the damage string read "MP Damage" on any character that was hit by the spell.
Hey half of this worked.  In fact I was having problems trying to put it, but it's because I was putting a zero before the number 94(the skill's number).

The issue I'm having is the 2nd half.  It always says "miss".  I tried what you put, but it's probably the wrong place to put it.  Here is what it looks like.

 # If HP recovery rate and recovery amount are 0

      if item.recover_hp_rate == 0 and item.recover_hp == 0

        # Set damage to empty string

        self.damage = ""

        # If SP recovery rate / recovery amount are 0, and parameter increase

        # value is ineffective.

        if item.recover_sp_rate == 0 and item.recover_sp == 0 and

           (item.parameter_type == 0 or item.parameter_points == 0)

          # If state is unchanged

          unless @state_changed

            # Set damage to "Miss"

            self.damage = "Miss"

          end

        end

      end

    # If miss occurs

    else

      # Set damage to "Miss"

      self.damage = "Miss"

    end

    # If not in battle

    unless $game_temp.in_battle

      # Set damage to nil

      self.damage = nil

    end

    # Damage string

    if (skill.id == 94)

        self.damage = "Psynergy Damage"

      end

    # End Method

    return effective

  end

 

It's most likely the wrong place, but I'm not sure where the "shortly after damage is applied" section is. Also isn't there a way to make the numbers change color instead of having words appear all of the time?
Make sure it's above the lines that say "# If miss occurs"/"else".

There are definitely ways to change the font color (Ruby after all is a language designed to manipulate text), but I haven't worked with that set of commands in RGSS1.
Make sure it's above the lines that say "# If miss occurs"/"else".

There are definitely ways to change the font color (Ruby after all is a language designed to manipulate text), but I haven't worked with that set of commands in RGSS1.
Thank you, it worked.  😀

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-an-sp-reducing-skill.41141/