Engine bug with scripted damage reduction

I think that there is a bug in the engine that affects scripted damage reduction, e.g. using EffectDamageReduction(). As far as I can tell, it only affects DAMAGE_POWER_PLUS_SIX. When a script creates DR at that damage power, a +6 or greater weapon should bypass the DR. But, it doesn’t (it requires a +7 or better weapon). This is true whether the weapon is +6 AB or +6 EB. (I have not tested things like Arcane Archer enchanted arrows or whether the DR bypass for creature weapons on creature with their own DR works). As far as I can tell, this is only for scripted DR, not permanent item DR.

To duplicate this, take a simple DR spell like Premonition or Stoneskin and, in the call to EffectDamageReduction(), change DAMAGE_POWER_PLUS_FIVE to DAMAGE_POWER_PLUS_SIX. Then, just run a test where you take a PC with a +6 weapon against an enemy NPC that casts that spell. I did this with a level 17 Duergar Mage (x2_mephduer009) as the enemy NPC.

Can anyone confirm this? I am pretty sure this is an engine bug that should be reported to Beamdog.

1 Like

confirmed, constants in script editor (nwscript.nss) have incorrectly +1 offset (there is some legacy unused DAMAGE_POWER_ENERGY = 6 and +6 to +20 are offsetted by +1)

quick fix is to code it as DAMAGE_POWER_PLUS_SIX-1

yeah definitely report it to BeamDog, changes to nwscript.nss are not really possible and recommended now with it changing each patch

Thanks for the confirmation. BTW, I only did a brief test above +6, but I was finding that scripted +7 DR was working properly. That is, if I altered Premonition to use DAMAGE_POWER_PLUS_SEVEN, then a +7 weapon would bypass the DR, as it should. It’s possible that only +6 DR (DAMAGE_POWER_PLUS_SIX) is affected.

I have reported the issue to Beamdog’s Atlassian site. Not sure if others can see it, but my bug report is at this link.