Random addition of actor parameters after "Lever up"

I want to make a random game.
When an actor lever up,His "atk" "def" "mat" "mdf" will get an increase in random numbers.
Each actor can set his own parameter range in the Notetag.
<Level: atk:+5~10, def:+5~15, mat:+10~20, mdf:+0~5>
I found this https://forums.rpgmakerweb.com/inde...1-1-1-combine-with-sockets-for-materia.48468/
The Plugin can set “Level Up Bonuses”,
Level: atk:+5, def:-5
but it‘s not random.
Is there a better plugin to support my idea?
or how can I modify it?
Your description is a bit confusing so I can't be sure with my answer, but at a guess:
No, you need a new plugin specifically written for this.

The problem is the randomness - there are different ways of fixed and chosen advancement available, but none that would create a random advancement.
And if you're requesting a new plugin in such a way, you need to give a better description for a programmer to go on, like when should what rendomness be chosen and so on.
Usually players are put off by true randomness, they usually want a guided randomness. Absolute random maps for example would include an iceberg swimming in lava or a tree growing out of the deep ocean. And just consider how dissatisfied players would be if their main tank would randomly get a bonus to magic attacks he doesn't have.
Your description is a bit confusing so I can't be sure with my answer, but at a guess:
No, you need a new plugin specifically written for this.

The problem is the randomness - there are different ways of fixed and chosen advancement available, but none that would create a random advancement.
And if you're requesting a new plugin in such a way, you need to give a better description for a programmer to go on, like when should what rendomness be chosen and so on.
Usually players are put off by true randomness, they usually want a guided randomness. Absolute random maps for example would include an iceberg swimming in lava or a tree growing out of the deep ocean.And just consider how dissatisfied players w ould be if their main tank would randomly get a bonus to magic attacks he doesn't have.
I just want to set the level up bonuses.
When an actor lever up,His "atk" "def" "mat" "mdf" will get an increase in random numbers.
Each actor can set his own parameter range in the Notetag.
<Level: atk:+5~10, def:+5~15, mat:+10~20, mdf:+0~5>
The main tank can get a higher range of def,like <def:+20~30> evey time.
Well, you can event it actually.. You can have a parallel common event running every few seconds that checks and saves the character level, if the new level is not equal to the old one, generate a random number and use the Change Parameters event command to apply that value to the parameters... You can do that for any amount of actors as needed.

As a player though, I'd probably hate such a system... I mean if I get unlucky and get mostly the lowest values then that might doom me not because of something that I did (or not do) but because of some random stuff the dev decided to do... and that is super frustrating.
Well, you can event it actually.. You can have a parallel common event running every few seconds that checks and saves the character level, if the new level is not equal to the old one, generate a random number and use the Change Parameters event command to apply that value to the parameters... You can do that for any amount of actors as needed.

As a player though, I'd probably hate such a system... I mean if I get unlucky and get mostly the lowest values then that might doom me not because of something that I did (or not do) but because of some random stuff the dev decided to do... and that is super frustrating.
I designed 100 actors to be recruited randomly, and the workload would be enormous if public events and variables were used.
Don't worry, the parameters will be set in a reasonable range, a tank won't get 0 def.
Does this work for you?
Spoiler: Full code
Code:
/*:
 * @plugindesc Lets you add random values to base parameters on level-up.
 * @author Caethyril
 *
 * @help Actor/Class notetag (case-sensitive!):
 *    <Level Up STAT: X>
 *    <Level Up STAT: X to Y>
 *     - Replace STAT with one of these:
 *         MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
 *     - Replace X with the minimum amount to add (integer)
 *     - Replace Y with the maximum amount to add (integer)
 *       -> Note: Y should be greater than X.
 *   Examples:
 *    <Level Up MHP: 40>          + 40 max HP per level
 *    <Level Up ATK: 5 to 15>     + 5~15 (inclusive) ATK per level
 *    <Level Up LUK: 0 to 8>      + 0~8 (inclusive) LUK per level
 *
 * Note that this is not designed to work with "level-downs".
 * The stat gains are permanent and are not tracked separately.
 *
 * Terms of use:
 *    Free to use and modify.
 */

