#Fortify Fix

1 messages · Page 1 of 1 (latest)

hard haven
tame star
#

here's a snippet from the part of vflex that calculates dynamic stats, in case you're interested

#

I'm way to tired to rip it into a standalone right now, but wanted to share it in case it serves as inspiration >.>

#

the actual formulas are not important, the part where it makes fortify affect max instead of current stats is what matters

#

when using it things like Fortify Health constant effect items are actually usable

#

you'll still lose the stats upon unequipping, but taking the belt as an example, so long as you have it equipped your max HP goes up by 20 along your current, meaning you can actually benefit from it by healing instead of having to do convoluted unequip/reequip cycles

#

similarly for Magicka you could fortify your MP with items or spells and then recover back to the fortified value via potions or resting

#

oh and for this kinda thing to work you have to force it every frame

#

getting the engine to stop doing horrible things to your current values whenever your attributes got fortified took me a lot of trial and error

hard haven
#

i dont wanna use onload and onsave because they get lost when the mod was uninstalled at some point

#

and the playersection is cross-save

tame star
#

it recalculates it whenever anything changes
I used on save and on load but that's...
1: something I wanna get rid of, or recombombulate along proper versioning
2: not necessary for the dynamic stat changes if they were to live as a standalone

#

I'm 99% sure you can get away with probing all the stats via engine calls and a neat temporary table, and just ignore saving completely

#

so long as you don't forget what your stats were the previous frame or two, it should be ok

hard haven
#

well a user could use the mod, buff himself some max health, save and uninstall the mod

tame star
#

you do need some degree of memory to force your way past engine shenanigans, but again not a semi-permanent table
the semi permanent table is there cause vflex is a character leveling mod

hard haven
tame star
#

not an issue in my books?
doing that seems well within "bad saving practices"

#

you generally wouldn't wanna save in such conditions if you're uninstalling that kinda mod.. just in general

hard haven
#

i mean i could show 4 warnings when the feature is enabled i guess

tame star
#

you do have a point tho, it's not 100% safe from user error

#

fun fact: you can also exploit fortify int + fortify magicka for infinite current magicka

#

if my memory doesn't fail me, that can be done on vanilla but not on vflex

hard haven
#

how?

tame star
tame star
# hard haven how?

it's to do with how the game scales your current values proportional to your max

#

or the other way around? it's a mess

hard haven
#

yeah with attribute changes (relative)

#

and fortify values are fixed

tame star
#

by overcapping your MP with fortify and then increasing your max via int, then undoing it in a specific order, you can increase the amount you've overcapped by

#

it can be repeated for exponential growth

#

and if you have access to xINT (mantle of woe lol) it's exponentially worse xD

#

I remember that bug cause I spent hours trying to solve it before having an epiphany and realising it was not my mod but vanilla behaviour

#

I then proceeded to spend more hours till I beat it into submission

hard haven
#

hmm

tame star
#

my point is at some point one has to accept that vanilla is about as safe as many a mod

hard haven
#

is this mwse?

tame star
#

you can do horrible things to your stats given a bit of luck and/or clever thinking, and in my opinion it's just how Morrowind do, mods or not

tame star
hard haven
#

yeah idk if people wanna abuse to get infinite mana and go such lengths, i dont feel like i need to fix that

tame star
#

yup

hard haven
#

i mean that vflex mod

tame star
#

took me more hours than I'd like to admit to realise that

hard haven
#

where/what is that even?

tame star
#

gimme a sec

hard haven
#

ah i see

tame star
#

it's on another thread

#

started it a while ago, went on to make and upload SUS and GRM, and now that I'm finally getting back to it I ran into your mod and thought hey maybe they could get some use out of my code

hard haven
#

idk how ncgd works but we aggree that a mod should only add and subtract its own values right? 😄

tame star
#

wrote the thing 2 months ago and I already hate reading through it 36vehks

tame star
hard haven
#

yea

tame star
#

ye aside from addons that should be a nono

hard haven
#

so many self-created functions and tables, can't really make sense of it

tame star
#

don't worry I can't either 🥹

#

gimme 15 minutes, I'm a bit more awake now

hard haven
#

i wonder if my mods are so hard to read to others as every other mod i've seen

tame star
#

I'll try to sanitise it a bit so it's more human readable

hard haven
#

idk if i even need that

#

i'm kinda almost done with it

tame star
hard haven
#

just trying to figure out how to save the values

tame star
#

Did you manage to actually stop the engine from killing you?

#

I gave up on that due to that 1 issue

hard haven
#

why would the engine kill me?

#

its kinda behaving right now 😄

#

