Need help with an SP reducing skill

rpgmakerxp

Veteran
Veteran
Joined
Jun 14, 2015
Messages
85
Reaction score
15
Primarily Uses
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.
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

rpgmakerxp

Veteran
Veteran
Joined
Jun 14, 2015
Messages
85
Reaction score
15
Primarily Uses
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?
 

Wavelength

MSD Strong
Global Mod
Joined
Jul 22, 2014
Messages
5,624
Reaction score
5,104
First Language
English
Primarily Uses
RMVXA
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.
 

rpgmakerxp

Veteran
Veteran
Joined
Jun 14, 2015
Messages
85
Reaction score
15
Primarily Uses
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.  :D
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,083
Members
137,583
Latest member
write2dgray
Top