(function(alias) {

'use strict';

	const TAGNAME  = 'Level Up %1';
	const PARAMS   = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
	const SPLITTER = 'to';

	Game_Actor.prototype.levelUp = function() {
		PARAMS.forEach(function(p, n) {
			[this.actor(), this.currentClass()].forEach(function(o) {
				let tag = o.meta[TAGNAME.format(p)];
				if (tag) {
					let arr = tag.split(SPLITTER).map(function(num) { return parseInt(num, 10); });
					let add = 0;
					if (!isNaN(arr[0])) add += arr[0];
					if (!isNaN(arr[1])) {
						let m = arr[1] - (isNaN(arr[0]) ? 0 : arr[0]) + 1;
						if (m > 0) add += Math.randomInt(m);
					}
					this.addParam(n, add);
				}
			}, this);
		}, this);
		alias.call(this);
	};

})(Game_Actor.prototype.levelUp);

Edit 2024-02-28: updated code written to account for level-downs, class changes, etc. Apparently it works but I haven't tested it myself:
Spoiler: edited plugin code
JavaScript:
/*:
 * @target MV
 * @plugindesc Lets you add random values to base parameters on level-up.
 * @author Caethyril
 * @url https://forums.rpgmakerweb.com/posts/985630/
 * @help Actor/Class notetag (case-sensitive!):
 *    <Level Up STAT: X>
 *    <Level Up STAT: X to Y>
 *     - Replace STAT with one of these:
 *         MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
 *     - Replace X with the minimum amount to add (integer)
 *     - Replace Y with the maximum amount to add (integer)
 *       -> Note: Y should be greater than X.
 *   Examples:
 *    <Level Up MHP: 40>          + 40 max HP per level
 *    <Level Up ATK: 5 to 15>     + 5~15 (inclusive) ATK per level
 *    <Level Up LUK: 0 to 8>      + 0~8 (inclusive) LUK per level
 *
 * Note that this is not designed to work with "level-downs".
 * The stat gains are permanent and are not tracked separately.
 *
 * [Edit: stat gains are now applied once per level per actor,
 *        for use with level-downs & class changes.]
 *
 * Terms of use:
 *    Free to use and/or modify for any project, no credit required.
 */

;void (function() {
'use strict';

  /** Name of notetag for this plugin. %1 = param name, cf {@linkcode PARAMS}. */
  const TAGNAME  = 'Level Up %1';

  /** Param names used in notetag. */
  const PARAMS   = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];

  /** Splitter for random ranges used in notetag. */
  const SPLITTER = 'to';

  /** Property name for storing highest level for which bonus params have been received. */
  const MAX_LVUP = "_maxLevelBonusGained";  // for Change Class

  const alias = Game_Actor.prototype.levelUp;
  Game_Actor.prototype.levelUp = function() {
    alias.apply(this, arguments);
    if (!this[MAX_LVUP] || this[MAX_LVUP] < this._level) {
      this[MAX_LVUP] = this._level;
      PARAMS.forEach(function(p, n) {
        for (const o of [this.actor(), this.currentClass()]) {
          const tag = o.meta[TAGNAME.format(p)];
          if (tag) {
            const arr = tag.split(SPLITTER).map(function(num) {
              return parseInt(num, 10);
            });
            let add = 0;
            if (!isNaN(arr[0]))
              add += arr[0];
            if (!isNaN(arr[1])) {
              const m = arr[1] - (isNaN(arr[0]) ? 0 : arr[0]) + 1;
              if (m > 0)
                add += Math.randomInt(m);
            }
            this.addParam(n, add);
          }
        }
      }, this);
    }
  };

})();
The attached file is still the original plugin.
Does this work for you?
Spoiler: Full code
Code:
/*:
 * @plugindesc Lets you add random values to base parameters on level-up.
 * @author Caethyril
 *
 * @help Actor/Class notetag (case-sensitive!):
 *    <Level Up STAT: X>
 *    <Level Up STAT: X to Y>
 *     - Replace STAT with one of these:
 *         MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
 *     - Replace X with the minimum amount to add (integer)
 *     - Replace Y with the maximum amount to add (integer)
 *       -> Note: Y should be greater than X.
 *   Examples:
 *    <Level Up MHP: 40>          + 40 max HP per level
 *    <Level Up ATK: 5 to 15>     + 5~15 (inclusive) ATK per level
 *    <Level Up LUK: 0 to 8>      + 0~8 (inclusive) LUK per level
 *
 * Note that this is not designed to work with "level-downs".
 * The stat gains are permanent and are not tracked separately.
 *
 * Terms of use:
 *    Free to use and modify.
 */