maybe the fatigue calculation could be sassy

#

or magicka

#

but health?

#

nah

tame star
#

if your HP drops below 0 by vanilla mechanics, you're ded
engine doesn't really care what you do to your stats, it does it's thing before your code happens and if HP goes below 0 during that there's no coming back.. or well, there wasn't last time I checked

#

now I'm curious as to how you're managing it

hard haven
#

yeah thats why my mod is removing the magic effects instead of waiting for the game to do it

tame star
#

oh that's smart

hard haven
#

when dispelling spells or when the duration is <0.2s

tame star
#

why didn't I think of that lmao
clean solution, as clean as it gets

hard haven
#

but i just noticed how the game is sassy with the max fatigue, maybe i'll just disable that feature for that

#

probably still works fine for the current value

tame star
#

be wary of dealing with max anything on vanilla dynamic math

hard haven
#

yeah but i think health is not affected

tame star
#

again, exponential growth or your stats getting vortexed into oblivion

hard haven
#

and lets be honest, health is the most important one

#

you can fortify the other values with attributes

tame star
#

speaking of, do check a levelup or two just in case

hard haven
#

and probably only relative

#

yeah maybe i should check that

tame star
#

it can discombombulate your current values

#

I ran into it, and ended up fixing it by just tackling MP which was the worst

#

whatever works for MP works for everything else

hard haven
#

nvm

tame star
#

xD

hard haven
#

hmm

#

monitoring fatigue and magicka and all stats sounds like a nightmare

tame star
#

it is

#

it's an exercise in stubornness

hard haven
#

lol yeah

tame star
#

whomever is the most stubborn wins, and the engine is no slouch

hard haven
#

thanks for the warning, i'm probably not gonna attempt that

#

fortify fatigue and magicka for increasing the base value is kinda pointless anyway

tame star
#

you're welcome!
if you ever do, hit me up, I can probably spend 30 minutes to save you 4 hours

tame star
hard haven
#

nah you can usually just enchant strength and intelligence

#

if you dont use the hardcore mode mod

tame star
#

going back to hortatorbelt, it's mildly ironic that a main quest item was done so dirty

#

it's a sad 20 points even when it works, and on vanilla it's just a scam xD

tame star
#

oh another thing the dynamic thingy I posted does is dynamically update your HP realtime

hard haven
#

another way to do it would be monitoring active restore effects and apply them yourself

tame star
#

it's NCGD's HP formula on steroids, kinda

hard haven
#

but then i'd need to rewrite my hud mod and make a new magicka regeneration mod

tame star
#

not the featurecreep ur

#

that thing is the reason vflex isn't up and probably won't be for a good couple months to come

#

avoid it like the plage

hard haven
#

lol

#

openmw 0.50 will probably feature spell de-hardcoding very early

#

but.... who knows if that will actually fix anything xD

tame star
#

unless they do dynamic stat dehardcoding, then no >.>

#

the issues are right in the stat calculation code itself

#

it's not the magic effects, it's the stat changes that get the math drunk

#

still, dehardcoded spells are a godsend for a lot of mods

#

looks at 160 custom spells for custom stat effects

#

could probably delete that with 8 for loops and dynamic spells

hard haven
#

i already made magicka cost reduction for my mbsp mod

#

so theres already a lot possible

tame star
#

wait is that mod yours?

#

the legend!

hard haven
#

i made a fork

tame star
#

hmmm

hard haven
#

managed to nail down the exact frame where the spell starts casting to 1-3 frames

#

so its possible to apply the refund before casting

#

xD

tame star
#

huh

#

animation keys?

hard haven
#

yeah

tame star
#

I used that for SUS

hard haven
#

animation keys for knowing when the player is not casting

tame star
#

albeit SUS does it after the cast key

hard haven
#
  • stagger/silence check, and when the "use" key switches from false to true
tame star
#

that sounds like a lit of checking ._.

hard haven
#

yeah its hacky

#

otherwise hook the skill exp event and apply the code of your spell then

#

so idk, not sure if i'm gonna be impressed by the spell dehardcoding 😄

tame star
#

I used that one function

#

listen for spellcast, then do thing

#

the rest happens on the skill use handler yes

hard haven
#

yeah i did the same to store the spell

#

with "self start"

tame star
#

huh didn't realise that one was spell specific 👀

hard haven
#

groupname is spellcast

#

and key is self start or touch start etc

#

and -stop

tame star
#

aah

#

I was missing this yes

#

it was present, just in the habitual obscured way of cursed greyness mastertables

#

why do I do that to my code 36vehks

hard haven
#

procedural programming wherever possible

