I am not going to argue with scrawl, he is seemingly right with the (x < int(fSleepRandMod*housToWait)), but i do not understand why bethesda would make it so resting 4 hours gives you a higher chance to get an interruption than resting 23 hours..

//(x < int(fSleepRandMod*hoursToWait))

hours: 1 Interruptions: 0/100,000

hours: 2 Interruptions: 0/100,000

hours: 3 Interruptions: 0/100,000

hours: 4 Interruptions: 24910/100,000

hours: 5 Interruptions: 20089/100,000

hours: 6 Interruptions: 16773/100,000

hours: 7 Interruptions: 14274/100,000

hours: 8 Interruptions: 25032/100,000

hours: 9 Interruptions: 22480/100,000

hours: 10 Interruptions: 19861/100,000

hours: 11 Interruptions: 18092/100,000

hours: 12 Interruptions: 24922/100,000

hours: 13 Interruptions: 23044/100,000

hours: 14 Interruptions: 21390/100,000

hours: 15 Interruptions: 19921/100,000

hours: 16 Interruptions: 24972/100,000

hours: 17 Interruptions: 23428/100,000

hours: 18 Interruptions: 22177/100,000

hours: 19 Interruptions: 21085/100,000

hours: 20 Interruptions: 25268/100,000

hours: 21 Interruptions: 23906/100,000

hours: 22 Interruptions: 22699/100,000

hours: 23 Interruptions: 21754/100,000

hours: 24 Interruptions: 25034/100,000

In terms of mirroring Vanilla Morrowind, The formula is excellent, but I don't understand why the odds should behave like this in the first place.

as a side note, since the odds are pretty much set at 25% regardless of how long you sleep, there is no real reason to take the hoursToWait into consideration in the formula, sans the first 3 hours.

Code: Select all

```
x=rand()/(RAND_MAX+1)
if (hoursToWait > 3 && x < fSleepRandMod){
//prep for interrupt
}
//
hours: 1 Interruptions: 0/100,000
hours: 2 Interruptions: 0/100,000
hours: 3 Interruptions: 0/100,000
hours: 4 Interruptions: 25046/100,000
hours: 5 Interruptions: 24930/100,000
hours: 6 Interruptions: 25170/100,000
hours: 7 Interruptions: 25063/100,000
hours: 8 Interruptions: 24888/100,000
hours: 9 Interruptions: 24969/100,000
hours: 10 Interruptions: 24998/100,000
hours: 11 Interruptions: 25069/100,000
hours: 12 Interruptions: 24852/100,000
hours: 13 Interruptions: 25145/100,000
hours: 14 Interruptions: 24871/100,000
hours: 15 Interruptions: 24817/100,000
hours: 16 Interruptions: 24702/100,000
hours: 17 Interruptions: 25123/100,000
hours: 18 Interruptions: 24850/100,000
hours: 19 Interruptions: 25241/100,000
hours: 20 Interruptions: 25164/100,000
hours: 21 Interruptions: 24955/100,000
hours: 22 Interruptions: 24912/100,000
hours: 23 Interruptions: 25143/100,000
hours: 24 Interruptions: 25138/100,000
```

This is a little less wonky than the new current formula, and probably more simplistic in terms of calculations.

although, you already have the rollDice() function set, so In terms of simplicity you might as well keep it as it is. it's just two relatively unnecessary multiplication.

also, scrawls formula has the benefit of preserving fSleepRandMod=1.0 causing 100% interrupts when sleeping outside, I think there's a mod that does that, IIRC. So it's likely best to stick with that.