[MOD] LevelUp Adjuster

A curated forum for compatible and maintained mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] LevelUp Adjuster

Post by Ralzar »

Tes96 wrote: Mon Jan 20, 2020 9:42 pm So this mod just levels up once, for either new characters or saved ones. After that, it'll say 93% to next level progression on my character sheet. And when I get another skill increase, the level stays the same, and the progression says 6%, as if it already passed the next level. Except I don't get any level up screens.

It levels up once, for both saved and new, and after that, it doesn't work. I just keep making skill gains and the % is tracked in my level screen, but I'm not leveling up.
Ah damn. This was the most experimental part of an allready experimental mod.
I was sure the code I was overriding was controlling the leveling. Which it kind of does? Which is even weirder than it just not working.

I’ll see what I can do.
Last edited by Ralzar on Mon Jan 20, 2020 10:42 pm, edited 1 time in total.

Tes96
Posts: 13
Joined: Fri Jan 10, 2020 6:52 pm

Re: [MOD] LevelUp Adjuster

Post by Tes96 »

I'm using the latest DAG and latest build. Only other mod I have installed is D.R.E.A.M.

Thanks

User avatar
Baler
Posts: 225
Joined: Thu May 23, 2019 1:39 am
Location: Earth

Re: [MOD] LevelUp Adjuster

Post by Baler »

Tes96 wrote: Mon Jan 20, 2020 6:04 pm Great mod. Thanks for directing me here.

How come skills can't go past 100?
Certain things start to break in DFU if you go past 100. This is what I was told on discord some time ago.
I'm unsure if this is still the case but when I asked months ago it was not advised.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] LevelUp Adjuster

Post by Ralzar »

mikeprichard wrote: Mon Jan 20, 2020 8:07 pm
Ralzar wrote: Mon Jan 20, 2020 7:26 am
mikeprichard wrote: Mon Jan 20, 2020 1:38 am I just checked in on the forums after several weeks away, and WOW! I'm so glad and grateful you were able to get to this as you said you would. This looks fantastic, and will never be leaving my DFU - goodbye, hated level-up RNG! :D

My only suggestion, which I think I'd mentioned when you first said you'd do this earlier, is to include the retroactive HP gains for END feature already implemented in an alpha mod by another user a year ago: viewtopic.php?f=22&t=277&start=70#p21919. If you're willing and able to do that, this would be the perfect comprehensive level-up mechanic mod in my book; it will do everything I was originally hoping for (viewtopic.php?f=4&t=1893&p=22903#p22903) and more. Either way, thank you for this contribution!

Thank you :)

I had actually clean forgot about that mod or that mechanic. I will take a look at that later this week hopefully. I think I can see how to do that relatively easily.
Nice! Looking forward to even more good stuff here.
Argh, this actually turned out to be stupid difficult unless I'm missing something.

The problem is that each time you level up the game rolls a random amount of HP to add, then adds Endurance bonus.
But it doesn't save the roll. So you can't later ask "how many HP would I have now if my Endurance had allways been what it is now?"
Because the only values I have to work with is your current max HP and your current Endurance bonus. I have no history of your rolls, so I have no way of doing retroactive math to figure out how you ended up at the HP pool you now have.
Even if I managed to mod some way to store earlier HP rolls, that would break if you ever leveled up without the mod.

I can only make it work if you allways get the same amount of HP when you level up. Then it's simply a matter of setting the characters max HP to what it should be, because all the numbers involved are static.

Edit: I might just do that. A checkbox that activates retroactive Endurance bonus, but locks you to allways rolling max HP based on your HP roll settings. Minimum HP setting is then ignored.

Edit2: And looking at UserOfThisSite code, his mod originally intended to allway produce max HP rolls, so he never ran into the problem.

User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: [MOD] LevelUp Adjuster

Post by mikeprichard »

Ah, yes, his mod was based solely on max possible HP per level up rather than the HP bonus slider you have (which I like about your mod). I think your idea ("A checkbox that activates retroactive Endurance bonus, but locks you to allways rolling max HP based on your HP roll settings. Minimum HP setting is then ignored.") would work and would make sense, assuming this is something you'd like to add and I'm not just being pushy about this. Either way, just having the options to adjust level-up attribute and HP gains that you've already included is the core of the mod as far as I'm concerned and I assume for most other players as well - this retro HP based on END option would just be the icing on the cake. Thanks again for your work!

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] LevelUp Adjuster

Post by Ralzar »