#

but idk, i'm self-taught.. so ...

tame star
#

same here

#

pretty sure I'll move away from putting all my data on it's own file
that function would make more sense if SPELL_ANIMATION_KEYS was declared right above it

hard haven
#

maybe the crazy use of functions is good for large projects, possible with multiple devs

#

ah okay

tame star
hard haven
#

idk didnt see your entire code

tame star
#

personally whenever I get past 500 lines something has to give

#

I know I know, baby steps

hard haven
#

but some people split their mods into 20 functions

#

on 500 lines

tame star
#

is that a lot or a little?

hard haven
#

way too much

#

i'll usually do 3-5 functions maybe

tame star
#

sweats profusely

hard haven
#

either when i'm using something in multiple places or when the name is really self-explainatory

#

yeah idk maybe i'm doing it wrong

tame star
# tame star

notice the low indentation? yeah it's all functions everywhere

hard haven
#

but i personally can't be bothered to read other people's code if its split up like that

tame star
#

tbf call me convinced
reading through that abomination was pain

#

and I remember what it does

#

so imagine if I didn't

hard haven
#
            dbg("fortify "..remStat.." ran out, +"..remMagnitude.." "..remStat)
            dynamic[remStat](self).current = math.max(1+remMagnitude,math.min(
                dynamic[remStat](self).base +remMagnitude,
                dynamic[remStat](self).current + remMagnitude * math.min(1, remDuration / 60 * playerSection:get("percentagePerMinute") / 100)
            ))
            Actor.activeSpells(self):remove(remId)
            bonuses[remStat] = bonuses[remStat] - remMagnitude
        else
            dbg("fortify "..remStat.." ran out, +"..remMagnitude.." "..remStat)
            dynamic[remStat](self).current = math.max(1+remMagnitude,math.min(
                dynamic[remStat](self).base + bonuses[remStat],
                dynamic[remStat](self).current + remMagnitude * math.min(1, remDuration / 60 * playerSection:get("percentagePerMinute") / 100)
            ))
            Actor.activeSpells(self):remove(remId)
            bonuses[remStat] = bonuses[remStat] - remMagnitude
        end```
#

there's one line different

#

but before i get a headache and turn this into a function and make it un-readable i'll just have most the code there twice

#

i can probably simplify some lines later

tame star
#

well that's not too bad
from a completely newb pov, abstracting there seems a 50/50 at best

hard haven
#

but i'll never make a "setstat(stat, min, min2)" function xD

#

ye its one line within a math.min thats different

#

not worth a seperate function

tame star
#

here's an example of what I'd consider ok use of functions

hard haven
#

and 3 lines that i have dublicate (due to development forth and backs)

#

are you sure this is openmw?

tame star
#

yes

hard haven
#

holy shit

tame star
#

it's on the nexus, you can run it on 0.49

#

Skill Uses Scaled

#

that's the scaler for all 3 armor skills

hard haven
#

why mui.getsetting() instead of playerSection:get()

tame star
#

there's a bunch of others for ~20 of the 27 skills

tame star
#

I'm not sure it's actually necessary, I ended up doing that from following the examples and adding a bunch of settings groups

#

it has a lot of settings

hard haven
#

technically you just need one for each settings section plus one global and one player

tame star
#

then I need like 8 of them

#

abstracting meant future me doesn't really need to care about the specific names

hard haven
#

i think you can just get a reference to a table in one of your sections

tame star
#

I can have all the sections and treat them like a single monolith via getsetting

hard haven
#

not sure if its saved without saving explicitely

tame star
#

I think it wasn't? I ended up having it save kinda janky

hard haven
#

with each settings section i meant the global settings and the player settings

tame star
#

it's global and saves on you saving the game

#

as in, so long as you save on any save it's set for all saves

#

I'll be honest, settings are not my forte

#

sections still confuzzle me

hard haven
#

relatable

tame star
#

There's an example of magicka being deleted vvia fortify int and max MP on vanilla

#

1: raise INT
2: raise MP, overcapping
3: INT wears off, proportional scaling eats off a good chunk of the fortified MP
4: fortify MP wears off, deducting it's original amount despite a portion of it having been deleted in step 3

#

reversing the order of Fortify MP and Fortify INT results in the inverse

hard haven
#

yeah but its probably just something that really affects you if you actively exploit it

tame star
#

as INT amplifies the fortify effect

tame star
#

once you get how it works, it's arguably on the level of daisychaining potions, if done correctly
you could replicate it with 2 enchanted amulets, or with spells and a few restore potions

hard haven
#

i guess im gonna share that with my atronach sign friend

#

so he doesnt have to abuse his summoned creatures to regenerate magicka anymore

tame star
#

it doesn't look that impressive on that character, but remember, it's exponential :D

#

oh yeah it works with drain strats ._.

#

as it turns out, draining your INT down and then fortifying is a lot more effective

#

it multiplies the cap when int bounces back proportional to the current/max ratio

#

so 50/10 > 180/130

hard haven
#

hmm

#

maybe my mod even fixes that

#

because fortify would also buff the max value

tame star
#

ideally you'd want to drain down to 1 int

#

then stonks

hard haven
#

but i dont think i wanna apply it to fatigue and magicka

#

damn

#

now i see why you needed me xD

#

but if we're being real, is there any setup where a player might accidentally repeatedly run into this situation?

#

if he/she makes a spell with fortify int and fortify magicka?

#

or the other way around?

tame star
#

On vflex it doesn't happen, at least not ever in favour of the player
most comboes just return to base, and the ones that don't only vortex current MP into the void

#

and if I remember right, vortex is limited to reducing INT to 0 or having both fort/drain INT and Fort/drain MP on the same spell

tame star
#

that's how I ran into it during testing

#

made a generic "fortify all kinds of magicka" testing spell, and hell broke loose

#

imo if you can get it so the effects work fine when triggered on separate spells, then it's good enough

#

adding a flavourful warning saying "don't put them in the same spell" is a lot better than "don't be affected by both at the same time"

#

the proverbial bug surface is a lot smaller if it's restricted to both on one spell

hard haven
#

actually you could put fortify int 100 twice on the same spell

#

which is the only thing you'd actually do if int is more effective than fortify magicka

tame star
#

I think that should cause no issues though? so long as no overcap is involved, stuff doesn't go wild

#

I mean, good chance your MP will get voided if current < max, but that's not game breaking

#

it's just a bit annoying

hard haven
#

huh

#

i just tested it and it reduced my max int from 300 to 252

#

nvm i had increased my magicka via console before

#

the game really does what it wants xD

tame star
#

welcome to the rodeo!

#

I'll do a Nova Drift run, then come back for my own round

#

I'll be making the level UI box today

#

wish me luck, I'll need it ._.

hard haven
#

good luck 😄

hard haven
#

not doing fatigue and magicka though

tame star
#

Nice!

#

And yep onSave and onLoad are all funny with reloadlua
probably a plus when bughunting honestly
ideally you'd want reloadlua to be as close to restarting the game as humanly possible

verbal remnant
#

@hard haven Just an idea... Since I "discovered" that Fortify Health works completely different as a Spell Ability here: #1427867749870473287 message

You think Fortify Health used as an Spell Ability might solve the issue if you could get around writing a script that could handle the effect dynamically?

I just tested it with NCG running as well and it is not having any conflict. As NCG respect stat buffs that comes as an ability.

gleaming pagodaBOT
#

I've tinkered a bit with how I would prefer the sleep buff/debuffs to be. I think I like this combo I've come up with. Just sharing it here for anyone to criticize:

  • All the Drain Attribute effects are completely negated by casting Restore Attribute or visiting a Temple Shrine/Cult Altar (Drain/Damage Attribute is only applied once).
  • So I replaced Drain Agility with a Blind effect, which does mostly the same thing insofar as combat goes.
  • Also added Sound to give a matching debuff for Magic classes. The sound effect is a problem however. So might have to skip this unless getting a sound effect replacer.
  • Since I use NCG Fortify Endurance is not doing anything to give a little HP boost.
  • Replaced Fortify Attributes with Fortify Health & Fortify Max Magicka
    (Fortify Health actually fortifies Maximum Health as an Ability lmao)
  • Replaced Drain Fatigue with a negative Restore Fatigue.

  • Regarding Drain Personality... I don't know a replacement. I thought about if setting a negative Charm on yourself would somehow give negative disposition to NPCs around you... but I doubt that works

Numbers I'm just testing with now (completely guesstimated but I think they are reasonable):

 - Fortify Health 12 pts
 - Fortify Max Magicka 0.4x
Rested
 - Fortify Health 6 pts
 - Fortify Max Magicka 0.2x
Awake
 - Fortify Health 3 pts
 - Fortify Max Magicka 0.1x
Drowsy
 - Restore Fatigue -1 pts
Tired
 - Restore Fatigue -2 pts
 - Sound 5 pts
 - Blind 5 pts
Exhausted
 - Restore Fatigue -3 pts
 - Sound 10 pts
 - Blind 10 pts```
verbal remnant
#

I'll test if Fortify Fatigue works the same way...