GetSpellResistance(object)

From NWN Lexicon
Jump to: navigation, search

Returns the spell resistance of the specified creature

int GetSpellResistance(
    object oCreature
);

Parameters

oCreature
Creature whose spell resistance to determine

Description

Returns the spell resistance of the specified creature.

Returns 0 if the creature has no spell resistance or an invalid creature is passed in.

Since Spell Resistance increases and decreases do not stack (the highest increase, and highest decrease only applies), 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.

Remarks

This is the amount of Spell Resistance used by the function ResistSpell.

There is no way to use this value using the internal engine (No way to use ResistSpell with an altered value), however, custom checks could use this.

Known Bugs

Diamond Soul cannot have the feat SR effect ever decreased for some reason, not sure why.

VersusAlignmentEffect and VersusRacialTypeEffect do not work with EffectSpellResistanceIncrease nor EffectSpellResistanceDecrease, so 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.

Version

1.62

See Also

functions:

EffectSpellResistanceIncrease EffectSpellResistanceDecrease ResistSpell


 author: Lilac Soul, editor: Jasperre, additional contributor(s): Jasperre