Welcome to the AFK Mods bug tracker. In order to report an issue, you need to have a VALIDATED account to post one. Once you have followed the link the registration email sent you, please select a project from the drop down menu below. Select “Open New Issue” and fill out the form with as many details as possible.

Issue Data
Status: Closed
Issue Type: Bug Report
Project: Unofficial Skyrim Special Edition Patch
Component: Skyrim SE: Vanilla
Category: Papyrus
Assigned To: Garthand
Platform: All
Severity: Very Low
Votes: 0
Watching: N/A
Opened By Garthand on Jan 3, 2021 5:10 pm
Last Edited By Garthand on Jan 3, 2021 5:17 pm
Closed By Arthmoor on Jan 14, 2021 4:56 pm
Resolution: Fixed
Comment: Fixed for USSEP 4.2.5.

Issue #29500: Traps Ignore Disease Resistance

tl;dr: The TrapHitBase script ignores player disease resistance, fix attached using the same method as used for the new Survival diseases in the unofficial survival patch.

This probably never got noticed because the chance of contracting disease from a trap is very low (usually 1-2%), and vampires and werewolves have a separate check that makes them immune, and so only players who have 100+ disease immunity and aren't werewolves or vampires would have noticed. Players with less than 100 disease immunity would probably think they were just very unlucky.

An easy way to confirm the bug's existence is to take a vanilla trap like the Dwemer Thresher, change the DiseaseChance property on TrapHitBase to 100.0 so that the trap will try to apply the disease on every hit (instead of only 1% of the time), and equip a necklace of disease immunity. You'll still get diseases after every hit. Based on this it doesn't appear that AddSpell checks the player's disease resistance before applying a disease.

With the fix, it behaves as expected. So if the trap had a 1% chance of infecting the player, and the player had 50 disease resistance, we would expect the final chance of a disease to be 0.5%.

As seen here:

Float diseaseResistMult = Game.GetPlayer().GetActorValue("DiseaseResist")
if canDisease && isPlayer && C00.PlayerHasBeastBlood == false && PlrVampQuest.VampireStatus == 0 && diseaseResistMult < 100.0
;if randomFloat(0.0, 100.0) <= diseaseChance
Float chance = diseaseChance * (100.0 - diseaseResistMult)
Float result = utility.RandomFloat(1.0, 10000.0)
if result <= chance
int diseasePick
diseasePick = randomInt(1,6)

A disease is applied if the random float is 50.0 or less out of 10000.0, which is a 0.5% chance as expected.

Attached Files:

Trap Disease Fix.zip