From NWN Lexicon
Revision as of 23:28, 9 March 2021 by Jasperre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Returns an effect which increases spell resistance.


Amount of spell resistance increase (0 - 128)


Returns an effect which increases spell resistance by nValue. It can only be applied to creatures, doors and placeables cannot have spell resistance. If nValue is less than 1, nothing happens. If nValue is over 128 it is capped to 128.

Only the highest amount of spell resistance applies. Monks feat Diamond Soul is counted separately (although it only applies if higher than any effects) and cannot be decreased by EffectSpellResistanceDecrease, but this effect and item properties applying spell resistance can. You can get the amount of spell resistance ResistSpell uses using GetSpellResistance.

GetSpellResistance essentially does:

  • Get all spell resistances -> Check for highest
  • Get all spell resistance decreases -> check for highest penalty
  • Check if Diamond Soul SR is higher than (Highest SR - Highest SR penalty), if so return Diamond Soul, else return the calculated highest spell resistance.

Spell resistance is a special defensive ability. If your spell is being resisted by a creature with spell resistance, you must make a caster level check (1d20 + caster level) at least equal to the creature's spell resistance for the spell to affect that creature. The defender's spell resistance is like an Armor Class against magical attacks. This check is hardcoded into the function ResistSpell.

This effect should not be applied instantly, only temporarily or permanently.


Spell resistance should generally be a minimum of 10 (as generated by items with the property) to be of any use.

It also shouldn't stack with itself, or any form of Monk spell resistance, but only the highest applies at any one time.

Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via. looping valid effects on the target (GetFirst/NextEffect()). See the Effect Tutorial for more details.

Effect Breakdown

Once applied this effect will alter the spell resistance if it is a bigger increase than the previous spell resistance increases or item properties. On removal it calculates the correct next biggest spell resistance increase. As above they don't stack, only the highest applies.

It is not possible to have this in VersusAlignmentEffect in spite of the fact Bioware tries to do this for some spells. See Known Bugs.

The value 0 is actually valid, although obviously this doesn't do anything.

Spell resistance shows up on the players character sheet when altered by this and an effect icon will be applied.

nIndex Parameter Value Description and Notes
0 nValue The amount of spell resistance increase this effect is applying.

Known Bugs

This effect does pass validly into VersusAlignmentEffect and VersusRacialTypeEffect however they don't do anything, and the Spell Resistance just gets applied to any source of spells regardless of the creatures alignment or race. This was used in spells by Bioware so unfortunately they are bugs affecting core spells - in so far as those spells always apply the spell resistance given.




// Sample code for applying an increase of 20 to spell resistance

void main()
    // This is the Object to apply the effect to.
    object oTarget = OBJECT_SELF;

    // Create the effect to apply
    effect eSRInc = EffectSpellResistanceIncrease(20);

    // Create the visual portion of the effect. This is instantly
    // applied and not persistent with whether or not we have the
    // above effect.
    effect eVis = EffectVisualEffect(VFX_IMP_GLOBE_USE);

    // Apply the visual effect to the target
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
    // Apply the effect to the object  
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eSRInc, oTarget);

See Also


ApplyEffectToObject EffectSpellResistanceDecrease ResistSpell GetSpellResistance

 author: Brett Lathrope, editor: Jasperre, additional contributor(s): Jasperre