testlum Posted August 20, 2023 Share Posted August 20, 2023 I'd like to make a small tweak for the Mind Flayer's Devour Brain "attack" item to drain 1-5 INT instead of a static 5. This is what I have in mind: Effect 1: -1 INT, prob1 = 0, prob2 = 19 Effect 2: -2 INT, prob1 = 20, prob2 = 39 and so on. Is this a correct assumption that the full range is 0-99, or should it be 1-100 instead? Quote Link to comment
CamDawg Posted August 20, 2023 Share Posted August 20, 2023 Yes, it runs 0-99. If I may suggest a slight alteration: 0-19: -1 INT 0-39: -1 INT 0-59: -1 INT 0-79 -1 INT 0-99: -1 INT This preserves the same 1d5 INT loss while avoiding the autopause bug. Quote Link to comment
testlum Posted August 20, 2023 Author Share Posted August 20, 2023 Ah, that could work too but I'm unfamiliar with the autopause bug. What's the cause/effect? Quote Link to comment
jmerry Posted August 20, 2023 Share Posted August 20, 2023 If the game pauses on exactly the wrong frame - which is most common with "auto-pause on spell cast" - the effects of a spell/item that happen on exactly that frame are decoupled. Instead of all using the same random numbers for stuff probability and saves, each effect is rolled separately. So, for your original idea, that's a 20% chance of -1 INT, another independent 20% chance of -2 INT, another independent 20% chance of -3 INT, and so on. You'd get the same average INT loss of 3, but the actual value could be anything from 0 to 15. The alternate form CamDawg suggests here would still be bugged if the effects got decoupled, but with a much milder effect of squishing the values together instead of spreading them out. INT loss would always be in the 1-5 range, but with a <4% chance of 1, a >43% chance of 3, and a <4% chance of 5 instead of the intended uniform distribution. Quote Link to comment
polytope Posted August 20, 2023 Share Posted August 20, 2023 (edited) 52 minutes ago, jmerry said: If the game pauses on exactly the wrong frame - which is most common with "auto-pause on spell cast" - the effects of a spell/item that happen on exactly that frame are decoupled. Also "auto pause on hit", which is why it would be relevant for an effect block in an enemy creature's natural attack (but irrelevant for the "target gone" autopause, because that means the victim of the attack is dead anyway). That said, I have literally never seen this bug with manual pause, only autopause, of which the only one I use is "enemy sighted" ("spell cast" is kinda cheaty, even "badly injured" makes the game easier). If it can occur due to player pause it's the rarest of bugs, rarer for instance than the "endless spellcasting without a spell ever actually cast" thing that can occasionally be triggered by breaking line of sight for a player controlled character, and which I've never seen mentioned in the "code fixes" thread. Edited August 20, 2023 by polytope Quote Link to comment
testlum Posted August 20, 2023 Author Share Posted August 20, 2023 Quote You'd get the same average INT loss of 3, but the actual value could be anything from 0 to 15. Wow, gnarly. Guess I'd better go with Camdawg's suggestion then. Thanks! Quote Link to comment
jmerry Posted August 20, 2023 Share Posted August 20, 2023 32 minutes ago, polytope said: That said, I have literally never seen this bug with manual pause, only autopause, of which the only one I use is "enemy sighted" ("spell cast" is kinda cheaty, even "badly injured" makes the game easier). If it can occur due to player pause it's the rarest of bugs... I've never seen it on manual pause either; it may indeed be only possible on auto-pause. But I don't know, and the frame-perfect nature of triggering it certainly makes that difficult to verify. Quote Link to comment
jmerry Posted August 20, 2023 Share Posted August 20, 2023 Oh, and a bit of math on that INT drain distribution: we can find the measure known as "variance" for the various possibilities. The standard deviation is then the square root of the variance. Variance is calculated as the average of (value - mean)^2. There are lots of tricks for getting at this without doing too much work, of course. Discrete uniform distribution on {1,2,3,4,5}: mean 3, variance (4+1+0+1+4)/5 = 2. Original testlum suggestion with decoupling bug: this is the sum of five independent random variables. That independence means the variances add. Mean (1/5+2/5+3/5+4/5+5/5) = 3, variance (4/25+16/25+36/25+64/25+100/25) = 8.8. CamDawg suggestion with decoupling bug: again, a sum of five independent random variables. Mean (1/5+2/5+3/5+4/5+5/5), variance (4/25+6/25+6/25+4/25+0) = 0.8. Quote Link to comment
DavidW Posted August 24, 2023 Share Posted August 24, 2023 This is almost certainly overkill (Cam's suggestion is fine) and just out of mathematical curiosity, but you could also do this: - create subspells dwintd1, dwintd2, dwint3. - The original item drains 1 INT, and then casts dwintd1with probability 80% - dwintd1 drains 1 INT, and then casts dwintd2 with probability 75% - dwintd2 drains 1 INT, and then casts dwintd3 with probability 67% - dwintd3 drains 1 INT, and then drains 1 INT with probability 50% If I did the math right, that reproduces the desired probability distribution exactly while being immune to the autopause bug (since the probabilities are all being rolled independently anyway). Quote Link to comment
Jarno Mikkola Posted August 26, 2023 Share Posted August 26, 2023 On 8/24/2023 at 10:40 PM, DavidW said: then casts dwintd1with probability 80% ... Again, one needs to give the probability with the above ranges... aka from 0 to 79... as in, don't forget allwehavelearnedalready. Quote Link to comment
DavidW Posted August 26, 2023 Share Posted August 26, 2023 2 hours ago, Jarno Mikkola said: Again, one needs to give the probability with the above ranges... aka from 0 to 79... as in, don't forget allwehavelearnedalready. Probability 80% *is* 0-79, as in, don’tassumei’manidiot. Quote Link to comment
Recommended Posts
Join the conversation
You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.