RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[VXA][Request] Level Up Bonus Param Growth

0 Members and 1 Guest are viewing this topic.

**
Rep: +0/-0Level 89
So I'm working with Yanfly's Victory Aftermath script, but I'm requesting a script where, when someone levels up, they can get a bonus parameter growth.

So the way I would like this, is after someone levels up, a new window appears with 3 icons. One represents physical, one represents HP/MP, and the other represents magical. The player can choose either one of these stats. The physical would raise Atk and Def, the HP/MP would raise max HP and max MP of course, and magical would raise MAtk and MDef.
I would like it so that I could choose how much bonus growth each character gets with custom notetags. If notetags are too complicated, that's fine, I can just edit it in the script itself.
I've tried it myself, and it was complicated to me (I am a newbie to Ruby)

I've a found a parameter bonus growth by Yanfly. Now, I wish to take it a step further and allow the player to choose which set of parameters to grow, and allow me to customize how much each level, each of them grow.

Thanks

**
Rep: +0/-0Level 82
A script of a french guy named Mack:
Code: [Select]
#Système de points de caractèristique au level up.
#De Mack, Avril 2012

# <gain_caract> [2,2,2,2,2,2,2,2]
# <cost_caract> [2,2,2,2,2,2,2,2]

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
#  This class performs the menu screen processing.
#==============================================================================
$pts = 4

