Modding Tomy's Parameter Distribution Script

This script creates a menu that allows you to level up primary and secondary parameters with "RP".

But the script only allows you to get RP when actors level up. 

I would like to make it so enemies give the player RP. Perhaps I could set the values per enemy with note tags?

edit: Link to the script as requested. Sorry! http://ytomy.sakura.ne.jp/
Please link to the site where you got the script from, do not repost scripts here


And remove the script when you post the link - that rule has a lot of reasons from making sure to always have the latest version to obeying scripter wishes (most don't want their scripts reposted) and more.
Are you sure you want to go with this "free RP" approach?

By default, the total amount of RP is linked to your current levels. This will ensure that you cannot upgrade your stats infinitely.

At level 99, you will basically has limited amount of RP to spare to raise your stats. It's similar to Ragnarok Online.

Going with "free RP gain" approach will destroy the game balance.

But, if you still prefer this method. Just use this snippet. Put this below the Parameter Distribution Script.

Spoiler
# Free RP Patch Script by Moogle_X
# Require: Distribute Parameter - KMS_DistributeParameter
#
#==============================================================================
# Notetag:
# <rp gain: n>
#
# Put the notetag in enemy section. This is the custom rp gain for enemy.
# Change n to integer number. Example:
# <rp gain: 500>
#
#==============================================================================
# SCRIPT CONFIGURATION START
#==============================================================================
module Moogle_X
  module Free_RP
    
    DEFAULT_RP_GAIN = 100   # <= This is the default RP gain per enemy kill.
    SHOW_VICTORY_MESSAGE = true
    VICTORY_MESSAGE   = "%s has earned %s %s!"
    
  end # Free_RP
end # Moogle_X
 
 
#==============================================================================
# SCRIPT CONFIGURATION END
#==============================================================================

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
 
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_free_rp load_database; end
  def self.load_database
    load_database_free_rp
    load_notetags_free_rp
  end
 
  #--------------------------------------------------------------------------
  # new method: load_notetags_free_rp
  #--------------------------------------------------------------------------
  def self.load_notetags_free_rp
    groups = [$data_enemies]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_free_rp
      end
    end
  end
 
end # DataManager

#==============================================================================
# ■ RPG::Enemy
#==============================================================================

class RPG::Enemy < RPG::BaseItem
 
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :rp_drop
 
  #--------------------------------------------------------------------------
  # common cache: load_notetags_free_rp
  #--------------------------------------------------------------------------
  def load_notetags_free_rp
    @rp_drop = Moogle_X::Free_RP:😀EFAULT_RP_GAIN
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when /^<rp gain: (.*)>/i
        @rp_drop = $1.to_i
      #---
      end
    } # self.note.split
    #---
  end
 
end # RPG::Enemy

#==============================================================================
# ■ Game_Enemy
#==============================================================================

class Game_Enemy < Game_Battler
 
  #--------------------------------------------------------------------------
  # new method: rp
  #--------------------------------------------------------------------------
  def rp
    return enemy.rp_drop
  end
 
end # Game_Enemy

#==============================================================================
# ■ Game_Troop
#==============================================================================

class Game_Troop < Game_Unit
 
  #--------------------------------------------------------------------------
  # new method: rp_total
  #--------------------------------------------------------------------------
  def rp_total
    dead_members.inject(0) {|r, enemy| r += enemy.rp }
  end
 
end # Game_Troop

#==============================================================================
# ■ BattleManager
#==============================================================================

module BattleManager
 
  #--------------------------------------------------------------------------
  # alias method: display_exp
  #--------------------------------------------------------------------------
  class <<self; alias battlemanager_display_rp display_exp; end
  def self.display_exp
    battlemanager_display_rp
    gain_rp_post_battle
  end
 
  #--------------------------------------------------------------------------
  # new method: gain_rp_post_battle
  #--------------------------------------------------------------------------
  def self.gain_rp_post_battle
    amount = $game_troop.rp_total
    for member in $game_party.members
      member.gain_rp(amount)
    end
    if Moogle_X::Free_RP::SHOW_VICTORY_MESSAGE
      fmt = Moogle_X::Free_RP::VICTORY_MESSAGE
      for member in $game_party.members
        value = amount
        $game_message.add('\.' + sprintf(fmt, member.name, value,
        KMS_DistributeParameter::VOCAB_RP))
      end
      wait_for_message
    end
  end # gain_rp_post_battle
 
end # BattleManager
Thank you so much!
Actually...that doesn't seem to be working. I wonder if I did something wrong. Neither the default RP gain nor the notetags cause any RP to be gained after battle.

ee: Nevermind. It's totally working. I'm just dumb.
It wont destroy the game balance because of the escalating costs + the hard cap on the number of upgrades the player can perform. It'll be alright. 😀
Heathurr, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you have something to add and the last post is your own, simply edit that.

Original thread: https://forums.rpgmakerweb.com/threads/modding-tomys-parameter-distribution-script.44106/