Personal Skill MP Cost

Discussion in 'RGSS3 Script Requests' started by IneptAttoney_08, Jun 5, 2019.

  1. IneptAttoney_08

    IneptAttoney_08 MMORPG! Veteran

    Messages:
    80
    Likes Received:
    10
    Location:
    Here!
    First Language:
    Indonesia
    Primarily Uses:
    RMVXA
    I am looking for scripts that can change the MP Cost from a skill. for example, adding a note tag:
    <mpcost: 10, 50>
    it will make the MP Cost skill with ID 10 be 50%. Is there a script like this?
     
    #1
  2. Hero_Claive

    Hero_Claive (Phoenix Ember) Veteran

    Messages:
    149
    Likes Received:
    84
    First Language:
    English
    Primarily Uses:
    RMVXA
    #2
  3. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,709
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    I don't believe this is accurate.
    While it does allow specifying many cost values, I do not see it adjusting in the way the OP wants.

    Imaging equipping an armor that has the tag <mpcost: 10, 50>
    What should happen is that the individual skill (10) would have it's cost for casting reduced to 50%. Nothing else affected.

    Yanfly's script does not have a 'MP cost rate' regex. Only a 'MP cost' regex.
    That mp cost is applied to skills in order to adjust the cost for the skill outside normal parameters not to armor or weapons.

    I quickly wrote a mp cost rate add on, but need to test it. However this does not allow specifying individual skills.

    Working
    Code:
    #==============================================================================
    # 
    # ▼ Yanfly Engine Ace - Skill Cost Manager v1.03.1     add on
    # -- Last Updated: 2019.06.06
    # -- Level: Normal, Hard, Lunatic
    # -- Requires: n/a
    # -- add on by Roninator2
    #==============================================================================
    # ▼ Updates
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # 2019.06.06 - added on mp cost
    # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    # -----------------------------------------------------------------------------
    # Actor Notetags - These notetags go in the actors notebox in the database.
    # -----------------------------------------------------------------------------
    # <mp cost rate: x%>
    # Allows the actor to drop the MP cost of skills to x%.
    # -----------------------------------------------------------------------------
    # Class Notetags - These notetags go in the class notebox in the database.
    # -----------------------------------------------------------------------------
    # <mp cost rate: x%>
    # Allows the class to drop the MP cost of skills to x%.
    # -----------------------------------------------------------------------------
    # Weapon Notetags - These notetags go in the weapons notebox in the database.
    # -----------------------------------------------------------------------------
    # <mp cost rate: x%>
    # Allows the weapon to drop the MP cost of skills to x% when worn.
    # -----------------------------------------------------------------------------
    # Armour Notetags - These notetags go in the armours notebox in the database.
    # -----------------------------------------------------------------------------
    # <mp cost rate: x%>
    # Allows the armour to drop the MP cost of skills to x% when worn.
    # -----------------------------------------------------------------------------
    # State Notetags - These notetags go in the states notebox in the database.
    # -----------------------------------------------------------------------------
    # <mp cost rate: x%>
    # Allows the state to drop the MP cost of skills to x% when afflicted.
    
    module YEA
      module REGEXP
      module BASEITEM
        MP_COST_RATE = /<(?:MP_COST_RATE|mp cost rate):[ ](\d+)([%%])>/i
      end
      end
    end
    
    class RPG::BaseItem
      #--------------------------------------------------------------------------
      # public instance variables
      #--------------------------------------------------------------------------
      attr_accessor :mp_cost_rate
      #--------------------------------------------------------------------------
      # common cache: load_notetags_scm
      #--------------------------------------------------------------------------
      alias r2_load_notetags_scm_8237fg   load_notetags_scm
      def load_notetags_scm
        r2_load_notetags_scm_8237fg
        @mp_cost_rate = 1.0
        #---
        self.note.split(/[\r\n]+/).each { |line|
          case line
          #---
          when YEA::REGEXP::BASEITEM::MP_COST_RATE
            @mp_cost_rate = $1.to_i * 0.01
          end
        }
      end
    end
    
    class Game_BattlerBase
      def mcr#;  sparam(4);  end               # MCR  Mp Cost Rate
        n = 1.0
        if actor?
          n *= self.actor.mp_cost_rate
          n *= self.class.mp_cost_rate
          for equip in equips
            next if equip.nil?
            n *= equip.mp_cost_rate
          end
        else
          n *= self.enemy.mp_cost_rate
          if $imported["YEA-Doppelganger"] && !self.class.nil?
            n *= self.class.mp_cost_rate
          end
        end
        for state in states
          next if state.nil?
          n *= state.mp_cost_rate
        end
        return n
      end
    end
     
    Last edited: Jun 6, 2019
    #3
  4. IneptAttoney_08

    IneptAttoney_08 MMORPG! Veteran

    Messages:
    80
    Likes Received:
    10
    Location:
    Here!
    First Language:
    Indonesia
    Primarily Uses:
    RMVXA
    This script is not what I need. I know, this script can change MP Cost, but he changes it as a whole skill. as the title above, Personal means Individual. then the MP Cost that will change is only at 1 skill
     
    #4
  5. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    798
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    You could try this:
     
    #5
  6. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,709
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    Thanks Sixth! Works fine for me. I thought about making it, but still not good enough to make my own scripts.
    Seems like a simple script, but I just didn't know how to go about writing it.
    The only part I did know what using $2 for the % value.

    I put this between yanfly skill cost manager and my add on.
    It all works and the functions can be combined.
    <mp cost ex: 26, 0.5>
    <mp cost rate: 50%>
    for a skill with 4mp cost results in 1mp
     
    #6
  7. IneptAttoney_08

    IneptAttoney_08 MMORPG! Veteran

    Messages:
    80
    Likes Received:
    10
    Location:
    Here!
    First Language:
    Indonesia
    Primarily Uses:
    RMVXA
    Thanks a lot Sixth!
     
    #7

Share This Page