class Scene_Level_Up < Scene_MenuBase
  def msg
        s = ["Augmente les HP Max de #{@actor.gain_caract(0)}
Coute : #{@actor.cost_caract(0)}",
        "Augmente les MP Max de #{@actor.gain_caract(1)}
Coute : #{@actor.cost_caract(1)}",
        "Augmente la Force de #{@actor.gain_caract(2)}
Coute : #{@actor.cost_caract(2)}",
        "Augmente la Defense de #{@actor.gain_caract(3)}
Coute : #{@actor.cost_caract(3)}",
        "Augmente la Magie de #{@actor.gain_caract(4)}
Coute : #{@actor.cost_caract(4)}",
        "Augmente la Défense Magique de #{@actor.gain_caract(5)}
Coute : #{@actor.cost_caract(5)}",
        "Augmente l'Agilité de #{@actor.gain_caract(6)}
Coute : #{@actor.cost_caract(6)}",
        "Augmente la Chance de #{@actor.gain_caract(7)}
Coute : #{@actor.cost_caract(7)}"]
        return s
  end
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
        super
        @actor = $game_temp.actor_level_up[0]
        create_help_window
        create_command_window
        @help_window.set_text(msg[@command_window.index])
        create_status_window
        $game_temp.actor_level_up.delete_at(0)
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_command_window
        @command_window = Window_Level_upCommand.new
        @command_window.set_handler(:gain_param,          method(:command_gain_param))
        @command_window.set_handler(:retour,    method(:command_return))
        @command_window.y = @help_window.height
  end
  def command_return
        if @actor.level_up_pts > 0
          @help_window.set_text("Il vous reste des points à distribuer.")
          wait(30)
          @command_window.activate
        else
          return_scene
        end
  end
  def create_status_window
        @status_window = Window_Status_Level_up.new(@actor)
        @status_window.x = @command_window.width
        @status_window.y = @help_window.height
  end
  def command_gain_param
        index = @command_window.index
        @command_window.refresh
        if @actor.level_up_pts >= @actor.cost_caract(index)
          @actor.gain_lvl_pts(-@actor.cost_caract(index))
          @actor.add_param(index,@actor.gain_caract(index))
          @help_window.set_text("Caractéristique augmentée !")
        else
          @help_window.set_text("Vous n'avez pas assez de points.")
        end
        @status_window.refresh
        @command_window.refresh
        wait(30)
        @command_window.activate
  end
  def wait(time)
        t = 0
        loop do
          Graphics.update
          if t == time
                break
          end
          t += 1
        end
  end
  def update
        super
        @help_window.set_text(msg[@command_window.index])
  end
  def on_actor_change
        @status_window.actor = @actor
        @status_window.refresh
        @command_window.activate
  end
end
class Scene_Map < Scene_Base
  alias old_update update
  def update
        old_update
        if $game_temp.actor_level_up[0]
          SceneManager.call(Scene_Level_Up)
        end
  end
end
class Game_Actor < Game_Battler
  attr_reader :level_up_pts
  alias old_initialize initialize
  def initialize(actor_id)
        old_initialize(actor_id)
        @level_up_pts = 0
  end
  def gain_caract(param)
        tbl = [1,1,1,1,1,1,1,1]
        note = $data_classes[@class_id].note
        note.each_line do |line|
          if line.include?("<gain_caract>")
                line2 = line.gsub!("<gain_caract> ","")
                tbl = eval(line2)
          end
        end
        return tbl[param]
  end
  def cost_caract(param)
        tbl = [1,1,1,1,1,1,1,1]
        note = $data_classes[@class_id].note
        note.each_line do |line|
          if line.include?("<cost_caract>")
                line2 = line.gsub!("<cost_caract> ","")
                tbl = eval(line2)
          end
        end
        return tbl[param]
  end
  def gain_lvl_pts(value)
        @level_up_pts += value
        if @level_up_pts < 0
          @level_up_pts = 0
        end
  end
  def param_base(param_id)
        return self.class.params[param_id, 1]
  end
  def level_up
        @level += 1
        $game_temp.actor_level_up.push(self) unless $game_temp.actor_level_up.include?(self)
        self.class.learnings.each do |learning|
          learn_skill(learning.skill_id) if learning.level == @level
        end
        gain_lvl_pts($pts)
  end
end

class Game_Temp
  attr_accessor :actor_level_up
  alias old_initialize initialize
  def initialize
        old_initialize
        @actor_level_up = []
  end
end


#==============================================================================
# ** Window_MenuCommand
#------------------------------------------------------------------------------
#  This command window appears on the menu screen.
#==============================================================================

class Window_Level_upCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
        @actor = $game_temp.actor_level_up[0]
        super(0, 0)
        @@last_command_symbol = nil
        select_last
  end
  #--------------------------------------------------------------------------
  # * Get Window Width
  #--------------------------------------------------------------------------
  def window_width
        return 160
  end
  #--------------------------------------------------------------------------
  # * Get Number of Lines to Show
  #--------------------------------------------------------------------------
  def visible_line_number
        item_max
  end
  #--------------------------------------------------------------------------
  # * Create Command List
  #--------------------------------------------------------------------------
  def make_command_list
        add_main_commands
  end
  #--------------------------------------------------------------------------
  # * Add Main Commands to List
  #--------------------------------------------------------------------------
  def add_main_commands
        add_command(Vocab::param(0),  :gain_param,  true)
        add_command(Vocab::param(1),  :gain_param,  true)
        add_command(Vocab::param(2),  :gain_param,  true)
        add_command(Vocab::param(3),  :gain_param,  true)
        add_command(Vocab::param(4),  :gain_param,  true)
        add_command(Vocab::param(5),  :gain_param,  true)
        add_command(Vocab::param(6),  :gain_param,  true)
        add_command(Vocab::param(7),  :gain_param,  true)
        add_command("Suivant"      ,  :retour   ,  @actor.level_up_pts <= 0)
  end
  #--------------------------------------------------------------------------
  # * Processing When OK Button Is Pressed
  #--------------------------------------------------------------------------
  def process_ok
        @@last_command_symbol = current_symbol
        super
  end
  def select_last
        select_symbol(@@last_command_symbol)
  end
end

#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
#  This window displays full status specs on the status screen.
#==============================================================================

class Window_Status_Level_up < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(actor)
        super(0, 0, 384, 344)
        @actor = actor
        refresh
        activate
  end
  #--------------------------------------------------------------------------
  # * Set Actor
  #--------------------------------------------------------------------------
  def actor=(actor)
        return if @actor == actor
        @actor = actor
        refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
        contents.clear
        draw_block1(line_height * 1)
        draw_block2(line_height * 1)
        draw_block3(line_height * 3)
        draw_actor_name(@actor, 4, line_height * 0 )
  end
  def draw_block1(y)
        draw_actor_face(@actor, 192+32, y)
        #draw_actor_class(@actor, 128, y)
        #draw_actor_nickname(@actor, 288, y)
  end
  #--------------------------------------------------------------------------
  # * Draw Block 2
  #--------------------------------------------------------------------------
  def draw_block2(y)
        draw_basic_info(32, y)
        draw_exp_info(4, y+line_height * 8)
  end

  #--------------------------------------------------------------------------
  # * Draw Block 3
  #--------------------------------------------------------------------------
  def draw_block3(y)
        draw_parameters(32, y)
  end
  #--------------------------------------------------------------------------
  # * Draw Horizontal Line
  #--------------------------------------------------------------------------
  def draw_horz_line(y)
        line_y = y + line_height / 2 - 1
        contents.fill_rect(0, line_y, contents_width, 2, line_color)
  end
  #--------------------------------------------------------------------------
  # * Get Color of Horizontal Line
  #--------------------------------------------------------------------------
  def line_color
        color = normal_color
        color.alpha = 48
        color
  end
  #--------------------------------------------------------------------------
  # * Draw Experience Information
  #--------------------------------------------------------------------------
  def draw_exp_info(x, y)
        s1 = @actor.max_level? ? "-------" : @actor.exp
        s2 = @actor.max_level? ? "-------" : @actor.next_level_exp - @actor.exp
        s_next = sprintf(Vocab::ExpNext, Vocab::level)
        change_color(system_color)
        draw_text(x, y + line_height * 0, 180, line_height, Vocab::ExpTotal)
        draw_text(x, y + line_height * 2, 180, line_height, s_next)
        change_color(normal_color)
        draw_text(x, y + line_height * 1, 180, line_height, s1, 2)
        draw_text(x, y + line_height * 3, 180, line_height, s2, 2)
  end
  #--------------------------------------------------------------------------
  # * Draw Parameters
  #--------------------------------------------------------------------------
  def draw_parameters(x, y)
        6.times {|i| draw_actor_param(@actor, x, y + line_height * i, i + 2) }
  end
  #--------------------------------------------------------------------------
  # * Draw Basic Information
  #--------------------------------------------------------------------------
  def draw_basic_info(x, y)
        draw_actor_level(@actor, x+200, y + line_height * 5)
        draw_level_up_pts(x+200, y + line_height * 7)
        #draw_actor_icons(@actor, x, y + line_height * 1)
        draw_actor_hp(@actor, x, y + line_height * 0)
        draw_actor_mp(@actor, x, y + line_height * 1)
  end
  def draw_level_up_pts(x,y)
        draw_text(x,y,200,24,"Points : " + @actor.level_up_pts.to_s)
  end
end