[RMVX ACE] CAN'T FIX A SCRIPT...

Posts

Pages: 1
I make a game with a script which randomly increases actors' parameters.
I like the script but it has a problem which is that it doesn't tell me how the parameters are changed.
So all I need is simple messages like MAXHP has increased by 50 points! or ATK has increased by 8 points!
I've tried to fix the script but I still can't solve the problem...
Does anyone know how to fix the script?

http://hikimoki.sakura.ne.jp/rgss3/script_neta/tmrandgrow.rb
Marrend
Guardian of the Description Thread
21806
I'm... not 100% sure this script does what it's supposed to do. I mean, as far as that script is concerned...

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Show Level Up Message
  #     new_skills : Array of newly learned skills
  #--------------------------------------------------------------------------
  def display_level_up(new_skills)
    $game_message.new_page
    $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
    new_skills.each do |skill|
      $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
    end
    
    # Displays stat increases.
    $game_message.new_page
    i = 0
    while i < 8
      #stat = self.class.params[i, @level] - self.class.params[i, @level-1]
      stat = param_plus(i)
      $game_message.add(Vocab.param(i).to_s + " has increased by " + stat.to_s + " points!")
      i += 1
    end
  end
end

...that might display the changes that the script would apply. Except that, as far as I can tell, the method that actually reflects what is happening would look more like this.
Thank you for making the good snippet.
I noticed that many of the parameters usually don't increase like

ATK has increased by 0 points!
DEF has increased by 5 points!
MAT has increased by 0 points!
MDF has increased by 0 points!
AGI has increased by 0 points!
LUK has increased by 0 points!

Is it possible to not show unnecessary lines?
Marrend
Guardian of the Description Thread
21806
Definitely! It would look more like...

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Show Level Up Message
  #     new_skills : Array of newly learned skills
  #--------------------------------------------------------------------------
  def display_level_up(new_skills)
    $game_message.new_page
    $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
    new_skills.each do |skill|
      $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
    end
    
    # Displays stat increases.
    $game_message.new_page
    i = 0
    while i < 8
      #stat = self.class.params[i, @level] - self.class.params[i, @level-1]
      stat = param_plus(i)
      if stat > 0
        $game_message.add(Vocab.param(i).to_s + " has increased by " + stat.to_s + " points!")
      end
      i += 1
    end
    TMRANDGROW.total = nil
  end
end

...this.

*Edit: Oh, right. I can see how equipment might also add to the param_plus value. I wonder if there isn't some kind of "running total" that can be performed via the TMRANDGROW module to keep track of the value added by it, and it alone. Gimme a bit.

*Edit2: Darigaaz, this...

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # * Show Level Up Message
  #     new_skills : Array of newly learned skills
  #--------------------------------------------------------------------------
  def display_level_up(new_skills)
    $game_message.new_page
    $game_message.add(sprintf(Vocab::LevelUp, @name, Vocab::level, @level))
    new_skills.each do |skill|
      $game_message.add(sprintf(Vocab::ObtainSkill, skill.name))
    end
    
    # Displays stat increases.
    $game_message.new_page
    i = 0
    while i < 8
      #stat = self.class.params[i, @level] - self.class.params[i, @level-1]
      stat = TMRANDGROW.total(i)
      if stat != nil #or stat > 0
        $game_message.add(Vocab.param(i).to_s + " has increased by " + stat.to_s + " points!")
      end
      i += 1
    end
  end
end

#==============================================================================
# ★ RGSS3_ランダム成長 Ver1.0
#==============================================================================
=begin

作者:tomoaky
webサイト:ひきも記は閉鎖しました。 ([url]http://hikimoki.sakura.ne.jp/)[/url]

アクターがレベルアップする際に、ランダムで能力値が成長します。

2013.06.25  Ver1.0
  公開

=end

#==============================================================================
# □ 設定項目
#==============================================================================
module TMRANDGROW
  # 能力値ごとの基本成長値を以下の順番で設定
  # HP, MP, 攻撃, 防御, 魔法, 魔法防御, 敏捷, 運
  GROW_VALUE = [5, 5, 1, 1, 1, 1, 1, 1]
  
  # 能力値ごとの追加成長値を設定(数値の順番は GROW_VALUE と同じ)
  BONUS_VALUE = [2, 2, 1, 1, 1, 1, 1, 1]
  
  # 追加成長発生確率の設定(値は%)
  BONUS_RATE = 30
  
  # 追加成長判定を行う回数
  BONUS_TIME = 2
  
  attr_accessor :total
  
  def self.total(param_id)
    return @total[param_id]
  end

  def self.total=(val)
    @total = val
  end
  
  def self.add(param_id, val)
    if @total.instance_of?(Array) == true
      @total[param_id] = val
    else
      @total = []
      @total[param_id] = val
    end
  end
end

#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor
  #--------------------------------------------------------------------------
  # ● レベルアップ
  #--------------------------------------------------------------------------
  alias tmrandgrow_game_actor_level_up level_up
  def level_up
    tmrandgrow_game_actor_level_up
    param_id = rand(8)
    add_param(param_id, TMRANDGROW::GROW_VALUE[param_id])
    TMRANDGROW.add(param_id, TMRANDGROW::GROW_VALUE[param_id])
    TMRANDGROW::BONUS_TIME.times do |i|
      if rand(100) < TMRANDGROW::BONUS_RATE
        add_param(param_id, TMRANDGROW::BONUS_VALUE[param_id])
        sum = TMRANDGROW.total(param_id) + TMRANDGROW::BONUS_VALUE[param_id]
        TMRANDGROW.add(param_id, sum)
      end
    end
  end
end

...is terrible. I mean, I'm pretty sure this displays the intended information, but, the actual stat increases still seem to go by the curves in the Class section of the database?

And level up SE doesn't work with your snippet.
Do you know why?
Marrend
Guardian of the Description Thread
21806
I'm not aware of a sound effect that plays on level-up. If you have a script that includes such functionality, I would recommend referring to that.
author=Marrend
...is terrible. I mean, I'm pretty sure this displays the intended information, but, the actual stat increases still seem to go by the curves in the Class section of the database?


As you mentioned,the script doesn't work well...
But it's OK.
I really couldn't do anything without you.
I appreciate your kindness.
Please let me know if you can make a better one in the future.
Thank you.
Marrend
Guardian of the Description Thread
21806
I noticed a funny thing when I tested this system with a class that did not have any stat growth associated with it whatsoever: the stat bonuses from this script do, in fact, work as intended.

If you're okay with that, fine. The recommendation becomes to have your classes have no stat-growth outside of this system. Otherwise, if you want both this stat-growth, and regular stat-growth, I would have to refer you to this post.
I use many other scripts and seem to have a compatibility issue this time...
Some people say that Yanfly's Victory Aftermath works well with Dekita's Random Parameter Gain but they don't work with my project.
I think your script works well with many other random growth scripts.
But I have to solve the compatibility problem first...
Pages: 1