FANDOM


// Create a Damage Reduction effect
// - nAmount: amount of damage reduction
// - nDmgBonus: (dependent on the nDRType)
//		- DR_TYPE_NONE:       ()
//		- DR_TYPE_DMGTYPE:    DAMAGE_TYPE_*
//		- DR_TYPE_MAGICBONUS: (DAMAGE_POWER_*)
//		- DR_TYPE_EPIC:       ()
//		- DR_TYPE_GMATERIAL:  GMATERIAL_*
//		- DR_TYPE_ALIGNMENT:  ALIGNMENT_*
//		- DR_TYPE_NON_RANGED: ()
// - nLimit: How much damage the effect can absorb before disappearing.
//   Set to zero for infinite
// - nDRType: DR_TYPE_*
//effect EffectDamageReduction(int nAmount, int nDamagePower, int nLimit=0);
// JLR - OEI 07/21/05 NWN2 3.5 -- New Damage Reduction Rules
//effect EffectDamageReduction(int nAmount,
				int nDmgBonus=DAMAGE_POWER_NORMAL,
				int nLimit=0,
				int nDmgCat=DAMAGE_TYPE_ALL,
				int nMatType=MATERIAL_NONSPECIFIC,
				int nIsRanged=FALSE,
				int nIsOREffect=FALSE);
// JLR-OEI 02/14/05 NWN2 3.5 -- New Damage Reduction Rules
effect EffectDamageReduction(int nAmount,
				int nDRSubType=DAMAGE_POWER_NORMAL,
				int nLimit=0,
				int nDRType=DR_TYPE_MAGICBONUS);

This function is used for physical Damage Reduction. The DRType and DRSubType define what sort of attack bypasses the reduction. For elemental Damage Resistance, use EffectDamageResistance.

Note: Two of the constants that may be used in this function, DAMAGE_TYPE_ALL and DAMAGE_TYPE_BLUDGEONING as nDRSubType (if nDRType = DR_TYPE_DMGTYPE), are reversed. - Not quite correct, see below.

Correct functioning of this function First thing to note is the script parameters as listed above are confusing to the new scripter and overall badly documented.

This is the correct version:

effect EffectDamageReduction(int nAmount, int nDRSubType=DAMAGE_POWER_NORMAL, int nLimit=0, nDRType=DR_TYPE_MAGICBONUS);

Parameter values are as described at the top except that nDmgBonus is the nDRSubType.


Notable Issue with regards to DR_TYPE_DMGTYPE Edit

If you are wanting to set physcial damage resistances to specific types of weapons do not use the DAMAGE_TYPE_* constants as these are wrong for this function. Instead use the IP_CONST_DAMAGETYPE_* constants instead. However, these only cover the base type. Not certain at this stage whether adding multiple types allows OR or AND type reduction. Also there are no types to cover two types with a single effect (eg: Morningstar or Halberd).

Testing also shows that DR/Piercing does not work properly. It can be bypassed by Slashing and when used in combination with DR/Bludgeoning cannot be bypassed by a Morningstar, even though it should.

Further testing by Lance Botelle shows that weapon descriptions regarding their types do not match the actual type of weapon. For example, the Longsword is actually both Slashing and Piercing. This means current info here needs revising. To fix in your own module you either need to change the weapon type in baseitems.2da or change the description.


Combining DR Edit

Unlike when setting item properties you can select whether damage types should be AND or OR (ie: whether both types are required or just one), with EffectDamageReduction it always assumed AND. For example, if a creature has DR10/Bludgeoning and DR10/Cold Iron then to bypass it you would need a Cold Iron Bludgeoning Weapon.

For a fuller discussion see this thread: http://forum.bioware.com/topic/506308-effectdamageresistance-problem/

(Ignore the thread title, usual resistance/reduction mix up.)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.