Page 31 of 42

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 09, 2020 4:24 am
by Magicono43
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?

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 09, 2020 8:28 am
by Hazelnut
I'm only changing it for armor yes. Note the way the override is called.

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 09, 2020 11:50 am
by Magicono43
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.

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 09, 2020 11:55 am
by Ralzar
Oh damn, I did not know that. I'll have to remember that for my own overrides.

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 09, 2020 1:54 pm
by Hazelnut
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.

Re: [MOD] Roleplay & Realism mod pack

Posted: Mon Mar 16, 2020 9:52 pm
by King of Worms
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.

Re: [MOD] Roleplay & Realism mod pack

Posted: Tue Mar 17, 2020 7:42 pm
by Midknightprince
When was the last time this got updated ?
I'm still using one from 6/19....am I missing an update ?

Re: [MOD] Roleplay & Realism mod pack

Posted: Tue Mar 17, 2020 7:46 pm
by Hazelnut
Quite recently, 20th Feb mate. Go download 0.9 from Nexus assuming you're on latest DFU.

Re: [MOD] Roleplay & Realism mod pack

Posted: Tue Mar 24, 2020 12:48 pm
by Ralzar
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?

Re: [MOD] Roleplay & Realism mod pack

Posted: Tue Mar 24, 2020 5:09 pm
by Hazelnut
ooooh, crap, yeah probably :oops:

Or are werewolves unable to climb - like wolves can't right?