[MOD] Roleplay & Realism (modular)

A curated forum for approved 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.
User avatar
Magicono43
Posts: 155
Joined: Tue Nov 06, 2018 7:06 am

Re: [MOD] Roleplay & Realism mod pack

Post by Magicono43 » Mon Mar 09, 2020 4:24 am

I think I may have found a bug in your code, or maybe it's intentional?

The Override formula for "ApplyConditionDamageThroughPhysicalHit" seems to not allow weapons to degrade from attacking an entity, it seems like armor is the only thing that takes condition damage the way this method is written.

RoleplayRealism.cs:

Code: Select all

private static bool ApplyConditionDamageThroughPhysicalHit(DaggerfallUnityItem item, DaggerfallEntity owner, int damage)
        {
            if (item.ItemGroup == ItemGroups.Armor)
            {
                int amount = item.IsShield ? damage : damage * 4;
                item.LowerCondition(amount, owner);
                if (owner == GameManager.Instance.PlayerEntity)
                    Debug.LogFormat("Damaged {0} by {1} from dmg {3}, cond={2}", item.ItemName, amount, item.currentCondition, damage);
                return true;
            }
            return false;
        }
Whereas the "vanilla" formula is.

FormulaHelper.cs:

Code: Select all

private static void ApplyConditionDamageThroughPhysicalHit(DaggerfallUnityItem item, DaggerfallEntity owner, int damage)
        {
            Func<DaggerfallUnityItem, DaggerfallEntity, int, bool> del;
            if (TryGetOverride("ApplyConditionDamageThroughPhysicalHit", out del))
                if (del(item, owner, damage))
                    return; // Only return if override returns true

            int amount = (10 * damage + 50) / 100;
            if ((amount == 0) && Dice100.SuccessRoll(20))
                amount = 1;

            item.LowerCondition(amount, owner);
        }
Which does not have an if-statement that is discriminating between armor and non-armor items. So is this an intentional design or just a mistake? If it is intentional, what other things in the code would make weapons take durability damage, like does bashing locked doors count as attacking an entity?

User avatar
Hazelnut
Posts: 2130
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by Hazelnut » Mon Mar 09, 2020 8:28 am

I'm only changing it for armor yes. Note the way the override is called.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Magicono43
Posts: 155
Joined: Tue Nov 06, 2018 7:06 am

Re: [MOD] Roleplay & Realism mod pack

Post by Magicono43 » Mon Mar 09, 2020 11:50 am

Hazelnut wrote:
Mon Mar 09, 2020 8:28 am
I'm only changing it for armor yes. Note the way the override is called.
Oh... I did not even notice that little difference there. So I guess what that basically means is, if the overridden formula (being yours) is a piece of armor, it eventually returns true, and finishes the call there. Whereas, if it's anything other than an armor piece, the override returns false, which runs the "vanilla" script like normal with the normal formula. Interesting but important detail there I missed.

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

Re: [MOD] Roleplay & Realism mod pack

Post by Ralzar » Mon Mar 09, 2020 11:55 am

Oh damn, I did not know that. I'll have to remember that for my own overrides.
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

User avatar
Hazelnut
Posts: 2130
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by Hazelnut » Mon Mar 09, 2020 1:54 pm

Most of the formula are standard functions so you can't do this, but there are a few like this one that simply cause a side effect and don't return a value. The ones I've done allow the override to return a bool that indicates if the override has handled the effect or if the original formula should.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
King of Worms
Posts: 3041
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by King of Worms » Mon Mar 16, 2020 9:52 pm

IDEA:
Disable running in the shallow water if not mounted on a horse

Now when the shallow water has a correct footstep sound Ive realized it would be nice for it to also have a physical effect on the player, disabling his ability to run.

It would also add to some depth and strategy to various ingame events here and there, with a hint of realism.

User avatar
Midknightprince
Posts: 1180
Joined: Fri Aug 11, 2017 6:51 am
Location: San Antonio TX
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by Midknightprince » Tue Mar 17, 2020 7:42 pm

When was the last time this got updated ?
I'm still using one from 6/19....am I missing an update ?
Check out my YouTube Channel!

User avatar
Hazelnut
Posts: 2130
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by Hazelnut » Tue Mar 17, 2020 7:46 pm

Quite recently, 20th Feb mate. Go download 0.9 from Nexus assuming you're on latest DFU.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: [MOD] Roleplay & Realism mod pack

Post by Ralzar » Tue Mar 24, 2020 12:48 pm

Just saw a video of someone playing a werewolf with RP&R active.
He had his beast hands out and got the "You can't climb with a weapon drawn" message. Perhaps put in a conditional for H2H?
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

User avatar
Hazelnut
Posts: 2130
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: [MOD] Roleplay & Realism mod pack

Post by Hazelnut » Tue Mar 24, 2020 5:09 pm

ooooh, crap, yeah probably :oops:

Or are werewolves unable to climb - like wolves can't right?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply