Slightly Randomize Amount of XP Gained For Each Character (SOLVED)

● ARCHIVED · READ-ONLY
Started by Tonedawg181 31 posts Page 2 of 2 View original ↗
  1. I think i did it but i have no idea of how am i gonna test it

    Game_Actor.prototype.gainExp = function(exp) {
    var newExp = this.currentExp() + Math.round(exp - Math.round(this.level / 5) * Math.round(Math.randonInt(12)))
    + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
    };
  2. sorry i went afk for a little bit my friend needed help. Your latest formula came back with
    TypeErorr undefined is not a function
    and the previous one to that came back as RefrenceError Game_Temp is not defined.

    Someone in the yanfly discord suggested this plugin: http://himeworks.com/2016/02/battle-action-exp/
    with this code in the plugin parameters.
    b.isEnemy() && b.isDead() ? $gameParty.members().forEach(function(mem) {var gains = b.exp() * 0.01 * (90+Math.random(21));mem.gainXp(gains);}) : 0

    I'm going to give this a shot real quick and i'll let you guys know of the results.
    Also I really do appreciate the effort though your awesome for fiddling around with this with me <3
  3. It's k but i'm not sure if this formula is gonna help you the way it's writen as well.



    Game_Actor.prototype.gainExp = function(exp) {
    var newExp = this.currentExp() - Math.round(Math.round(this.level / 5) * Math.round(Math.randonInt(12)) + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
    };
  4. Here's an option, as an example, for an +8%/-8% variance across all enemies where the variance applies before the "experience rate" sp-parameter:
    An option
    Code:
    Game_Actor.prototype.gainExp = function(exp) {
        var variancePercent = 0.08;   // 8% variance
        var varianceCap = exp * variancePercent;  // exp from enemy multiplied by percent
        var varianceAmount = (Math.random() * varianceCap * 2) - varianceCap;  // calculates for + or - amount
        var newExp = this.currentExp() + Math.round((exp + varianceAmount) * this.finalExpRate());
        this.changeExp(newExp, this.shouldDisplayLevelUp());
    };
  5. Aloe Guvner said:
    Here's an option, as an example, for an +8%/-8% variance across all enemies where the variance applies before the "experience rate" sp-parameter:
    An option
    Code:
    Game_Actor.prototype.gainExp = function(exp) {
        var variancePercent = 0.08;   // 8% variance
        var varianceCap = exp * variancePercent;  // exp from enemy multiplied by percent
        var varianceAmount = (Math.random() * varianceCap * 2) - varianceCap;  // calculates for + or - amount
        var newExp = this.currentExp() + Math.round((exp + varianceAmount) * this.finalExpRate());
        this.changeExp(newExp, this.shouldDisplayLevelUp());
    };

    @Aloe Guvner YAAAAAY, thats EXACTLY what I'm looking for!! Works perfectly!
    @kovak thank you also, I know you tried a lot of different formula's with me and I love you for that, this is the one im going with though.

    If it wasent for both of you guys though coming together and problemsolving this wouldnt have been possible. THANK YOU GUYS SO MUCH!!! <3
  6. I apologize in advance for the double post, but I figured this should be shared clearly incase anyone else needs this thread.
    THIS WAS THE WORKING SOLUTION
    open your rpg_objects.js and replace this (lines 3924-3927)

    Game_Actor.prototype.gainExp = function(exp) {
    var newExp = this.currentExp() + Math.round(exp * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
    };

    WITH THIS

    Game_Actor.prototype.gainExp = function(exp) {
    var variancePercent = 0.08; // 8% variance
    var varianceCap = exp * variancePercent; // exp from enemy multiplied by percent
    var varianceAmount = (Math.random() * varianceCap * 2) - varianceCap; // calculates for + or - amount
    var newExp = this.currentExp() + Math.round((exp + varianceAmount) * this.finalExpRate());
    this.changeExp(newExp, this.shouldDisplayLevelUp());
    };


    What this will do is give u a slightly random based, but still scaling based EXP variance of 8% up or down from whatever the actual value is for each enemy in the database's xp reward section. It also still allows you to make an enemy give 0 exp if needed. It's compatible with yanfly's victory aftermath and I would assume other plugins that accomplish the same task.

    Credits to:
    @Aloe Guvner for finding the actual solution.
    and @kovak for trying multiple formula's with me to get to this point.
  7. Glad it's working for you!

    It would be better to paste it into a new plugin file and add that to your plugin manager.

    Reasons:
    • Changes are isolated, so in the future if you decide to change 8% to 10% then it's easier to find
    • If you update your project to a new version, you'll lose all direct edits to the rpg_* js files
  8. Now i wish for something similar but decreasing the variation :/
  9. kovak said:
    Now i wish for something similar but decreasing the variation :/
    i would assume this section

    var variancePercent = 0.08; // 8% variance

    controls the % so making the 0.008 and the 8% lower numbers should do the trick.

    right @Aloe Guvner ?
  10. I was more into decreasing it based on actor level instead of changing the percentage itself.
    It's fine, this is great.
  11. 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.