mikeprichard wrote: Tue Jan 21, 2020 2:39 pm Ah, yes, his mod was based solely on max possible HP per level up rather than the HP bonus slider you have (which I like about your mod). I think your idea ("A checkbox that activates retroactive Endurance bonus, but locks you to allways rolling max HP based on your HP roll settings. Minimum HP setting is then ignored.") would work and would make sense, assuming this is something you'd like to add and I'm not just being pushy about this. Either way, just having the options to adjust level-up attribute and HP gains that you've already included is the core of the mod as far as I'm concerned and I assume for most other players as well - this retro HP based on END option would just be the icing on the cake. Thanks again for your work!
Well, I did... something.

Hopefully this works but the math and code is starting to hit my limit here :D

Edit: That was all wrong, but I think I've got it now.

Edit2: I think I managed it. The only thing I have no way of fixing is if you increase Endurance during leveling up. The code only changes MaxHP when the Level Up screen opens. So any new Endurance bonus is only applied the next time you level up.

Code: Select all

FormulaHelper.RegisterOverride<Func<PlayerEntity, int>>(mod, "CalculateHitPointsPerLevelUp", (player) =>
{

    int addHitPoints = 0;

    if (hpMax == 0) { hpMax = player.Career.HitPointsPerLevel / 2; }
    else if (hpMax == 1) { hpMax = player.Career.HitPointsPerLevel; }
    else if (hpMax == 2) { hpMax = player.Career.HitPointsPerLevel * 2; };

    if (hpMin == 0) { hpMin = 0; }
    else if (hpMin == 1) { hpMin = hpMax / 2; }
    else if (hpMin == 2) { hpMin = hpMax; };

    int minRoll = hpMin;
    int maxRoll = hpMax;

    if (retroEnd)
    {
        int endBonus = FormulaHelper.HitPointsModifier(player.Stats.PermanentEndurance) * player.Level;
        int pureMaxHP = maxRoll * player.Level;
        int newHP = pureMaxHP + endBonus;
        GameManager.Instance.PlayerEntity.MaxHealth = newHP;
    }

    addHitPoints = UnityEngine.Random.Range(minRoll, maxRoll + 1);
        addHitPoints += FormulaHelper.HitPointsModifier(player.Stats.PermanentEndurance);
        if (addHitPoints < 1)
            addHitPoints = 1;

        return addHitPoints;
                    
});

User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: [MOD] LevelUp Adjuster

Post by mikeprichard »

I have no idea what that code means, but if you like it, I like it! :lol: I'm not sure if this mirrors the formula UserOfThisSite had used per his/her linked code (target HP = 25 + MaxHPperLVL + (YourLvl-1) * (MaxHPperLVL + ENDmod)), or even how he/she arrived at that formula in the first place. However, if what you've implemented seems to produce a HP value curve in line with how the gains might normally work had they been retroactive in classic (assuming max possible gains per level and incrementing the modifier for every 10 points of END) - or at least isn't too broken balance-wise, since this isn't a feature from classic at any rate - it sounds good to me.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] LevelUp Adjuster

Post by Ralzar »

Hm, I forgot about the 25 I see.

If I understand it correctly, when you create a new character you start with 25+classHP ? So a Mage, who I think only gets 4 HP per level, would start the game with 29 HP?

It think my code winds up with giving you an extra classHP instead of 25. I can change that later today.

I'm also trying to figure out the damn lvel speed code, which is an even bigger headache :D

User avatar
mikeprichard
Posts: 1037
Joined: Sun Feb 19, 2017 6:49 pm

Re: [MOD] LevelUp Adjuster

Post by mikeprichard »

Ralzar wrote: Wed Jan 22, 2020 7:13 am Hm, I forgot about the 25 I see.

If I understand it correctly, when you create a new character you start with 25+classHP ? So a Mage, who I think only gets 4 HP per level, would start the game with 29 HP?

It think my code winds up with giving you an extra classHP instead of 25. I can change that later today.

I'm also trying to figure out the damn lvel speed code, which is an even bigger headache :D
Sorry I can't test right now, but I think that's how the formula works in classic/base DFU.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] LevelUp Adjuster

Post by Ralzar »

Well, new version uploaded to Nexus.

Retroactive Endurance Bonus is active. Unfortunately it will not, in its current form, add any bonus gained from the same LevelUp event. I might be able to fix this, but it'll probably be kind of weird.

Level Speed now works. I think. You at least level up more than once. I am not sure about how noticable the effect is though.

Post Reply