Formula Override Ordering

Discuss modding questions and implementation details.
Post Reply
l3lessed
Posts: 1068
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Formula Override Ordering

Post by l3lessed »

I have a question, about formulahelper overrides and how they work.

So, I make a patch for another mod that overrides a single formula, say the CalculateAttackDamage formula.

If another mod then comes along and modifies say the CalculateWeaponAttackDamage formula, and then I call that same formula (CalculateWeaponAttackDamage) in my CalculateAttackDamage formula, will it use the updated CalculateWeaponAttackDamage from the mod when running my CalculateAttackDamage?

This will affect patching these formulas between mods. I'm assuming it will pull whatever the last formula override was by the last mod. So, in my example, my CalculateAttackDamage formula will use the new CalculateWeaponAttackDamage provided by the other mod, right?
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

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

Re: Formula Override Ordering

Post by Ralzar »

I would be very surprised if it worked any other way.

If you want to avoid calling the formula overridden by another mod I would reccommen moving the actual code for the formula out of the override and into its own method. Then have both your formula overrides call that method instead.
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

l3lessed
Posts: 1068
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Formula Override Ordering

Post by l3lessed »

Thanks for the reply. I was hoping it worked the way you said. That will make adding patches for other mods that do heavy changes to the formulas much easier. This will make creating patches for ambidexterity module much easier.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

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

Re: Formula Override Ordering

Post by Ralzar »

Yeah, just combine it with dependencies code in the mods json file. So your mod is always loaded after them, leading to predictable behaviour.

Like I do here:

https://github.com/Ralzar81/RacesRedone ... d.json#L13
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

l3lessed
Posts: 1068
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Formula Override Ordering

Post by l3lessed »

Can you grab a mods settings using the mod controller object and its properties?

I am trying to make a built in compatibility patch for Ambidexterity Module and Physical Combat/Armor Overhaul. However, that mod has built in settings the user chooses that affects the formula I want to replace.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

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

Re: Formula Override Ordering

Post by Ralzar »

Yes, but I’m on vacation atm. So mobile surfing and linking to github is hard :D

See my mod code here:

https://github.com/Ralzar81/Climates-Ca ... es.cs#L288
My released mods

"I feel like Ralzar specifically wrote those mods for me and then said "Use them". Just so he could watch me die more."
-FuzzyBeanPlays

l3lessed
Posts: 1068
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Formula Override Ordering

Post by l3lessed »

Thanks. Yeah, that was what I landed on myself.

However, because magicon accepted the changes I needed to his mod, I don't need this anymore. Maybe it will help some one else though.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply