Random addition of actor parameters after "Lever up"

Discussion in 'JS Plugin Requests' started by Erodaisiki, Jul 15, 2019.

  1. Erodaisiki

    Erodaisiki Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    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?
     
    Last edited: Jul 15, 2019
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,121
    Likes Received:
    6,369
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    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.
     
    #2
    Engr. Adiktuzmiko likes this.
  3. Erodaisiki

    Erodaisiki Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #3
  4. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,456
    Likes Received:
    2,844
    Location:
    Philippines
    First Language:
    Tagalog
    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.
     
    #4
  5. Erodaisiki

    Erodaisiki Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    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.
     
    #5
  6. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,026
    Likes Received:
    637
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Does this work for you?
    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);
     

    Attached Files:

    #6
    JesterRu, Wavelength and Erodaisiki like this.
  7. Erodaisiki

    Erodaisiki Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Nice! That's exactly what I want.
     
    #7
    caethyril likes this.
  8. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,026
    Likes Received:
    637
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    Great! I've only done a few basic tests, so just post back here if you run into problems with it~ :kaothx:
     
    #8
  9. JesterRu

    JesterRu Warper Member

    Messages:
    1
    Likes Received:
    1
    First Language:
    English/Spanish
    Primarily Uses:
    RMMV

    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.
     
    #9
    Erodaisiki likes this.
  10. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,026
    Likes Received:
    637
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    @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~ :kaothx:
     
    #10

Share This Page