Help to use DEF stat but not possible use def for coding.

Hello any to help me to use stats bonus to level up
for example the code use.
But error to use def.
It is possible the use stats def for other fonction.

Thanx so much to help me.


Ruby:
def display_level_up(new_skills, last_params)
    $game_message.new_page
    $game_message.add(sprintf(Vocab::LevelUp, [USER=83971]@Name[/USER], Vocab::level, @level))
    param_list = [0, 1, 2, 3, 5, 4, 6, 7]
        last_param_list = last_params
    param_list.each do |param_id|
      plus = 0
      # HP PP ランダム上昇
      if param_id == 0
        delta = mhp - last_param_list[param_id]
        # バイタリティが上がらなかった時のみランダム上昇
        if param_base(0) - last_param_list[0] == 0
          plus = 5 + rand(25)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @mhp_rate].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
      elsif param_id == 1
        delta = mmp - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(1) - last_param_list[1] == 0 && @mmp_rate != 0
          plus = 5 + rand(25)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @mmp_rate].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
      elsif param_id == 2
        delta = atk - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(2) - last_param_list[2] == 0 && @atk != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @atk].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
        elsif param_id == 3
        delta = def - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(3) - last_param_list[3] == 0 && @def != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @def].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
          end
      elsif param_id == 4
        delta = Mat- last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(4) - last_param_list[4] == 0 && [USER=50041]@Mat[/USER] != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @Mat.min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
        elsif param_id == 5
        delta = mdf - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(5) - last_param_list[5] == 0 && mdf != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], [USER=151458]@mdf[/USER]].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
      elsif param_id == 6
        delta = agi - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(6) - last_param_list[6] == 0 && @agi != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], @agi].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
      elsif param_id == 7
        delta = luk - last_param_list[param_id]
        # 成長率が0でなく、IQが上がらなかった時のみランダム上昇
        if param_base(7) - last_param_list[7] == 0 && [USER=45258]@LuK[/USER] != 0
          plus = 1 + rand(5)
          @param_plus[param_id] += plus
          @param_plus[param_id] = [@param_plus[param_id], [USER=45258]@LuK[/USER]].min
        # 上がったらランダム上昇分リセット
        else
          plus = -@param_plus[param_id]
          @param_plus[param_id] = 0
        end
      else
        delta = param_base(param_id) - last_param_list[param_id]
      end
      refresh
      delta += plus
      next if delta == 0
      case
what kind of uses do you want?

by default, DEF (and most other parameters as well) has absolutely no hardcoded use at all.
it is only there to be called by damage formulae or by control variable.

(AGI and LUCK are the only main parameters that are checked anywhere in the engine itself)

So if you want to have any use for DEF outside the damage formulae, you would have to create that use from scratch.


And please state for which engine you want this - your profile says you are primarily using MV and you posted about Ruby (which has absolutely nothing to do with MV, you can't use any RGSS code in MV).
Any Ruby code in MV will automatically error out and never work.
I finally found it, you had to put self.def instead of def, and it worked perfectly. ^^''
Thanx for last message.


I am create me new project for VX ace, for earthbound level.up systems et battle is work too.
But i am French to create me game, to possible the version for english too.
The probleme is solved ^^'
Looked please.
systemsearthbound.JPG
Code:
[USER=83971]@Name[/USER]
this is wrong.
where was this taken from?

Original thread: https://forums.rpgmakerweb.com/threads/help-to-use-def-stat-but-not-possible-use-def-for-coding.144799/