Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Luck: What it is and how it works

1235»

Comments

  • ProbablyNotANumberProbablyNotANumber Member Posts: 22
    edited October 2018
    You made me stop awkwardly for a minute. Did I really waste such a wall of text ? That would be hilarious.


    And it is.



    I have no idea how I could let this slip through the cracks of my awareness even though I use it to estimate spell damage. For some reason, I didn't apply Luck the same way the game does. The results are correct for negative Luck, since they went through the test of reality, but I expressed them using a different algorithm. If AC ≤ Thac0 -2, use Thac0 + Luck - AC = MinimumRollToHit. Otherwise, use Thaco - AC = MinimumRollToHit. Then we're back into familiar territory and know what to do with that minimum roll requirement.

    The reason I couldn't click with the real game algorithm is probably because I bumped into the issue from an unexpected angle. As I was hit 100% by Yaga Shura despite a massive -17 Luck penalty, I cast Improved invisibility, and all of a sudden he turned into a kitten failing to catch a laser. WTF ? It didn't connect that with the game's algorithm the Luck penalty would be unlocked all at once with even a mere +1 AC bonus (Let's say from -9 to -10 against a -8 thac0 drunkard): I would have expected a progressive entrance of the penalty, so I put assumptions on the side and tried to find what was up from data. But I should have thought about it twice to save a lot of time, since a progressive entrance means something nonsensical: That as the to-hit tipping point (Thac0 - AC) shifts away from 1 and closer to 20, Luck's potential for reducing accuracy increases. It's clearly the opposite: Luck's penalty potential is largest when the tipping point is close to 1 and misses are otherwise rare; at -17, Luck can make use of all those points, turning a lot of hits into misses. Then as the to-hit border shifts towards 20 from an improving AC or a worsening thac0, -17 Luck becomes no more useful than -5 Luck, and ultimately 0 Luck. So the Luck penalty does a full entrance right when the to-hit tipping point enters the [1-20] range from the left, and withdraws progressively as the natural AC becomes protective enough (or the thac0 less accurate), moving the tipping point to the right.


    Now I'd like to understand how the combat log computes its numbers for a non-zero Luck attacker, but I think I spent a little too much time on this Luck thing already :*

    Post edited by ProbablyNotANumber on
    lolienAerakar
  • Luke93Luke93 Member, Mobile Tester Posts: 1,004
    edited November 2018

    @Alonso: I'll rephrase. Let's say "the creature affected" is the creature who is under the effects of a luck spell or song or item.

    Luck does NOT affect:

    4. Critical hit and critical miss chances (unconfirmed) OF the creature affected

    I think you can safely remove that unconfirmed (see the attached screenshot for further details.....).

    I think it's reasonable to assume that the same holds for a Critical hit.....

    StummvonBordwehr
  • Grond0Grond0 Member Posts: 4,216
    @Luke93 I certainly agree with your conclusion, but not your reasoning. The example you posted shows a roll of 1, with no adjustment for luck, even though negative luck of 4 is operating. The reason there is no adjustment for the roll of 1 is that luck can't reduce a roll below 1. In order to conclude that there is no impact on the chance of a critical miss though you would need to show a roll something like:
    - die roll 2 / 3 / 4 / 5
    - luck -1 / -2 / -3 / -4
    and show that would not be recorded as a critical miss (which it wouldn't).

    The same applies to critical hits - it's the original die roll that determines those, not the adjustments to it.

    StummvonBordwehrsemiticgodAerakarLuke93
  • semiticgodsemiticgod Member, Moderator Posts: 11,292
    I've seen negative luck increase the rate of critical misses, but only in IWD and IWD2. The BG games don't seem to have that.

    AerakarGrond0
  • Luke93Luke93 Member, Mobile Tester Posts: 1,004
    Grond0 said:

    In order to conclude that there is no impact on the chance of a critical miss though you would need to show a roll something like:
    - die roll 2 / 3 / 4 / 5
    - luck -1 / -2 / -3 / -4
    and show that would not be recorded as a critical miss (which it wouldn't).

    Here it is (again, my current Luck is "-4")

  • Grond0Grond0 Member Posts: 4,216
    @luke93 I'm confused now what you're trying to say. The screenshot you posted looks like it's suggesting that luck can reduce a die roll greater than 1 in order to produce a critical miss. However, as I said earlier, that's not the case - at least in BG. Here's a full screenshot demonstrating that.

  • Luke93Luke93 Member, Mobile Tester Posts: 1,004
    edited November 2018
    @Grond0

    Yeah, sorry, I forgot to say that I modified my critical miss chance via opcode #362 (in order to see if Luck can affect it......)

    In any case, (negative) Luck cannot reduce a roll below 1 ( even in case of critical misses....)

  • QuickbladeQuickblade Member Posts: 665
    edited December 2018
    Bubb said:

    I was poking around in the engine internals, and I found that several opcodes directly reference luck.

    The most interesting case has to do with Mirror Image. A character's luck value directly affects whether or not Opcode #12 (Damage) will bypass the images or not.

    If luck is greater than 0 -> Damage will NEVER bypass mirror images.

    • A mage with 1 luck and 8 images will never be hit through the images.
    • A mage with 0 luck and 8 images will be hit through the images some of the time.

    If negative luck is less than images amount, (or luck is 0) -> Chance to bypass is (luck + 1) / (images + 1)
    • A mage with -5 luck and 8 images will be hit through the images (5 + 1) / (8 + 1) = 66.6% of the time.
    • A mage with 0 luck and 8 images will be hit through the images (0 + 1) / (8 + 1) = 11.1% of the time.

    If negative luck is greater than or equal to images amount -> Damage will ALWAYS bypass mirror images.
    • A mage with -8 luck and 8 images will always be hit through the images.
    • A mage with -5 luck and 8 images will be hit through the images some of the time.
    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    Because I edited Mirror Image to personal taste to act as it does in (at least 3E) PnP, which requires combining both a random and a set number (1d4+level/3, max of 8). Actually, I think I got around it by doing % probability with setting specific numbers of images, necessary because at 15th and 18th, it's d2 and d3, not d4, I'd have to dig it up.

  • kjeronkjeron Member Posts: 1,465

    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    The first Mirror Image opcode (#119) just applies other Mirror Image opcode #159 with a parameter1 value equal to:
    2 + (Caster Level / 3), rounded down, maximum of 8
    So it doesn't matter which one you use.

  • QuickbladeQuickblade Member Posts: 665
    kjeron said:

    Does that apply whether you do the standard Mirror Image Opcode (random number of images), or the set specific number of mirror images Opcode, or both?

    The first Mirror Image opcode (#119) just applies other Mirror Image opcode #159 with a parameter1 value equal to:
    2 + (Caster Level / 3), rounded down, maximum of 8
    So it doesn't matter which one you use.
    Hrm, I was using DLTCEP, which says for #119 "Applies the mirror image effect to the targetted creature(s), creating mirror images up to the 'Maximum Images' value."

    IESDP doesn't really say much about it.

    What I meant is, adding mirror images is cumulative because I had it when I tested. Vanilla mirror image is 119 for 5 images max.

    Is there a difference to the luck vs. images between a spell adding 4 images 1 time, compared to a spell adding 1 image 4 times?

  • BubbBubb Member Posts: 376
    @Quickblade: Nope, there isn't any difference - the engine only cares about the total number of images a mage has up.

  • kjeronkjeron Member Posts: 1,465
    edited December 2018
    @Bubb Keep it coming. :)
    Bubb said:

    #18 (0x12) - Hide()

    - Rolls a 1d100 in order to test for critical failure, (this being a roll of 100). Any amount of positive luck will remove the chance of critical failure. Negative luck will "shift" the probabilities slightly out of your favor. For example:

    It's not just the Critical Failure roll, enough luck will guarantee hiding success.

    Sadly no amount of luck will help someone with zero skill for hiding/set traps. Otherwise the +5% granted by the Luck Spell could be removed for these skills. Doesn't help that the game also suppresses racial and dexterity skill modifiers for classes that don't normally have access to these skills.

    A Paladin with 255 luck, (0 HiS/MS), +5 MS from Dex/Race will always fail to hide.
    A Paladin with 255 luck, (0 HiS/MS), +5 MS from Race, and the luck spell (+5% HiS/MS) will always succeed.
    A Monk with 255 luck, (0 HiS/MS), +5 MS from Dex/Race will always succeed.

    Bubb
  • ZaghoulZaghoul Member, Moderator Posts: 3,448
    edited December 2018
    @Bubb Nice B) . So would the following add up in chances of success with Alora as an example?
    Rabbit foot
    Luck spell on Alora
    Bard song active on Alora

    I think this explains why Alora has never failed a PP or steal attempt in BG with a high PP score for me.

    Bubb
  • Grond0Grond0 Member Posts: 4,216
    edited December 2018
    Bubb said:

    #252 (0xFC) Spell Effect: Set Trap

    - Engine rolls a 1d100, and if the roll is less than the character's Set Traps skill it fails succeeds. Each point of luck will "shift" the probabilities slightly in your favor. For example:

    Luck 20 Probabilities:
    1 => 0%
    2 => 0%
    3 => 0%
    98 => 1%
    99 => 1%
    100 => 21%


    Negative luck has the same effect, but in reverse.
    @Bubb thanks for more great analysis. Just on set traps, you've amended your post to say that setting a trap succeeds if the roll is less than your score. However, the table you've posted shows luck operating to give you an increased chance of a higher number. Is that actually an error in the game engine, or is the table you posted the one for negative luck?

    Bubb
  • BubbBubb Member Posts: 376
    @kjeron: So it does! I incorrectly believed the engine overrode the relevant register after the critical fail check, but it actually stores it away in a local variable to reuse it later :)

    (don't ask me about the actual stealth check, though. It doesn't use a usual dice roll - something really wacky is used to calculate the roll).

    @Zaghoul: The program I built to scrub all Actions / Opcodes for certain stat accesses doesn't show that Pick Pockets ever accesses the character's luck value. I've had to iron out some problems with it already, so it very well could be missing something.

    Those Luck sources do stack, though. So if Luck does actually affect Pick Pockets, it very well could help. As they say, more research is needed.

    @Grond0: Good eye! The engine negated the luck value before throwing it into the random function, and I accidentally plugged in the raw value when I constructed the Set Traps probability table. I've fixed it - the engine is right, I'm wrong. :D

    Zaghoul
1235»
Sign In or Register to comment.