(function(alias) {

'use strict';

    const TAGNAME  = 'Level Up %1';
    const PARAMS   = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
    const SPLITTER = 'to';

    Game_Actor.prototype.levelUp = function() {
        PARAMS.forEach(function(p, n) {
            [this.actor(), this.currentClass()].forEach(function(o) {
                let tag = o.meta[TAGNAME.format(p)];
                if (tag) {
                    let arr = tag.split(SPLITTER).map(function(num) { return parseInt(num, 10); });
                    let add = 0;
                    if (!isNaN(arr[0])) add += arr[0];
                    if (!isNaN(arr[1])) {
                        let m = arr[1] - (isNaN(arr[0]) ? 0 : arr[0]) + 1;
                        if (m > 0) add += Math.randomInt(m);
                    }
                    this.addParam(n, add);
                }
            }, this);
        }, this);
        alias.call(this);
    };

})(Game_Actor.prototype.levelUp);
Nice! That's exactly what I want.
Great! I've only done a few basic tests, so just post back here if you run into problems with it~ 🙏
Does this work for you?
Spoiler: Full code
Code:
/*:
 * @plugindesc Lets you add random values to base parameters on level-up.
 * @author Caethyril
 *
 * @help Actor/Class notetag (case-sensitive!):
 *    <Level Up STAT: X>
 *    <Level Up STAT: X to Y>
 *     - Replace STAT with one of these:
 *         MHP, MMP, ATK, DEF, MAT, MDF, AGI, LUK
 *     - Replace X with the minimum amount to add (integer)
 *     - Replace Y with the maximum amount to add (integer)
 *       -> Note: Y should be greater than X.
 *   Examples:
 *    <Level Up MHP: 40>          + 40 max HP per level
 *    <Level Up ATK: 5 to 15>     + 5~15 (inclusive) ATK per level
 *    <Level Up LUK: 0 to 8>      + 0~8 (inclusive) LUK per level
 *
 * Note that this is not designed to work with "level-downs".
 * The stat gains are permanent and are not tracked separately.
 *
 * Terms of use:
 *    Free to use and modify.
 */

(function(alias) {

'use strict';

    const TAGNAME  = 'Level Up %1';
    const PARAMS   = ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'];
    const SPLITTER = 'to';

    Game_Actor.prototype.levelUp = function() {
        PARAMS.forEach(function(p, n) {
            [this.actor(), this.currentClass()].forEach(function(o) {
                let tag = o.meta[TAGNAME.format(p)];
                if (tag) {
                    let arr = tag.split(SPLITTER).map(function(num) { return parseInt(num, 10); });
                    let add = 0;
                    if (!isNaN(arr[0])) add += arr[0];
                    if (!isNaN(arr[1])) {
                        let m = arr[1] - (isNaN(arr[0]) ? 0 : arr[0]) + 1;
                        if (m > 0) add += Math.randomInt(m);
                    }
                    this.addParam(n, add);
                }
            }, this);
        }, this);
        alias.call(this);
    };

})(Game_Actor.prototype.levelUp);


You are a Genius! Thank you so much for this, can it be used commercially? Your name would be added to the credits and splash screen of my games (If I can manage to run a video animation on start up properly, but thats another matter entirely... ^_^")

Erodaisiki, I was having this same problem and I managed to solve it using a bunch of common events and parallel events on the map, which slowed down my game badly and ate at the RAM, so thank you for asking this question because this plugin simplifies so much, and lets the game run smoother with less events.
@JesterRu yes, it's free for whatever you like, commercial or non-commercial, modified or otherwise. It's just a snippet really, but happy to help~ 🙏

Edit 2024-02-28:

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/random-addition-of-actor-parameters-after-lever-up.111091/